Print to MAVLink Shell?

On my Pixhawk 1, I used the serial port via an FTDI cable for debugging. I would print variables to the console using printf() or PX4_INFO().

I am now trying to debug code on a Pixhawk Mini. I am accessing the nsh console via mavlink. PX4_INFO() and printf() won’t print to the shell…are there any equivalent functions I could use here?

I would also like to see an answer to this question.

It’s been almost 2 years since I’ve had my hands on PX4 and back then I used a similar workflow as what you are describing: FTDI cable into Pixhawk 1. When I wanted a printf() statement to make it to the nuttx shell, I remember stopping and starting an app. For example, if I wanted to debug something I was changing in mavlink_receiver.cpp, I would do the following:

nsh> mavlink stop-all
nsh> mavlink start

and then I would start to see my debug printf() statements

I’ve now moved to the Intel RTF and, as far as I can tell, the only way I can interface with the NuttX Shell is via the mavlink shell: Firmware/Tools/mavlink_shell.py. My old workflow of stopping and starting still works for most apps (e.g. mc_pos_control) but not if I am debugging mavlink itself. The problem here is that I cannot stop and start mavlink anymore because stopping it cuts off my session with the flight controller.

Therefore I want my PX4_INFO() and PX4_WARN() statements to automatically print to mavlink shell from startup without me having to do my clunky stop-start workflow.

Thanks!

Is there any progress to this?

You can use " dmesg -f " in nsh shell to see PX4_INFO() messages

1 Like

I have similar problem. However mavlink stop-all crashes the connection and I am not able to resume with mavlink start.