If I wanted to control (switch on or off) the navigation lights on our drone with a standard MAVLink message, which message would you suggest I use?
As background, the navigation lights are driven by some external circuitry which includes a microcontroller that constantly listens to the MAVLink stream coming from the ground. Our current solution is to inject a custom message which is picked up by the microcontroller and then drives the lights on or off. Although this works fine, we wanted to rather use a standard Ardupilot supported message. This will allow us to for example create a Mission Planner plugin to control the navigation lights (unless it’s possible to use custom messages without recompiling MP).
What is the purpose of “mavlink_msg_led_control” could it be used? Any ideas or further advice?
You can use MAV_CMD_DO_SET_RELAY.
You need to define some outputs to relay, too.
I guess that would then also cause the autopilot to drive some IO pins.
In our case we don’t really want the autopilot to react to the message. The message should just be injected into the stream and send to the drone. On the drone our navigation light controller (separate hardware) will also listen to this stream and pick out the message and drive the lights accordingly.
Technically we can use any message that is send from MP. But we are looking for something that would be the most suitable for this task.
You can still send MAV_CMD_DO_SET_RELAY using COMMAND_LONG with changing the target_component to your navigation light controller’s mavlink component id.
And parse mavlink messages in your navigation light controller.
If you really want a complete new mavlink message, you can define it with a custom dialect, too.
There is a message defined in ardupilotmega called LED_CONTROL, may be you can use it too.
This is used in libraries/AP_Notify/RGBLed.cpp, and libraries/AP_Notify/OreoLED_I2C.cpp
This is probably the best solution for now. Maybe in the future there will be a Navigation Light service (like for the camera) we could use. Thanks for the advice!