Mavproxy extremely high CPU usage


So I happened to check the onboard Pi’s resource usage and mavproxy/python are using literally all of the CPU, causing throttling. The robot is sitting out of the water and turned on. Rebooting does not reduce this.

When I checked a few weeks ago, the usage was sitting at a comfortable 25-30%. Between then and now I put ROS Kinetic on the Pi, and I’m wondering if there’s some magic commands I ran to let mavproxy go unchecked… I’m genuinely puzzled as to how mavproxy is suddenly this resource hungry :confused:

Hi Ethan,

indeed mavproxy is not CPU friendly.
I would recommend to replace mavproxy with mavlink-router.

Do you have an install guide for Mav-router? We have 80%+ CPU usage on our BlueROV2 Heavy while idling

Just an update to everyone who has come across this thread hoping to reduce the load that MAV communication has on their companion computer: Mavlink-router can not be installed on the BlueROV companion because the Python version on Raspbian Jessie is too old and can not be upgraded. An alternative that we got to run successfully is mavp2p. It comes pre-compiled for Arm7 architecture. Download and unpack on your Linux-laptop, then upload the unpacked file to the companion’s home directory using the file manager. Then go into the Pi’s terminal and run:

chmod +x ./mavp2p
screen -X -S mavproxy quit
./mavp2p serial:/dev/autopilot:115200 udps:localhost:9000 udps: udpb:

First line makes the script executable (this only needs to be done once after the file upload), second line kills the running mavproxy service (QGC will notice and tell you that it has lost communication) and third line restarts mavp2p with the same settings that were used in the mavproxy default parameter file (QGC will tell you that is has regained communication). If you made any changes to your mavproxy parameter file, you will need to change the arguments accordingly.

Finally: Since the new BlueOS can be run on more versions of Raspberry Pi, things are likely to be easier in the future.

1 Like

Thanks for sharing it! We are going to check mavp2p as an alternative.

1 Like

Hi @monsterbacke,

It’s perhaps worth noting that we changed our mavproxy configuration back in Companion 0.0.28 to reduce CPU usage down to more acceptable levels, so for many people it’s likely fine to just update if they haven’t done so already.

That said, mavproxy as a whole is quite CPU intensive, and it’s good to know about viable alternatives, so thanks for letting us know about mavp2p :slight_smile:

1 Like

Thanks @EliotBR!

After digging a bit deeper into the topic (reading @khancyr’s post here for example), I also saw that the mavproxy configuration on the BlueROV companion was already optimised.

The mavproxy process was still fluctuating between 60 and 90 per cent CPU load though and we found that to interfere with the streaming quality of our second camera as well as some delays in control. (Interesting that OP @ethanjpark also found this to be an issue after installing ROS kinetic, just like we did. Mavproxy CPU load was already high before then but not enough of an issue for us to look for alternatives until we also wanted to run ROS.)

mavp2p sits happily at around 10% :slight_smile:

1 Like

I have lowered Mavlink streamrate from 10 to 2 making companion processor load much lower.
Means slower update to topside (2Hz intead of 10), but not giving me problems.
You can change that in:

1 Like