How to land using mavlink?

Drone is ANAFI USA.
I refer to the example.
I can use the takeoff command.

	mavlink_message_t* msg = new mavlink_message_t();
	mavlink_command_long_t data;
	data.command = MAV_CMD::MAV_CMD_NAV_TAKEOFF;
	data.confirmation = 0;
	data.param1 = 0;
	data.param2 = 0;
	data.param3 = 0;
	data.param4 = 0;
	data.param5 = 0;
	data.param6 = 0;
	data.param7 = 1;
	data.target_system = m_TargetSystemId;
	data.target_component = m_TargetComponentId;
	mavlink_msg_command_long_encode(m_SystemId, m_ComponentId, msg, &data);
	uint16_t len = mavlink_msg_to_send_buffer(buf, msg);
	UDP_Socket->Send(buf, len);

take off is work,
but land not work.

	mavlink_message_t* msg = new mavlink_message_t();
	mavlink_command_long_t data;
	data.command = MAV_CMD::MAV_CMD_NAV_LAND;
	data.confirmation = 0;
	data.param1 = 0;
	data.param2 = 0;
	data.param3 = 0;
	data.param4 = 0;
	data.param5 = 0;
	data.param6 = 0;
	data.param7 = 0;
	data.target_system = m_TargetSystemId;
	data.target_component = m_TargetComponentId;
	mavlink_msg_command_long_encode(m_SystemId, m_ComponentId, msg, &data);
	uint16_t len = mavlink_msg_to_send_buffer(buf, msg);
	UDP_Socket->Send(buf, len);

Is the landing command wrong?

Hello,

MAV_CMD_NAV_LAND is only a filghplan navigation command on our side.
we implemented MAV_CMD_NAV_TAKEOFF for convenience while using QGroundControl software, as it takes into acount the arming process.

The correct way to land is to switch the flightmode (with MAVLINK_MSG_ID_SET_MODE command) to main mode: PX4_CUSTOM_MAIN_MODE_AUTO and sub mode: PX4_CUSTOM_SUB_MODE_AUTO_LAND

opposite way to takeoff with PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF which bypasses the arming process.

So these commands can only be used for filghplan
https://developer.parrot.com/docs/mavlink-flightplan/messages_v2.html

Then there is a description or example.
like these:
The correct way to land is to switch the flightmode (with MAVLINK_MSG_ID_SET_MODE command) to main mode: PX4_CUSTOM_MAIN_MODE_AUTO and sub mode: PX4_CUSTOM_SUB_MODE_AUTO_LAND

Direct drone control with mavlink commands.
Fly to the point (like MAV_CMD_NAV_WAYPOINT or MAV_FRAME_GLOBAL_RELATIVE_ALT_INT)
Rotate yaw (like MAV_CMD_CONDITION_YAW)

Is there an example or documentation reference?
thanks you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.