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.
Ahh, I see. Thank you for the explanation! Would I still use MAV_CMD_DO_SET_MODE to change between different flight modes or is there something else I should be using?
I seem to be having an issue where the flight mode (auto) is unsupported/unknown when I use MAV_CMD_DO_SET_MODE.
Also, would this make sense? I want to put the drone in Throw mode using Mission Planner. It’s set to go into Loiter mode after. I want to monitor the mav_state from the heartbeat messages and once the drone is determined to be active, I want to use the Arduino to change the flight mode to Auto and send a message telling it to land.
My flight controller (Spektrum DX8) has a two position switch for Radio 5 - I set one to Throw mode and one to Stabilize (as suggested in the pixhawk tutorials). If I leave it set in Throw mode, is the pixhawk automatically in that state or do I need to arm it first? For my Throw mode parameters, I’ve set it so the throw type is a drop, the motors are stopped when waiting for the throw, and the next mode is Loiter.
Thank you so much for all your help so far! I really appreciate it.
Are you using PX4? Because Mission Planner is supposed to be used with ArduPilot. That could mean that you are trying to go into an ArduPilot mode which PX4 does not support.