Consoles/Shells
Last updated
Last updated
PX4 enables terminal access to the system through the and the .
This page explains the main differences and how the console/shell are used.
The PX4 System Console provides low-level access to the system, debug output and analysis of the system boot process.
There is just one System Console, which runs on one specific UART (the debug port, as configured in NuttX), and is commonly attached to a computer via an FTDI cable (or some other debug adapter like a ).
Used for low-level debugging/development: bootup, NuttX, startup scripts, board bringup, development on central parts of PX4 (e.g. uORB).
In particular, is the only place where all boot output (including information about applications auto-started on boot) is printed.
Shells provide higher-level access to the system:
Used for basic module testing/running commands.
Only directly display the output of modules you start.
Cannot directly display the output of tasks running on the work queue.
Can't debug problems when the system doesn't start (as it isn't running yet).
:::note The dmesg
command is now available through the shell on some boards, enabling much lower level debugging than previously possible. For example, with dmesg -f &
you also see the output of background tasks. :::
There can be several shells, either running on a dedicated UART, or via MAVLink. Since MAVLink provides more flexibility, currently only the is used.
The is essential when the system does not boot (it displays the system boot log when power-cycling the board). The is much easier to setup, and so is more generally recommended for most debugging.
For example, type ls
to view the local file system, free
to see the remaining free RAM, dmesg
to look at boot output.
This NSH command provides the remaining free memory:
The top command shows the stack usage per application:
Note that stack usage is calculated with stack coloring and is the maximum since the start of the task (not the current usage).
To see what is running in the work queues and at what rate, use:
To debug uORB topics:
To inspect a specific uORB topic:
:::tip Some commands may be disabled on some boards (i.e. the some modules are not included in firmware for boards with RAM or FLASH constraints). In this case you will see the response: command not found
:::
The MAVLink shell/console and the are used in much the same way.
Below are a couple of commands which can be used in the to get insights of the system.
Many other system commands and modules are listed in the (e.g. top
, listener
, etc.).