drone does not go into offboard mode

13 views
Skip to first unread message

Дана Маркова

unread,
Jun 5, 2024, 3:27:57 AMJun 5
to MAVLink
I'm writing code in C++ using the Mavlink library. I needed to implement an algorithm for switching to offboard mode. I looked at the documentation and did as it says. First, I send coordinates in a separate thread at 2 Hz with the message mavlink_msg_set_position_target_local_ned_pack, where x, y, z are zeros. I then call a function in another thread in which I send these messages sequentially:
    1.mavlink_msg_set_position_target_local_ned_pack(system_id, component_id, &msg, 0,sysid,compid,1, 4088, 0.0, 0.0, 0.0,0.0,NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN );
    2.mavlink_msg_command_long_pack(system_id, component_id,&msg, sysid, compid,MAV_CMD_DO_SET_MODE, 0,
    0, 209, 6, 0, 0, 0, 0);
   3. mavlink_msg_command_long_pack(system_id, component_id, &msg2, sysid, compid,MAV_CMD_COMPONENT_ARM_DISARM, 0.0,
    1.0 ,0.0,0.0,0.0,0.0,0.0, 0.0);

After that, the first thread starts sending non-zero coordinates. Can you please tell me why I do not switch to the offboard mode ?
After sending commands it shows that they are sent successfully (MAVLINK_MSG_ID_COMMAND_ACK message comes).
Reply all
Reply to author
Forward
0 new messages