Using the Command Line Interface¶
The CLI is being phased out on all platforms. The features were massively cut down with AC3.1.5 and then it was removed for the APM2 completely anyway with AC3.2. All CLI functions are now available via regular MAVLink commands in the GCSs. This article has been moved to the dev wiki and may be considered deprecated.
MOVE ALL THE CLI INFO TO THIS PAGE
ALSO Mission Planer Terminal
The Command Line Interface (CLI) is an alternative to the Configurator. It does most of what the Configurator does, but in a text interface. One reason to use this is that you may not be able to run the Configurator (if you’re running Linux, for example, or a Mac without a Windows emulator). You may also prefer it because it’s fast and clean. (There are also a few commands that are only available in the CLI).
The way the CLI is used is by sliding the slider switch on the IMU board towards the servo connectors.
Don’t forget to return it to the other position before you fly!
Now open the Arduino serial monitor, setting baud rate to 115200 baud and ensuring that “Carriage Returns” are enabled. You should see a command line on the monitor:
Commands that are supported from current CLI are:
a - Activate/Deactivate compass
Every second ‘a’ activates / deactivates your compass usage inside program. You also need to check that #define IsMAG is selected inside program
c - Compass offset calibration
Roll/Pitch/Move/Rock/Twist your quad on every direction, even upside down until offset numbers are not changing. After values are as desired hit ‘Enter’ to save values and to exit back to main menu
e - ESC Max Throttle calibration
Official Copter ESCs (and few others too, you can test) supports automatic max/min throttle calibrations.
SAFETY! Disconnect your propellers first!
Activate this calibration
Disconnect your battery but keep USB cable connected
Move your throttle stick to “full”
Connect your battery and listen normal ESC beepboop.. reboot sounds
After ESCs send Beep Beep sound, move your throttle to minimum
Listen final beep sound from ESCs
Give small throttle to your APM:Copter to see that all motors spins same speed
If they do not spin, redo calibration
Hit ‘Enter’ to disarm all motors and to exit from ESC Calibration
If you are not using the official APM:Copter ESCs, you can manually calibrate them one by one by connecting each ESC to your RC receiver’s channel 3 output. Unplug your battery, move transmitter throttle stick to full, and reconnect the battery. Wait for the beeps to stop, then bring the throttle stick down to the minimum again. Repeat for all four ESCs.
i - Initialize and calibrate Accel offsets
Place your APM:Copter on level surface and reset its 0-Level with this command. It takes some seconds until samples will be collected. During calibration do not touch/move or in any other ways make your APM:Copter to move.
m - Motor tester with AIL/ELE stick
Users can easily test that their ESC/Motors are connected correctly. Move your AIL/ELE stick to up/down/left/right and corresponding motor should start pulsing slowly. Correct motor rotation directions are shown here.
SAFETY! Disconnect propellers before doing your test.
If your motors does not follow your stick input eg. stick to full right and left motors starts, change ESC cable on your Power Distributor PCB or in APM connectors depending where you have connected your ESCs.
r - Reset Factory settings
With every new revision you need to reset our EEPROM (just in case).
t - Calibrate MIN Throttle value
Read minimum throttle value from your radio. Place throttle at minimum and activate this test, Min throttle value is needed for all altitude hold features and general motor operations.
s - Show settings
Printout most important settings to your serial port.
To use the CLI normally to prepare your quad for flight, you need to go through a small number of steps.
Upload the code with the mission planner or Arduino.
In the terminal screen, hit “Enter” three times at startup if you’re not automatically given the CLI entry prompt.
There are three menus in the CLI and you can type “help” at any time to see the available menus or commands. Typing “setup” will get you into the setup menu.
erase: When installing ACM for the first time, run this to erase bad values from EEPROM – just in case!
reset: Performs factory reset and initialization of EEPROM values
radio: Records the limits of ALL radio channels - very important!!!
motors: Interactive setup of your ESC and motors. Enter this mode, then plug-in battery, move your RC transmitter’s pitch/roll sticks in each direction to make the prop in that direction spin (so moving the stick up will make the front rotor spin on a quad, and moving it right will make the right rotor spin). For copters with more than four motors, it will spin groups of motors, with the one closest to the direction of the stick going fastest.
level: Sets initial value of accelerometers - hold copter level
modes: Sets the flight modes assigned to each switch position (you have 5 available). Use your aileron/roll stick on your RC transmitter to scroll through the options. Full right moves forward through the list; full left moves back. Hit enter to save your settings and exit this mode.
frame: Sets your frame config: (x, +, v (Octo))
current: Enables an AttoPilot current sensor: (on, off, milliamp hours)
sonar: Enable sonar sensor. Sensor hooks to the “pitot” port which is an analog input (on, off). See installation details here.
compass: Enables the compass (on, off)
declination: Sets your local declination value – lookup online for accuracy (decimal degrees)
show: A formatted output of all the settings
“test” menu commands:¶
pwm: Outputs the pwm values of all 8 radio channels
radio: Outputs the control values of all 8 radio channels in degrees x 100 or other value (see radio.pde)
failsafe: (Not currently used)
stabilize: Lets you test the stabilization with debugging output to the terminal (may spin the props – not recommended for flying).
gps: Outputs GPS data. Note: typically you must be outside to get GPS lock. It can take two minutes or more to achieve lock at first power on.
adc: Outputs raw adc values
imu: Outputs euler angles
battery: Outputs voltage readings to analog in 0-3
tune: (Not currently used)
current: Outputs voltage and current from an AttoPilot current sensor. Motors will spin, so disconnect your four-wire cable or take off your props!
relay: Toggles the relay
waypoints: Dumps stored waypoint commands
altitude: Displays output from onboard barometric pressure sensor
sonar: Displays output from sonar sensor (if attached and enabled)
compass: Outputs compass angles in degrees (0 = north)
xbee: Outputs an XBEE sequence used for range testing
eedump: Raw output of bytes in EEPROM
rawgps: Outputs raw, unparsed GPS data
mission: Writes a default mission to EEPROM (null, ‘wp’). Choosing ‘wp’ option will send the copter 15 meters North and back again.