I’m trying to use the Arduino Mega to send a do_set_mode command to a Pixhawk4 using MAVLink. This is what I’m using: mavlink_msg_command_long_pack(1, 0, &msg, 1, 0, MAV_CMD_DO_SET_MODE,0,220,0,0,0,0,0,0).
I’m trying to get my Pixhawk from Loiter mode to Auto mode. According to the documentation on MAVLink messages/commands, it says under MAV_MODE that 220 is MAV_MODE_AUTO_ARMED (System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by waypoints).
However, when I try to send the command and verify it using command_ack (Msg #77), it says the command is unknown/unsupported.
What am I doing wrong?