Modules Reference: Command


Source: systemcmds/bl_update

Utility to flash the bootloader from a file


bl_update [arguments...]
   setopt        Set option bits to unlock the FLASH (only needed if in locked

   <file>        Bootloader bin file


Source: systemcmds/config

Configure a sensor driver (sampling & publication rate, range, etc.)


config <command> [arguments...]

 The <file:dev> argument is typically one of /dev/{gyro,accel,mag}i
   block         Block sensor topic publication
     <file:dev>  Sensor device file

   unblock       Unblock sensor topic publication
     <file:dev>  Sensor device file

   sampling      Set sensor sampling rate
     <file:dev> <rate> Sensor device file and sampling rate in Hz

   rate          Set sensor publication rate
     <file:dev> <rate> Sensor device file and publication rate in Hz

   range         Set sensor measurement range
     <file:dev> <rate> Sensor device file and range

   check         Perform sensor self-test (and print info)
     <file:dev>  Sensor device file


Source: systemcmds/dumpfile

Dump file utility. Prints file size and contents in binary mode (don't replace LF with CR LF) to stdout.


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


Source: systemcmds/esc_calib

Tool for ESC calibration

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

  • Remove props, power off the ESC's
  • Stop attitude controllers: mc_att_control stop, fw_att_control stop
  • Make sure safety is off
  • Run this command


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


Source: systemcmds/hardfault_log

Hardfault utility

Used in startup scripts to handle hardfaults


hardfault_log <command> [arguments...]
   check         Check if there's an uncommited hardfault

   rearm         Drop an uncommited hardfault

   fault         Generate a hardfault (this command crashes the system :)
     [0|1]       Hardfault type: 0=divide by 0, 1=Assertion (default=0)

   commit        Write uncommited hardfault to /fs/microsd/fault_%i.txt (and
                 rearm, but don't reset)

   count         Read the reboot counter, counts the number of reboots of an
                 uncommited hardfault (returned as the exit code of the program)

   reset         Reset the reboot counter


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.


Blink the first LED 5 times in blue:

led_control blink -c blue -l 0 -n 5


led_control <command> [arguments...]
   test          Run a test pattern

   on            Turn LED on

   off           Turn LED off

   reset         Reset LED priority

   blink         Blink LED N times
     [-n <val>]  Number of blinks
                 default: 3
     [-s <val>]  Set blinking speed
                 values: fast|normal|slow, default: normal

   breathe       Continuously fade LED in & out

 The following arguments apply to all of the above commands except for 'test':
     [-c <val>]  color
                 values: red|blue|green|yellow|purple|amber|cyan|white, default:
     [-l <val>]  Which LED to control: 0, 1, 2, ... (default=all)
                 default: -1
     [-p <val>]  Priority
                 default: 2


Source: systemcmds/topic_listener

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

Limitation: it can only listen to the first instance of a topic.


listener [arguments...]
     <topic_name> [<num_msgs>] uORB topic name and optionally number of messages


Source: systemcmds/mixer


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.


mixer <command> [arguments...]
     <file:dev> <file> Output device (eg. /dev/pwm_output0) and mixer file

     <file:dev> <file> Output device (eg. /dev/pwm_output0) and mixer file


Source: systemcmds/motor_ramp


Application to test motor ramp up.

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

mc_att_control stop
fw_att_control stop

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

Note: this command currently only supports the /dev/pwm_output0 output.


motor_ramp sine 1100 0.5


motor_ramp [arguments...]
     ramp|sine|square mode
     <min_pwm> <time> [<max_pwm>] pwm value in us, time in sec

 WARNING: motors will ramp up to full speed!


Source: systemcmds/motor_test

Utility to test motors.

Note: this can only be used for drivers which support the motor_test uorb topic (currently uavcan and tap_esc)


motor_test <command> [arguments...]
   test          Set motor(s) to a specific output value
     [-m <val>]  Motor to test (0...7, all if not specified)
                 default: -1
     [-p <val>]  Power (0...100)
                 default: 0

   stop          Stop all motors

   iterate       Iterate all motors starting and stopping one after the other


Source: systemcmds/mtd

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


mtd <command> [arguments...]
   status        Print status information

   start         Mount partitions

   readtest      Perform read test

   rwtest        Perform read-write test

   erase         Erase partition(s)

 The commands 'start', 'readtest', 'rwtest' and 'erase' have an optional
     [<partition_name1> [<partition_name2> ...]] Partition names (eg.
                 /fs/mtd_params), use system default if not provided


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.


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


Source: systemcmds/param


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).

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.


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

param set SYS_AUTOSTART 4001
param set SYS_AUTOCONFIG 1


param <command> [arguments...]
   load          Load params from a file (overwrite all)
     [<file>]    File name (use default if not given)

   import        Import params from a file
     [<file>]    File name (use default if not given)

   save          Save params to a file
     [<file>]    File name (use default if not given)

   select        Select default file
     [<file>]    File name (use <root>/eeprom/parameters if not given)

   show          Show parameter values
     [-c]        Show only changed params
     [<filter>]  Filter by param name (wildcard at end allowed, eg. sys_*)

   set           Set parameter to a value
     <param_name> <value> Parameter name and value to set
     [fail]      If provided, let the command fail if param is not found

   compare       Compare a param with a value. Command will succeed if equal
     <param_name> <value> Parameter name and value to compare

   greater       Compare a param with a value. Command will succeed if param is
                 greater than the value
     <param_name> <value> Parameter name and value to compare

   reset         Reset params to default
     [<exclude1> [<exclude2>]] Do not reset matching params (wildcard at end

   reset_nostart Reset params to default, but keep SYS_AUTOSTART and
     [<exclude1> [<exclude2>]] Do not reset matching params (wildcard at end

   index         Show param for a given index
     <index>     Index: an integer >= 0

   index_used    Show used param for a given index
     <index>     Index: an integer >= 0

   find          Show index of a param
     <param>     param name


Source: systemcmds/perf

Tool to print performance counters


perf [arguments...]
   reset         Reset all counters

   latency       Print HRT timer latency histogram

 Prints all performance counters if no arguments given


Source: systemcmds/pwm


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].


Set the PWM rate for all channels to 400 Hz:

pwm rate -a -r 400

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

pwm arm
pwm test -c 13 -p 1200


pwm <command> [arguments...]
   arm           Arm output

   disarm        Disarm output

   info          Print current configuration of all channels

   forcefail     Force Failsafe mode
     on|off      Turn on or off

   terminatefail Force Termination Failsafe mode
     on|off      Turn on or off

   rate          Configure PWM rates
     -r <val>    PWM Rate in Hz (0 = Oneshot, otherwise 50 to 400Hz)

   oneshot       Configure Oneshot125 (rate is set to 0)

   failsafe      Set Failsafe PWM value

   disarmed      Set Disarmed PWM value

   min           Set Minimum PWM value

   max           Set Maximum PWM value

   test          Set Output to a specific value until 'q' or 'c' or 'ctrl-c'

   steps         Run 5 steps from 0 to 100%

 The commands 'failsafe', 'disarmed', 'min', 'max' and 'test' require a PWM
     -p <val>    PWM value (eg. 1100)

 The commands 'rate', 'oneshot', 'failsafe', 'disarmed', 'min', 'max', 'test'
 and 'steps' additionally require to specify the channels with one of the
 following commands:
     [-c <val>]  select channels in the form: 1234 (1 digit per channel,
     [-m <val>]  Select channels via bitmask (eg. 0xF, 3)
                 default: 0
     [-g <val>]  Select channels by group (eg. 0, 1, 2. use 'pwm info' to show
                 default: 0
     [-a]        Select all channels

 These parameters apply to all commands:
     [-d <val>]  Select PWM output device
                 values: <file:dev>, default: /dev/pwm_output0
     [-v]        Verbose output
     [-e]        Exit with 1 instead of 0 on error


Source: systemcmds/reboot

Reboot the system


reboot [arguments...]
     [-b]        Reboot into bootloader


Source: systemcmds/sd_bench

Test the speed of an SD Card


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


Source: systemcmds/top

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


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


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.


usb_connected [arguments...]


Source: systemcmds/ver

Tool to print various version information


ver <command> [arguments...]
   hw            Hardware architecture

   mcu           MCU info

   git           git version information

   bdate         Build date and time

   gcc           Compiler info

   bdate         Build date and time

   uid           UUID

   mfguid        Manufacturer UUID

   uri           Build URI

   all           Print all versions

   hwcmp         Compare hardware version (returns 0 on match)
     <hw>        Hardware to compare against (eg. PX4FMU_V4)

results matching ""

    No results matching ""