How does Pixhawk handle a custom mavlink msg in the low level?

Hello!

I am new to Pixhawk and PX4 codebase. I have been trying to understand how the low level architecture of PX4 works .

I am using my custom module that sends mavlink msgs to Pixhawk. It is connected to Telem 2 and I have a 3DR 433MHz radio on Telem 1 . I have followed the guide to add a uorb topic and a handle msg function in mavlink_receiver.cpp. When I start NSH via the serial console, I can see my custom topic but the issue is that it does not get updated. I am not sure why the Pixhawk is not receiving my msgs.

Here is my mavlink status, if that makes things clearer.
instance #0:
mavlink chan: #0
type: 3DR RADIO
rssi: 47
remote rssi: 0
txbuf: 100
noise: 49
remote noise: 0
rx errors: 0
fixed: 0
flow control: ON
rates:
tx: 0.089 kB/s
txerr: 0.000 kB/s
rx: 0.036 kB/s
rate mult: 0.058
accepting commands: YES
MAVLink version: 1
transport protocol: serial (/dev/ttyS1 @57600)

instance #1:
mavlink chan: #1
no telem status.
flow control: OFF
rates:
tx: 0.099 kB/s
txerr: 0.000 kB/s
rx: 0.000 kB/s
rate mult: 0.050
accepting commands: YES
MAVLink version: 1
transport protocol: serial (/dev/ttyS2 @57600)

instance #2:
mavlink chan: #2
no telem status.
flow control: OFF
rates:
tx: 0.000 kB/s
txerr: 0.104 kB/s
rx: 0.000 kB/s
rate mult: 0.050
accepting commands: YES
MAVLink version: 1
transport protocol: serial (/dev/ttyACM0 @2000000)

I want to understand where the raw data appears first before being decoded by the Mavlink receiver.
Also, my custom module sends Mavlink v1 msgs but I have built PX4 code with mavlink v2. I believe that Mavlink v2 is backward compatible and the version mismatch should not be creating trouble.
I am not progressing much and really need help.

1 Like

I am using the Telem2 port to handle some custom mavlink messages i created. You should follow this guide:
https://dev.px4.io/custom-mavlink-message.html

Seems you are using ttys2 port for telem2 (default case).