PX4系统命令行控制台 Consoles & Shells 常用命令
- 查看每个应用程序的堆栈使用情况
- 获取所有可用命令和APP的列表
- 应用程序启动、停止和状态查询
- 查看本地文件系统
- 查看剩余的可用RAM
- 查看工作队列中正在运行的内容以及运行速率
- 查看特定的uORB话题
- 调试uORB话题
- 进行模式切换和故障保护行为的状态机
- I2C总线扫描
- Dshot协议电调驱动程序
NUTTX官网 NuttShell (NSH)
查看每个应用程序的堆栈使用情况
堆栈使用率是使用堆栈着色计算的,并且是自任务开始以来的最大值(而不是当前使用率)。
top
获取所有可用命令和APP的列表
help
应用程序启动、停止和状态查询
<app_name> start
<app_name> stop
<app_name> status
查看本地文件系统
ls
查看剩余的可用RAM
free
查看工作队列中正在运行的内容以及运行速率
work_queue status
查看特定的uORB话题
列出所有话题。
To list all topics, list the file handles:
ls /obj
/obj:actuator_armed0actuator_controls_00actuator_controls_30......vehicle_status_flags0vehicle_thrust_setpoint0vehicle_torque_setpoint0
To listen to the content of one topic for 5 messages, run the listener:
listener <topic_name>listener sensor_accel 5
The output is n-times the content of the topic:
TOPIC: sensor_accel #3
timestamp: 84978861
integral_dt: 4044
error_count: 0
x: -1
y: 2
z: 100
x_integral: -0
y_integral: 0
z_integral: 0
temperature: 46
range_m_s2: 78
scaling: 0TOPIC: sensor_accel #4
timestamp: 85010833
integral_dt: 3980
error_count: 0
x: -1
y: 2
z: 100
x_integral: -0
y_integral: 0
z_integral: 0
temperature: 46
range_m_s2: 78
scaling: 0
调试uORB话题
The command uorb top shows the publishing frequency of each topic in real-time:
uorb top
update: 1s, num topics: 77
TOPIC NAME INST #SUB #MSG #LOST #QSIZE
actuator_armed 0 6 4 0 1
actuator_controls_0 0 7 242 1044 1
battery_status 0 6 500 2694 1
commander_state 0 1 98 89 1
control_state 0 4 242 433 1
ekf2_innovations 0 1 242 223 1
ekf2_timestamps 0 1 242 23 1
estimator_status 0 3 242 488 1
mc_att_ctrl_status 0 0 242 0 1
sensor_accel 0 1 242 0 1
sensor_accel 1 1 249 43 1
sensor_baro 0 1 42 0 1
sensor_combined 0 6 242 636 1
The columns are: topic name, multi-instance index, number of subscribers, publishing frequency in Hz, number of lost messages per second (for all subscribers combined), and queue size.
进行模式切换和故障保护行为的状态机
commander <command>
I2C总线扫描
i2cdetect -b <i2c bus number>i2cdetect -b 1
它会打印出总线上扫描到的设备地址。
Scanning I2C bus: 10 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 -- -- -- -- -- -- -- -- --
Dshot协议电调驱动程序
永久反转1号电机,保存后,反转的方向将被视为正常方向。
如果要再次反转,请重复相同的命令。
dshot reverse -m 1
dshot save -m 1
如果不指定电机序号,则是反转所有电机。
dshot reverse
dshot save
参考资料:
Using Consoles/Shells
NUTTX官网 NuttShell (NSH)
Modules & Commands Reference