hello guys i’m using mavlink c++ applications. after the drone takeoff, i would like to send the mavlink message to tell the drone to go to a specific location.
- My firmware PX4 autopilot
- Mavlink 2 c++
i was archived that by change drone to OFFBOARD mode and then send the position_target_global_int message.
but my target is do the similar thing like the QGroundcontrol do without change the drone mode. the goto_position when click to the QGC screen.
i also used mavlink MAV_CMD_DO_REPOSITION message
mavlink_msg_command_long_pack(
system_id, // System ID of GCS
component_id, // Component ID of GCS
&message, // MAVLink message
target_system, // Target system ID
target_component, // Target component ID
MAV_CMD_DO_REPOSITION, // Command ID
current, // Confirmation (0: first transmission)
param1, // Parameter 1
static_cast<float>(MAV_DO_REPOSITION_FLAGS_CHANGE_MODE), // Parameter 2
param3, // Parameter 3
param4, // Parameter 4
int32_t(std::round(latitude * 1e7)), // Parameter 5: Latitude
int32_t(std::round(longitude * 1e7)), // Parameter 6: Longitude
60 // Parameter 7: Altitude
);
but the drone keep moving south and not go to my target
please help me !