Error when running python scripts in companion

Hello,

For our project, we need to run python scripts for arming, disarming, and basic movements on the companion computer alone. For now, we’ve sshed into the pi and created a folder of scripts to run. However, when we do run them, there is always an error thrown on the MAVLink connection line:

>>> master = mavutil.mavlink_connection('udpin:0.0.0.0:14550')
OSError: [Errno 98] Address already in use

I can provide the full code if needed, but I believe the problem lies with the connection line alone. We have made sure that QGroundControl is not running on any of our laptops, and even after a reboot, it still won’t work.

Any ideas about why this is happening?

Hi @skarnati20,

That line is for connecting to the vehicle via the topside computer. If you’re trying to run pymavlink on your onboard computer you’ll want to follow the connection instructions for doing so.

This happens if something else is already connected to that port (on the computer you’re on). That can be another program, or the running program if you’ve tried to connect multiple times.