Send a signal from the Navio2/Arducopter to the Raspberry Pi when changing flight mode

I would like to start a script in the Raspberry Pi when I disarm the quadcopter. Is it possible for Arducopter to send such a signal to the Pi?

Thanks,

Paul

Hi Paul,

ArduPilot won’t send any signal when disarming - you can change code to do that or you can look at the MAVLink heartbeat flags: if base mode has the bit corresponding to MAV_MODE_FLAG_SAFETY_ARMED set then it is armed, if it doesn’t then it is disarmed.

Thanks Francisco,

How can I query this MAV_MODE_FLAG_SAFETY_ARMED variable from the Raspberry Pi?

Paul

You need to receive the heartbeats sent by ArduPilot and then check if that bit is set in the base_mode field. First thing you need to do is have a working MAVLink connection.

Ok Francisco,

I think I understand - I need to run MAVLink on the Raspberry Pi and have Arducopter send telemetry to both my ground control station and the Pi?

I currenty send MAVLink to the GCS with the -A IP:Port command. Couldn’t the Pi see that same stream if I also send it to localhost?

Thanks again,

Paul

Yes to both questions.

Another possibility is to make use of ROS.