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 mavproxy.py
pi@navio:~/python_scripts $ mavproxy.py
Auto-detected serial ports are:
/dev/ttyS0
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.
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.
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:127.0.0.1:14550”
reboot navio
launch mavproxy
sudo mavproxy.py --master=udp:127.0.0.1:14550
you should see the following:
Connect udp:127.0.0.1:14550 source_system=255
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from 127.0.0.1:14550
MAV> GPS lock at 128 meters
online system 1
HOLD> Mode HOLD
APM: ArduRover V4.0.0 (1df06120)
APM: c8ddfcbd382a4873be442f69509bd3d2
Received 895 parameters
Saved 895 parameters to mav.parm
use commands:
help
param show
status
the status will show the latest mavlink message packets. You should see a line like this containing the gps information: