How do i connect to the Ardupilot using mavproxy?

How do i connect to the Ardupilot using mavproxy?

I have a Navio2 hat on a raspberry pi 4. I want to run a python script on the pi4 to communicate with the Ardupilot running on the pi4. I think i am supposed to use mavproxy to do this. It is already installed in the emlid software. It is looking for a serial port but does not find it. The following is what happens when i try to run

pi@navio:~/python_scripts $
Auto-detected serial ports are:
Connecting to /dev/ttyS0
Connect /dev/ttyS0 source_system=255
Failed to connect to /dev/ttyS0 : Could not configure port: (5, ‘Input/output error’)

It would be helpful to see a python script that connects via mavlink and can get and set some parameters.

thank you,

Hi @jerome1,

To launch the MAVProxy on Navio2, you also need to specify the IP address of Ground Control Station: --master --console

Where is the IP address of the GCS.

I figured out how to do it. I’ll leave my solution here for others.

I have a raspberry pi with a navio2 hat. What i would like to do is connect to the MAVlink via mavproxy running on the raspberry pi and be able to get parameters and get GPS ie ‘GLOBAL_POSITION_INT’ from MAVlink.

  1. In your ardupilot launch file specify your local connection.

open launch file

pi@navio: ~ $ sudo nano /etc/default/arducopter

set a local connection in the file

TELEM1="-A udp:"

reboot navio

  1. launch mavproxy

sudo --master=udp:

you should see the following:

Connect udp: source_system=255
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from
MAV> GPS lock at 128 meters
online system 1
APM: ArduRover V4.0.0 (1df06120)
APM: c8ddfcbd382a4873be442f69509bd3d2
Received 895 parameters
Saved 895 parameters to mav.parm

use commands:
param show

the status will show the latest mavlink message packets. You should see a line like this containing the gps information:

2060: GLOBAL_POSITION_INT {time_boot_ms : 1055485, lat : 314869429, lon : -834839058, alt : 128160, relative_alt : 14, vx : -14, vy : 0, vz : 6, hdg : 17393}

next steps will be to write a script to read these packets.


Hi Jerome,

Glad to hear you sorted it out!

Thank you for sharing such a detailed guide :slightly_smiling_face:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.