!REDIRECT “https://docs.px4.io/master/ko/middleware/modules_command.html

모듈 참고서: 명령어

bl_update

Source: systemcmds/bl_update

Utility to flash the bootloader from a file

Usage

  1. bl_update [arguments...]
  2. setopt Set option bits to unlock the FLASH (only needed if in locked
  3. state)
  4. <file> Bootloader bin file

dumpfile

Source: systemcmds/dumpfile

덤프 파일 유틸리티. 파일 크기와 내용을 표준 출력(터미널 창)에 바이너리 모드(LF를 CR LF로 바꾸지 않음)로 출력합니다.

Usage

  1. dumpfile [arguments...]
  2. <file> File to dump

dyn

Source: systemcmds/dyn

설명

PX4 바이너리로 컴파일하지 않은 동적 PX4 모듈을 불러오고 실행합니다.

예시

  1. dyn ./hello.px4mod start

Usage

  1. dyn [arguments...]
  2. <file> File containing the module
  3. [arguments...] Arguments to the module

esc_calib

Source: systemcmds/esc_calib

Tool for ESC calibration

Calibration procedure (running the command will guide you through it):

  • 전동 변속기의 프로펠러를 제거하고 전원을 끄십시오
  • 고도, 속도 컨트롤러의 동작을 중단하십시오: mc_rate_control stop, fw_att_control stop
  • safety가 off인지 확인하십시오
  • 이 명령어를 실행하십시오

Usage

  1. esc_calib [arguments...]
  2. [-d <val>] Select PWM output device
  3. values: <file:dev>, default: /dev/pwm_output0
  4. [-l <val>] Low PWM value in us
  5. default: 1000
  6. [-h <val>] High PWM value in us
  7. default: 2000
  8. [-c <val>] select channels in the form: 1234 (1 digit per channel,
  9. 1=first)
  10. [-m <val>] Select channels via bitmask (eg. 0xF, 3)
  11. [-a] Select all channels

failure

Source: systemcmds/failure

Description

Inject failures into system.

Implementation

This system command sends a vehicle command over uORB to trigger failure.

Examples

Test the GPS failsafe by stopping GPS:

failure gps off

Usage

  1. failure [arguments...]
  2. help Show this help text
  3. gps|... Specify component
  4. ok|off|... Specify failure type
  5. [-i <val>] sensor instance (0=all)
  6. default: 0

gpio

Source: systemcmds/gpio

This command is used to read and write GPIOs.

Usage

  1. gpio [arguments...]
  2. read
  3. <PORT> <PIN> GPIO port and pin
  4. [PULLDOWN|PULLUP] Pulldown/Pullup
  5. [--force] Force (ignore board gpio list)
  6. write
  7. <PORT> <PIN> GPIO port and pin
  8. <VALUE> Value to write
  9. [PULLDOWN|PULLUP] Pulldown/Pullup
  10. [--force] Force (ignore board gpio list)

hardfault_log

Source: systemcmds/hardfault_log

Hardfault utility

Used in startup scripts to handle hardfaults

