MAVLink + PX4 communicating with base station for computations


I have a Pixhawk 4 Mini and a Pi Zero for a companion computer. Is it possible to use the Pi Zero purely as a router to send commands to my base station? I would like to implement my ROS code (that works in Gazebo simulation just fine) but I am having trouble with communications in the physical setup.

To give some context, I can communicate with my Pixhawk via the Pi if I use the necessary mavros launch files on board the Pi. If I try to setup a mavlink-router connection from the Pi to my base station and run the mavros launch file on my base station I don’t get a heartbeat. I have a working (not as well as I want) setup by using a Xbee S2C bridge from the Pixhawk to my base station at 115200 BAUD. However, I think if I get the Pi Zero working I can achieve much higher data rates. That being said, the Pi Zero isn’t very good at running ROS on-board, so I want to send everything off-board where I can leverage the computational power of my server base station setup.

For context, the end goal is to have multiple quadcopters flying in a Motion Capture environment. The base station will be the “master” in this case, and will send position setpoints to the quads (in Offboard mode).

I would really some feedback. Thanks!


It seems you’re using the PX4 firmware? We’re likely not going to be able to much help here in the ArduPilot forum. Perhaps try the PX4 forum?

Honestly, I am open to ideas. I am currently using the PX4 firmware, but I can’t get any help (or even responses) in the PX4 forums. I’m a bit overwhelmed with getting this offboard + motion capture setup working. It definitely feels like 1 step forward 2 steps back right now.

You should be able to get at least 926400 baud on the Pixhawk, if you do not, switch to ardupilot. It can do that.

Yes, I agree, and I can do that. The issue may be more of a “wrapping my head around the problem” thing. With my Pi Zero I can talk to my Pixhawk 4 Mini using roslaunch mavros px4.launch. I want to use this information with my base station because the Pi Zero does not have enough computing power. One of my questions is: can I simply forward this information over a wireless network? To do this can I run roslaunch mavros px4.launch on my base station, or do I have to run this on the Pi?

Mavlink-router on the Pi, Ros/mavros on your pc.
At that point the Pi is just a radio, basically, so you might consider whether there’s a simpler or more robust way to achieve the same thing. Even an esp8266 would provide a reasonable datarate and personally I’d have greater confidence in it than a Pi zero.

yes, yes, and yes.

You can run ros master node on the Pi
You can run ros master node on the PC
You can forward information from the vehicle to the ground using ros over TCP.

I advise you to run ros master node on the vehicle and just connect to it from the ground.

Interesting, I appreciate the insight. If the vehicle is running the ROS master then the base station will need the appropriate ROS_MASTER_URI setting to connect with it. Would this cause problems if I wanted to run multiple quadcopters at the same time?

Given what you said, I think in the multiple quadcopter case it would be better to have the PC as the ROS master and the quadcopters as nodes with each quadcopter running roslaunch mavros px4.launch. Unless you think differently?

Yes, for multiple vehicles the way you describe does make more sense