are you using an unsigned char array
how are you sending the data currently?
it depends on how your data is stored in memory if that is where you are grabbing it from. We were in a hurry so we wrote the code below. I'm sure someone here can give you a more elegant approach.
void sendPacket(UDP & udp, double _speed, double _curvature, double _time)
{
int magicNum = 4480;
double speed = _speed;
double curvature = _curvature;
double time = _time;
unsigned char commandMessage[32] =
{
*(((unsigned char*)&magicNum) + 3), *(((unsigned char*)&magicNum + 2)), *(((unsigned char*)&magicNum + 1)), *(((unsigned char*)&magicNum + 0)),
*(((unsigned char*)&speed) + 7), *(((unsigned char*)&speed) + 6), *(((unsigned char*)&speed) + 5), *(((unsigned char*)&speed) + 4),
*(((unsigned char*)&speed) + 3), *(((unsigned char*)&speed) + 2), *(((unsigned char*)&speed) + 1), *(((unsigned char*)&speed) + 0),
*(((unsigned char*)&curvature) + 7), *(((unsigned char*)&curvature) + 6), *(((unsigned char*)&curvature) + 5), *(((unsigned char*)&curvature) + 4),
*(((unsigned char*)&curvature) + 3), *(((unsigned char*)&curvature) + 2), *(((unsigned char*)&curvature) + 1), *(((unsigned char*)&curvature) + 0),
*(((unsigned char*)&time) + 7), *(((unsigned char*)&time) + 6), *(((unsigned char*)&time) + 5), *(((unsigned char*)&time) + 4),
*(((unsigned char*)&time) + 3), *(((unsigned char*)&time) + 2), *(((unsigned char*)&time) + 1), *(((unsigned char*)&time)),
*(((unsigned char*)&magicNum) + 3), *(((unsigned char*)&magicNum + 2)), *(((unsigned char*)&magicNum + 1)), *(((unsigned char*)&magicNum + 0))
};
udp.SendPacket((char*)commandMessage, 32);
}