Hello Jacob
I got around to doing this. The RBP is running a python program, where I open a connection and write serial messages to my MyRio whenever the RBP receives HEARTBEAT, MANUAL_CONTROL and SET_MODE. I found out the flight mode is stored in SET_MODE, not in MANUAL_CONTROL
When I receiver HEARTBEAT, I also send out a heartbeat back from the RBP.
However, I am never receing any MANUAL_CONTROL or SET_MODE messages. And Ive gotten confused about which connection to use. The originally suggested one, udp:0.0.0.0:14550 disables when I open QGC, so Ive tried
udpout:0.0.0.0:9000, which gives me alot of messages, but not the ones I am looking for
udpout:localhost:9000 same
udpout:192.168.2.255:14550 which gives nothing
udpout:192.168.2.1:14400, source_system=2, source_component=1, which gives only heartbeats - I took this connection from Sending Data from Raspberry Pi to QgroundControl - #21 by jwalser
I would appreciate any advice you could give on trying to pick out joystick commands and flight in the Raspberry Pi.
The code is given below
# Import mavutil
from pymavlink import mavutil
import time
import serial
# Create the connection
master = mavutil.mavlink_connection('udp:0.0.0.0:14550')
# Wait a heartbeat before sending commands
master.wait_heartbeat()
while True:
msg = master.recv_match()
if not msg:
continue
if msg.get_type() == 'MANUAL_CONTROL'
x_axis = msg.x
y_axis = msg.y
z_axis = msg.z
r_axis = msg.r
js_buttons = msg.buttons
ser = serial.Serial('/dev/ttyS0', 9600)
ser.write(str(x_axis))
ser.write(",")
ser.write(str(y_axis))
ser.write(",")
ser.write(str(z_axis))
ser.write(",")
ser.write(str(r_axis))
ser.write(",")
ser.write(str(js_buttons))
ser.write(",\n")
if msg.get_type() == 'HEARTBEAT'
current_mode = msg.base_mode
ser = serial.Serial('/dev/ttyS0', 9600)
ser.write("0,0,0,0,0,")
ser.write(str(current_mode))
ser.write(",\n")
BR, Michael