PX4 work_queue task unable to print out PX4_INFO in nsh?

Hello, I am trying to write a module using work queue task in PX4. I notice that inside the Run() function, PX4_INFO logging system doesn’t seem to print out anything to the nsh but it works fine in the init() function. For example,

bool LedHeading::init()
// Run on fixed interval
ScheduleOnInterval(1_s); // 1000000 us interval, 1 Hz rate
return true;

will print “Test” on the nsh terminal upon starting the module, however

void LedHeading::Run()
if (should_exit()) {


PX4_INFO(“Inside loop”);

will not print “Inside loop” at all… even though it is scheduled to run every second in the init(). I read that work_queue task does not support blocking calls, but PX4_INFO should not be a blocking call??
I am testing this module on a holy bro pixhawk4 hardware.


How are reading the print calls? Are you using a console on the debug port?

E.g. through something like this: Pixhawk Debug Adapter – Holybro

I am using QGC → MavLink Console via micro usb port in the Pixhawk4

Yer, so the work queue is already started and the printfs of it go to the debug console port, and not the console that you are accessing using MAVLink.

I can recommend one of these two options to properly get printfs:

  1. Get a proper debug adapter like the one linked above, or the Dronecode Probe v2.3 JTAG/SWD adapter + USB-UART adapter with DCD-M ca – Zubax Robotics
  2. Set up the console on another serial port and connect an FTDI cable to that output. The list of the serial ports is here: Holybro Pixhawk 4 (Discontinued) | PX4 User Guide, and the setting for the selection of the port is here: PX4-Autopilot/defconfig at 8feb662557f13e385519d039a4c9501b6c885076 · PX4/PX4-Autopilot · GitHub

Okay thanks! Is there a way to print to the MAVLink console instead? I don’t have the dronecode probe with me now.

You can use mavlink_log and send statustexts.

That seems to be good enough for now. Thanks!