Files
PX4-Autopilot/docs/zh/debug/consoles.md
T
Crowdin Bot 588fd9d684
Build all targets / Scan for Board Targets (push) Has been cancelled
Build all targets / Build Group [${{ matrix.group }}][${{ matrix.arch == 'nuttx' && 'x86' || 'arm64' }}] (push) Has been cancelled
Build all targets / Upload Artifacts to S3 (push) Has been cancelled
Build all targets / Create Release and Upload Artifacts (push) Has been cancelled
Checks / build (NO_NINJA_BUILD=1 px4_fmu-v5_default) (push) Has been cancelled
Checks / build (NO_NINJA_BUILD=1 px4_sitl_default) (push) Has been cancelled
Checks / build (check_format) (push) Has been cancelled
Checks / build (check_newlines) (push) Has been cancelled
Checks / build (module_documentation) (push) Has been cancelled
Checks / build (px4_fmu-v2_default stack_check) (push) Has been cancelled
Checks / build (px4_sitl_allyes) (push) Has been cancelled
Checks / build (shellcheck_all) (push) Has been cancelled
Checks / build (tests) (push) Has been cancelled
Checks / build (tests_coverage) (push) Has been cancelled
Checks / build (validate_module_configs) (push) Has been cancelled
Clang Tidy / build (push) Has been cancelled
MacOS build / build (px4_fmu-v5_default) (push) Has been cancelled
MacOS build / build (px4_sitl) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Has been cancelled
Container build / Set Tags and Variables (push) Has been cancelled
Container build / Build Container (amd64) (push) Has been cancelled
Container build / Build Container (arm64) (push) Has been cancelled
Container build / Deploy To Registry (push) Has been cancelled
EKF Update Change Indicator / unit_tests (push) Has been cancelled
Failsafe Simulator Build / build (failsafe_web) (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Has been cancelled
FLASH usage analysis / Publish Results (push) Has been cancelled
ITCM check / Checking nxp_tropic-community (push) Has been cancelled
ITCM check / Checking px4_fmu-v5x (push) Has been cancelled
ITCM check / Checking px4_fmu-v6xrt (push) Has been cancelled
MAVROS Mission Tests / build (map[mission:MC_mission_box vehicle:iris]) (push) Has been cancelled
MAVROS Mission Tests / build (map[mission:rover_mission_1 vehicle:rover]) (push) Has been cancelled
MAVROS Offboard Tests / build (map[test_file:mavros_posix_tests_offboard_posctl.test vehicle:iris]) (push) Has been cancelled
Nuttx Target with extra env config / build (px4_fmu-v5_default) (push) Has been cancelled
Python CI Checks / build (push) Has been cancelled
ROS Integration Tests / build (push) Has been cancelled
ROS Translation Node Tests / Build and test (map[ros_version:humble ubuntu:jammy]) (push) Has been cancelled
ROS Translation Node Tests / Build and test (map[ros_version:jazzy ubuntu:noble]) (push) Has been cancelled
SITL Tests / Testing PX4 tailsitter (push) Has been cancelled
SITL Tests / Testing PX4 iris (push) Has been cancelled
SITL Tests / Testing PX4 standard_vtol (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (address) (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (memory) (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (undefined) (push) Has been cancelled
New Crowdin translations - zh-CN
2025-07-07 09:04:54 +10:00

3.3 KiB
Raw Blame History

PX4 控制台/Shell

PX4 enables terminal access to the system through the MAVLink Shell and the System Console.

这里将说明它们的主要区别,以及如何使用。

System Console vs. Shells

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 Zubax BugFace BF1).

  • Used for low-level debugging/development: bootup, NuttX, startup scripts, board bringup, development on central parts of PX4 (e.g. uORB).
  • 更具体一点,这里是包括自启动的用户应用在内的整个PX4系统下所有启动过程唯一的输出位置。

Shell 提供对系统的上层访问能力:

  • 用于执行基础的模块调试运行命令。
  • Only directly display the output of modules you start.
  • Cannot directly display the output of tasks running on the work queue.
  • 在 PX4 系统无法启动时无助于调试(它并没有运行)。

:::info 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. :::

系统控制台(System Console在调试系统无法启动时十分必要,它会在飞控板上电后输出启动日志。 Since MAVLink provides more flexibility, currently only the MAVLink Shell is used.

The System Console is essential when the system does not boot (it displays the system boot log when power-cycling the board). The MAVLink Shell is much easier to setup, and so is more generally recommended for most debugging.

使用控制台/Shell

The MAVLink shell/console and the System Console are used in much the same way.

For example, type ls to view the local file system, free to see the remaining free RAM, dmesg to look at boot output.

nsh> ls
nsh> free
nsh> dmesg

Below are a couple of commands which can be used in the NuttShell to get insights of the system.

此 NSH 命令提供剩余的可用内存:

free

top命令显示每个应用成虚使用的堆栈情况:

top

注意堆栈使用量是通过堆栈着色计算的,并且是任务开始以来的最大值(不是当前使用量)。

要查看工作队列的运行抢空以及运行速度,使用:

work_queue status

调试 uORB 主题:

uorb top

检查特定的 uORB 主题:

listener <topic_name>

Many other system commands and modules are listed in the Modules and Command Reference (e.g. top, listener, etc.).

:::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 :::