Hello,
I want to make communication between companion computer (jetson xavier) and my flight controller (orange cube). I can received mavlink message without problem, calculate the checksum… But there is something strange when sending mav message.
Firstly, the payload is an array (or vector) of uint64_t. So all the bytes are inside and we need to decode this to have each useful byte distinctly. Why not just use a uint8_t array instead of ?
Secondly, i can successfully send an heartbeat message thought this code :
(i wrote the payload by hand to see each byte and to fully understand)
But when i’m doing the same thing with a command long, it is wrong :
// Send a Command Long
float param1 = 27, param2 = 500000, param3 = 0.0, param4 = 0.0, param5 = 0.0, param6 = 0.0, param7 = 0.0;
uint8_t* array1 = reinterpret_cast<uint8_t*>(¶m1);
uint8_t* array2 = reinterpret_cast<uint8_t*>(¶m2);
uint8_t* array3 = reinterpret_cast<uint8_t*>(¶m3);
uint8_t* array4 = reinterpret_cast<uint8_t*>(¶m4);
uint8_t* array5 = reinterpret_cast<uint8_t*>(¶m5);
uint8_t* array6 = reinterpret_cast<uint8_t*>(¶m6);
uint8_t* array7 = reinterpret_cast<uint8_t*>(¶m7);
uint8_t arrayfinal_cmdlong[] ={array1[0], array1[1], array1[2], array1[3], array2[0], array2[1], array2[2], array2[3], array3[0], array3[1], array3[2], array3[3], array4[0], array4[1], array4[2], array4[3], array5[0], array5[1], array5[2], array5[3], array6[0], array6[1], array6[2], array6[3], array7[0], array7[1], array7[2], array7[3], 511&0xff, (511>>8)&0xff, 1, 1, 0};
mavros_msgs::Mavlink msg = im.FillMavlinkMess(0xFD, 33, 0, 0, 0, 18, 191, 76, arrayfinal_cmdlong, 152);
im.m_external_com_publisher.publish(msg);
i tried doing it byte by byte with array of uint64_t, or uint8_t but i don’t have any response from the FC.
I don’t understand why it is not working. If you have any idea thank you for your help.
Gjörn.