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.
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.