Mavlink routing to onboard pixhawk

Hi,

Maybe someone could help me on implementation of mavlink routing.

Main idea to send data to raspberry pi which will be connected through telem2, also send a acknowledge.

I have plugin (C# visual studio) for the mission planner, which works great. Now I want to send through pixhawk data to raspberry pi.

So how to send data using mavlink router ? and how to receive it in rasberry pi ?
I have read this https://ardupilot.org/dev/docs/mavlink-routing-in-ardupilot.html
but it not explained for me, just gived tips what it is possible.

Practically I need some tips on functions in C# and in python for raspberry.
for example msg.send(telem2, data)

Thanks

1 Like

Software such as mavlink-router is designed to do this. You’ll need to download the source code, build and install on your Raspberry Pi.

You’ll then need to configure mavlink-router to pass telemetry between the serial port of the Pi and a UDP network connection.

Once that is running, Mission Planner can send telemetry to the UDP port on the Pi and the Pi will pass it on to the Pixhawk (and vice-versa).

I explained not so clear. I could get all telemetry using mavlink and mavlink router (I have builded) if raspberry is connected to the network. But I am asking a little bit different for example my system

ground station (Missio planner + plugin C#) -> Telemetry(3dr) <-------> Telemetry(3dr) <- pixhawk <- raspberry pi <-camera

Now I want to send a message to raspberry from my plugin to change a camera mode and want to get from raspberry acknowledge. How to do it without raspberry connection to network ? only using UART between pixhawk and raspberry. On raspberry python script is used. Pixhawk is just a pass through system.

At google I can find only some tips and discussions

Thanks

1 Like

step by step
I have written 2 python scripts, one at rasp and on on PC. And at monitoring script I can’t see heartbeat of rasp in mavlink data flow :frowning:

However, from rasp I can monitor pixhawk also as from pc, so I have a link.
PC script which monitors all messages

from pymavlink import mavutil
import time

# Start a connection listening to a UDP port
the_connection = mavutil.mavlink_connection('COM8', baud=921600)

# Wait for the first heartbeat 
# This sets the system and component ID of remote system for the link
the_connection.wait_heartbeat()

while True:
    try:
        print(the_connection.recv_match().to_dict())
    except:
        pass
    time.sleep(0.1)

rasp script sends ~1Hz heartbeat to inform about component

from pymavlink import mavutil
import time

# Start a connection listening to a UDP port
the_connection = mavutil.mavlink_connection('/dev/ttyAMA0', baud=921600)

# Wait for the first heartbeat 
# This sets the system and component ID of remote system for the link
the_connection.wait_heartbeat()

# Send heartbeat from a MAVLink application. 
while True:
    the_connection.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_ONBOARD_CONTROLLER,
                                            mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
    time.sleep(1)

Someone could help me ?

1 Like

Hi!

Did you able to find a solution for this?