Mavlink Port Fowarding

Hello,

I am attempting to use the Mavlink port forwarding as noted in http://ardupilot.org/dev/docs/mavlink-routing-in-ardupilot.html to pass messages from a radio connected to Telem1 and an accessory connected to Telem2.

I have been able to get broadcast data going from a accessory through the Pixhawk down to the ground control station from the start without any issues. However, despite trying various system and component IDs including broadcast ones I have not been able to get messages from the software through the Pixhawk to the accessory. The messages do reach the PixHawk but are not forwarded as I would expected given the documentation. I took a quick look at the code and not being that familiar with it I can’t say with certainty by it does appear that the messages I am sending should be forwarded but are only done in one direction. I tried swapping the telemetry ports and it follows the software accessory arrangement so it is not the specific ports themselves. Has someone done much work using this feature and is there some obvious thing I am likely missing to get my desired setup operational.

Thank you!

1 Like

Is your accessory sending a MAVLink heartbeat? If I remember correctly that needs to happen so that ArduPilot that an accessory is present there and should forward the messages.

It was not initially but it is now and that did not change anything. Note however we had set the system ID to zero as this should force it to be broadcast but this didn’t work (not sure if that could be the issue).

Note that the we are seeing general status going through but it is the commands (command_long) among others that do not seem to be going through.

Is the system and component ID of the sending system correctly set? I’ve looked at the code and I don’t see why it wouldn’t work.

I will not get a chance to check everything till the new year. I thought I set them up properly and tried a few combinations quickly but with no luck. I guess I am confused as from what I am reading seems to be what I was trying should work.

Pixhawk is system ID 1 by default. My device has component camera ID. The software typically uses system ID 255 although we have tried 0 to do broadcast. So should my camera have the same system ID as pixhawk or 0 to broadcast or some other number like 2. On the software side what should my targets be to ensure command get through. I was mostly trying 0s to start with as I thought that would be the easiest to start with as I thought it would broadcast on all ports but did not find that was the case.

Some points:

  • your software should always have a defined source system and component IDs that aren’t broadcast, it identifies your software in the MAVLink network
  • your software can have the source system ID that the Pixhawk has or a different one
  • source system ID 255 is usually used by GCS, I would avoid using that since there might be some protection against message loopback (and messages with that source system ID would be discarded)
  • sending messages with target system and component ID set to 0 should broadcast them to everywhere

How did you get the data from the accessory through the flight controller to the ground? Did you use UDP broadcasting?