For our previous ground control software not using flytbase APi, written in C#, I did send the relay command in two different ways. One way was to add it as part of the mission, se further down in text, it might actually work with flytbase API after I did some testing today! This is needed for our normal way of executing missions, when all info sent to drone at startup.
Second way is to send it as a standalone message from the operator, this is especially needed for us for demo purposes, to be able to switch on/off lights and siren on demand when we are showing the system on presentations etc.
The stand alone mavlink message was sent like this:
MAVLink.mavlink_command_long_t setRelay = new MAVLink.mavlink_command_long_t()
param1 = (Single)relayId,
param2 = (Single)on,
param3 = (Single)0,
param4 = (Single)0,
param5 = (Single)0,
param6 = (Single)0,
param7 = (Single)0,
command = (UInt16)MAVLink.MAV_CMD.DO_SET_RELAY,
target_system = (byte)1,
target_component = (byte)0,
confirmation = (byte)0,
var d2 = tmp.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.COMMAND_LONG, setRelay);
int ka2 = mUdpClient.Send(d2, d2.Length, mEndPoint);
The command MAVLink.MAV_CMD.DO_SET_RELAY has the value 181.
When I look at the commands in flytbase API for Set Waypoints, I see that the enums in your doc all match , as expected, the commands in mavlink MAV_CMD (http://mavlink.org/messages/common). I tested now to add the value 181 as the command in the flytbase API fo Set Waypoints, and it was accepted. I can not fully verify the functionality yet, but when i read back the mission stored in pixhawk in APM missionplanner, I can see that that command looks good. All correct settings for param1 and param2 are made, I will try to verify the functionality fully tomorrow.
It would like to be able to send the relay_on/off command using the mavlink generic long_command (which is present in the rosapi as you showed me), as soon as possible. Can you fix it within 2-3 weeks that would be very appreciated. If that is not possible within that timeframe, just let us now and we have to adapt to it.