PX4_INFO doesn't work in some area

I’m debugging mc control through mixer.

I’m printing some information in the fast loop(ex. while loop MulticopterAttitudeControl::task_main) using PX4_INFO or warn, but no message printed to nsh.

But, if I print some message in px4_simple_app or mc_att_control app, it works.

I’m guessing there is something different in the fast loop area.

I tried to build adding debug option, like this. make px4fmu-v4_default PX4_CMAKE_BUILD_TYPE="DEBUG" upload, but it also fails.

Anything I missed for debug printing in the fast loop?
(I’m using pixracer)

Are you using a real console (https://dev.px4.io/en/debug/system_console.html) or nsh over mavlink (QGC)?

You can also print messages to the console and send over mavlink simultaneously with mavlink_and_console_log_info().

1 Like

I’m using nsh over mavlink.

  1. I’m quite confused with a real console and nsh over mavlink.
    If PX4_INFO() prints to a real console, why can I see some messages from PX4_INFO(“msg”) in nsh over mavlink when I executed px4_simple_app or mc_att_control status in nsh?

  2. I tried to use mavlink_and_console_log_info().
    I coded in mc_att_control_main.cpp and tested, but it doesn’t work.
    (I made sure that mavlink_log_info section executed.) What’s wrong with me?

    #include <systemlib/mavlink_log.h>
    static orb_advert_t mavlink_log_pub = nullptr;
    mavlink_log_info(&mavlink_log_pub, "Test");

Anyway, I succeeded to PX4_INFO() to system console through debug port(uart7).
Thank you.

But, I still don’t know why mavlink_and_console_log_info() fail to print to mavlink shell.

It’s printing to /dev/console, which is not the mavlink nsh instance.