Usage

  1. hardfault_log <command> [arguments...]
  2. Commands:
  3. check Check if there's an uncommited hardfault
  4. rearm Drop an uncommited hardfault
  5. fault Generate a hardfault (this command crashes the system :)
  6. [0|1] Hardfault type: 0=divide by 0, 1=Assertion (default=0)
  7. commit Write uncommited hardfault to /fs/microsd/fault_%i.txt (and
  8. rearm, but don't reset)
  9. count Read the reboot counter, counts the number of reboots of an
  10. uncommited hardfault (returned as the exit code of the program)
  11. reset Reset the reboot counter

i2cdetect

Source: systemcmds/i2cdetect

Utility to scan for I2C devices on a particular bus.

Usage

  1. i2cdetect [arguments...]
  2. [-b <val>] I2C bus
  3. default: 1

led_control

Source: systemcmds/led_control

설명

Command-line tool to control & test the (external) LED’s.

To use it make sure there’s a driver running, which handles the led_control uorb topic.

There are different priorities, such that for example one module can set a color with low priority, and another module can blink N times with high priority, and the LED’s automatically return to the lower priority state after the blinking. The reset command can also be used to return to a lower priority.

Examples

Blink the first LED 5 times in blue:

  1. led_control blink -c blue -l 0 -n 5

Usage

  1. led_control <command> [arguments...]
  2. Commands:
  3. test Run a test pattern
  4. on Turn LED on
  5. off Turn LED off
  6. reset Reset LED priority
  7. blink Blink LED N times
  8. [-n <val>] Number of blinks
  9. default: 3
  10. [-s <val>] Set blinking speed
  11. values: fast|normal|slow, default: normal
  12. breathe Continuously fade LED in & out
  13. flash Two fast blinks and then off with frequency of 1Hz
  14. The following arguments apply to all of the above commands except for 'test':
  15. [-c <val>] color
  16. values: red|blue|green|yellow|purple|amber|cyan|white, default:
  17. white
  18. [-l <val>] Which LED to control: 0, 1, 2, ... (default=all)
  19. [-p <val>] Priority
  20. default: 2

listener

Source: systemcmds/topic_listener

Utility to listen on uORB topics and print the data to the console.

The listener can be exited any time by pressing Ctrl+C, Esc, or Q.

Usage

  1. listener <command> [arguments...]
  2. Commands:
  3. <topic_name> uORB topic name
  4. [-i <val>] Topic instance
  5. default: 0
  6. [-n <val>] Number of messages
  7. default: 1
  8. [-r <val>] Subscription rate (unlimited if 0)
  9. default: 0

mfd

Source: systemcmds/mft

Utility interact with the manifest

Usage

  1. mfd <command> [arguments...]
  2. Commands:
  3. query Returns true if not existed

mixer

Source: systemcmds/mixer

Description

Load or append mixer files to the ESC driver.

Note that the driver must support the used ioctl’s, which is the case on NuttX, but for example not on RPi.

Usage

  1. mixer <command> [arguments...]
  2. Commands:
  3. load
  4. <file:dev> <file> Output device (eg. /dev/pwm_output0) and mixer file
  5. append
  6. <file:dev> <file> Output device (eg. /dev/pwm_output0) and mixer file

motor_ramp

Source: systemcmds/motor_ramp

Description

Application to test motor ramp up.

Before starting, make sure to stop any running attitude controller:

  1. mc_rate_control stop
  2. fw_att_control stop

When starting, a background task is started, runs for several seconds (as specified), then exits.

Example

  1. motor_ramp sine -a 1100 -r 0.5

Usage

  1. motor_ramp [arguments...]
  2. ramp|sine|square mode
  3. [-d <val>] Pwm output device
  4. default: /dev/pwm_output0
  5. -a <val> Select minimum pwm duty cycle in usec
  6. [-b <val>] Select maximum pwm duty cycle in usec
  7. default: 2000
  8. [-r <val>] Select motor ramp duration in sec
  9. default: 1.0
  10. WARNING: motors will ramp up to full speed!

motor_test

Source: systemcmds/motor_test

Utility to test motors.

WARNING: remove all props before using this command.

Usage

  1. motor_test <command> [arguments...]
  2. Commands:
  3. test Set motor(s) to a specific output value
  4. [-m <val>] Motor to test (1...8, all if not specified)
  5. [-p <val>] Power (0...100)
  6. default: 0
  7. [-t <val>] Timeout in seconds (default=no timeout)
  8. default: 0
  9. [-i <val>] driver instance
  10. default: 0
  11. stop Stop all motors
  12. iterate Iterate all motors starting and stopping one after the other

mtd

Source: systemcmds/mtd

Utility to mount and test partitions (based on FRAM/EEPROM storage as defined by the board)

Usage

  1. mtd <command> [arguments...]
  2. Commands:
  3. status Print status information
  4. readtest Perform read test
  5. rwtest Perform read-write test
  6. erase Erase partition(s)
  7. The commands 'readtest' and 'rwtest' have an optional instance index:
  8. [-i <val>] storage index (if the board has multiple storages)
  9. default: 0
  10. The commands 'readtest', 'rwtest' and 'erase' have an optional parameter:
  11. [<partition_name1> [<partition_name2> ...]] Partition names (eg.
  12. /fs/mtd_params), use system default if not provided

nshterm

Source: systemcmds/nshterm

Start an NSH shell on a given port.

This was previously used to start a shell on the USB serial port. Now there runs mavlink, and it is possible to use a shell over mavlink.

Usage

  1. nshterm [arguments...]
  2. <file:dev> Device on which to start the shell (eg. /dev/ttyACM0)

param

Source: systemcmds/param

Description

Command to access and manipulate parameters via shell or script.

This is used for example in the startup script to set airframe-specific parameters.

Parameters are automatically saved when changed, eg. with param set. They are typically stored to FRAM or to the SD card. param select can be used to change the storage location for subsequent saves (this will need to be (re-)configured on every boot).

If the FLASH-based backend is enabled (which is done at compile time, e.g. for the Intel Aero or Omnibus), param select has no effect and the default is always the FLASH backend. However param save/load <file> can still be used to write to/read from files.

Each parameter has a ‘used’ flag, which is set when it’s read during boot. It is used to only show relevant parameters to a ground control station.

Examples

Change the airframe and make sure the airframe’s default parameters are loaded:

  1. param set SYS_AUTOSTART 4001
  2. param set SYS_AUTOCONFIG 1
  3. reboot

Usage

  1. param <command> [arguments...]
  2. Commands:
  3. load Load params from a file (overwrite all)
  4. [<file>] File name (use default if not given)
  5. import Import params from a file
  6. [<file>] File name (use default if not given)
  7. save Save params to a file
  8. [<file>] File name (use default if not given)
  9. select Select default file
  10. [<file>] File name (use <root>/eeprom/parameters if not given)
  11. show Show parameter values
  12. [-a] Show all parameters (not just used)
  13. [-c] Show only changed params (unused too)
  14. [-q] quiet mode, print only param value (name needs to be exact)
  15. [<filter>] Filter by param name (wildcard at end allowed, eg. sys_*)
  16. show-for-airframe Show changed params for airframe config
  17. status Print status of parameter system
  18. set Set parameter to a value
  19. <param_name> <value> Parameter name and value to set
  20. [fail] If provided, let the command fail if param is not found
  21. compare Compare a param with a value. Command will succeed if equal
  22. [-s] If provided, silent errors if parameter doesn't exists
  23. <param_name> <value> Parameter name and value to compare
  24. greater Compare a param with a value. Command will succeed if param is
  25. greater than the value
  26. [-s] If provided, silent errors if parameter doesn't exists
  27. <param_name> <value> Parameter name and value to compare
  28. <param_name> <value> Parameter name and value to compare
  29. touch Mark a parameter as used
  30. [<param_name1> [<param_name2>]] Parameter name (one or more)
  31. reset Reset only specified params to default
  32. [<param1> [<param2>]] Parameter names to reset (wildcard at end allowed)
  33. reset_all Reset all params to default
  34. [<exclude1> [<exclude2>]] Do not reset matching params (wildcard at end
  35. allowed)
  36. index Show param for a given index
  37. <index> Index: an integer >= 0
  38. index_used Show used param for a given index
  39. <index> Index: an integer >= 0
  40. find Show index of a param
  41. <param> param name

perf

Source: systemcmds/perf

Tool to print performance counters

Usage

  1. perf [arguments...]
  2. reset Reset all counters
  3. latency Print HRT timer latency histogram
  4. Prints all performance counters if no arguments given

pwm

Source: systemcmds/pwm

Description

This command is used to configure PWM outputs for servo and ESC control.

The default device /dev/pwm_output0 are the Main channels, AUX channels are on /dev/pwm_output1 (-d parameter).

It is used in the startup script to make sure the PWM parameters (PWM_*) are applied (or the ones provided by the airframe config if specified). pwm info shows the current settings (the trim value is an offset and configured with PWM_MAIN_TRIMx and PWM_AUX_TRIMx).

The disarmed value should be set such that the motors don’t spin (it’s also used for the kill switch), at the minimum value they should spin.

Channels are assigned to a group. Due to hardware limitations, the update rate can only be set per group. Use pwm info to display the groups. If the -c argument is used, all channels of any included group must be included.

The parameters -p and -r can be set to a parameter instead of specifying an integer: use -p p:PWM_MIN for example.

Note that in OneShot mode, the PWM range [1000, 2000] is automatically mapped to [125, 250].

Examples

Set the PWM rate for all channels to 400 Hz:

  1. pwm rate -a -r 400

Test the outputs of eg. channels 1 and 3, and set the PWM value to 1200 us:

  1. pwm arm
  2. pwm test -c 13 -p 1200

Usage

  1. pwm <command> [arguments...]
  2. Commands:
  3. arm Arm output
  4. disarm Disarm output
  5. info Print current configuration of all channels
  6. forcefail Force Failsafe mode. PWM outputs are set to failsafe values.
  7. on|off Turn on or off
  8. terminatefail Enable Termination Failsafe mode. While this is true, any
  9. failsafe that occurs will be unrecoverable (even if recovery
  10. conditions are met).
  11. on|off Turn on or off
  12. rate Configure PWM rates
  13. -r <val> PWM Rate in Hz (0 = Oneshot, otherwise 50 to 400Hz)
  14. oneshot Configure Oneshot125 (rate is set to 0)
  15. failsafe Set Failsafe PWM value
  16. disarmed Set Disarmed PWM value
  17. min Set Minimum PWM value
  18. max Set Maximum PWM value
  19. test Set Output to a specific value until 'q' or 'c' or 'ctrl-c'
  20. pressed
  21. steps Run 5 steps from 0 to 100%
  22. The commands 'failsafe', 'disarmed', 'min', 'max' and 'test' require a PWM
  23. value:
  24. -p <val> PWM value (eg. 1100)
  25. The commands 'rate', 'oneshot', 'failsafe', 'disarmed', 'min', 'max', 'test'
  26. and 'steps' additionally require to specify the channels with one of the
  27. following commands:
  28. [-c <val>] select channels in the form: 1234 (1 digit per channel,
  29. 1=first)
  30. [-m <val>] Select channels via bitmask (eg. 0xF, 3)
  31. [-g <val>] Select channels by group (eg. 0, 1, 2. use 'pwm info' to show
  32. groups)
  33. [-a] Select all channels
  34. These parameters apply to all commands:
  35. [-d <val>] Select PWM output device
  36. values: <file:dev>, default: /dev/pwm_output0
  37. [-v] Verbose output
  38. [-e] Exit with 1 instead of 0 on error

reboot

Source: systemcmds/reboot

Reboot the system

Usage

  1. reboot [arguments...]
  2. [-b] Reboot into bootloader
  3. [lock|unlock] Take/release the shutdown lock (for testing)

sd_bench

Source: systemcmds/sd_bench

Test the speed of an SD Card

Usage

  1. sd_bench [arguments...]
  2. [-b <val>] Block size for each read/write
  3. default: 4096
  4. [-r <val>] Number of runs
  5. default: 5
  6. [-d <val>] Duration of a run in ms
  7. default: 2000
  8. [-s] Call fsync after each block (default=at end of each run)

system_time

Source: systemcmds/system_time

Description

Command-line tool to set and get system time.

Examples

Set the system time and read it back

  1. system_time set 1600775044
  2. system_time get

Usage

  1. system_time <command> [arguments...]
  2. Commands:
  3. set Set the system time, provide time in unix epoch time format
  4. get Get the system time

top

Source: systemcmds/top

Monitor running processes and their CPU, stack usage, priority and state

Usage

  1. top [arguments...]
  2. once print load only once

usb_connected

Source: systemcmds/usb_connected

Utility to check if USB is connected. Was previously used in startup scripts. A return value of 0 means USB is connected, 1 otherwise.

Usage

  1. usb_connected [arguments...]

ver

Source: systemcmds/ver

Tool to print various version information

Usage

  1. ver <command> [arguments...]
  2. Commands:
  3. hw Hardware architecture
  4. mcu MCU info
  5. git git version information
  6. bdate Build date and time
  7. gcc Compiler info
  8. bdate Build date and time
  9. px4guid PX4 GUID
  10. uri Build URI
  11. all Print all versions
  12. hwcmp Compare hardware version (returns 0 on match)
  13. <hw> [<hw2>] Hardware to compare against (eg. PX4_FMU_V4). An OR comparison
  14. is used if multiple are specified
  15. hwtypecmp Compare hardware type (returns 0 on match)
  16. <hwtype> [<hwtype2>] Hardware type to compare against (eg. V2). An OR
  17. comparison is used if multiple are specified