Rotorflight 2 CLI Changes - rotorflight/rotorflight GitHub Wiki
Rotorflight Wiki is replaced by www.rotorflight.org.
This page lists the changes in the CLI in RF2.
Should be the same as in RF1.
All hardware related CLI commands (dump hardware) should work.
Currently there are no changes to feature flags.
The servo configuration has been refactored, and has slightly different parameters.
The CLI servo
command has now the following syntax:
servo <center> <min> <max> <neg-scale> <pos-scale> <update-rate> <flags>
<center> zero position in us (servo arm level position)
<min> minimum pulse length (for avoiding binding)
<max> maximum pulse length (for avoiding binding)
<neg-scale> scaling factor on negative side (below center level)
<pos-scale> scaling factor on positive side (above center level)
<update-rate> PWM update rate in Hz
<flags> flags (binary values)
The servo flags has the following binary values:
1 Servo reverse
2 Geometry correction
Servo geometry correction for correcting the rotational geometry. It is not needed with linear servos.
This is a correction factor for any systematic scaling error on the Dshot RPM reading. The value of 0 is no correction, 1000 is +1.000% correction, -2000 is -2.000%, etc.
There is a separate value for each motor.
The CLI commands are the same, but the range (PWM) resolution has been increased from 25 to 5us.
Adjustment functions have been totally rewritten.
There are now two new ranges in each adjustment, for setting the Rx ranges where the increment/decrement step is triggered, respectively.
With the continuous adjustment, the first range sets the input range of the control channel.
In RF1, the decrement range was 1000..1300, and the increment range was 1700..2000. The continuous input range was 1000..2000.
The CLI command format is:
adjfunc <index> <func> <enable channel> <start> <end>
<value channel> <dec start> <dec end> <inc start> <inc end>
<step size> <value min> <value max>
If <enable channel>
is within <start>..<end>
then the adjustment is enabled.
Then two choices depending on the value in <step size>
-
Continuous adjustment if
<step size>
is zero. The channel<value channel>
is used to directly control the selected adjustment. The range in<dec start>..<dec end>
is stretched into<value min>..<value max>
. The range<inc start>..<inc end>
is not used. -
Stepped adjustment if
<step size>
is non-zero. The channel<value channel>
is used to decide whether the adjustment should be incremented or decremented. If the channel is within<dec start>..<dec end>
then the adjustment is decremented by<step>
. If the channel is within<inc start>..<inc end>
then the adjustment is incremented by<step>
. While keeping the adjustment value in the range<value min>..<value max>
.
This allows one channel to inc/dec at least 8 different adjustment functions.
Functions numbers (as in 4.3.0-20230912):
// Profile change
ADJUSTMENT_RATE_PROFILE = 1,
ADJUSTMENT_PID_PROFILE = 2,
ADJUSTMENT_LED_PROFILE = 3,
ADJUSTMENT_OSD_PROFILE = 4,
// Rates
ADJUSTMENT_PITCH_RATE = 5,
ADJUSTMENT_ROLL_RATE = 6,
ADJUSTMENT_YAW_RATE = 7,
ADJUSTMENT_PITCH_RC_RATE = 8,
ADJUSTMENT_ROLL_RC_RATE = 9,
ADJUSTMENT_YAW_RC_RATE = 10,
ADJUSTMENT_PITCH_RC_EXPO = 11,
ADJUSTMENT_ROLL_RC_EXPO = 12,
ADJUSTMENT_YAW_RC_EXPO = 13,
// PID
ADJUSTMENT_PITCH_P_GAIN = 14,
ADJUSTMENT_PITCH_I_GAIN = 15,
ADJUSTMENT_PITCH_D_GAIN = 16,
ADJUSTMENT_PITCH_F_GAIN = 17,
ADJUSTMENT_ROLL_P_GAIN = 18,
ADJUSTMENT_ROLL_I_GAIN = 19,
ADJUSTMENT_ROLL_D_GAIN = 20,
ADJUSTMENT_ROLL_F_GAIN = 21,
ADJUSTMENT_YAW_P_GAIN = 22,
ADJUSTMENT_YAW_I_GAIN = 23,
ADJUSTMENT_YAW_D_GAIN = 24,
ADJUSTMENT_YAW_F_GAIN = 25,
ADJUSTMENT_YAW_CW_GAIN = 26,
ADJUSTMENT_YAW_CCW_GAIN = 27,
ADJUSTMENT_YAW_CYCLIC_FF = 28,
ADJUSTMENT_YAW_COLLECTIVE_FF = 29,
ADJUSTMENT_YAW_COLLECTIVE_DYN = 30,
ADJUSTMENT_YAW_COLLECTIVE_DECAY = 31,
ADJUSTMENT_PITCH_COLLECTIVE_FF = 32,
// Gyro cutoffs
ADJUSTMENT_PITCH_GYRO_CUTOFF = 33,
ADJUSTMENT_ROLL_GYRO_CUTOFF = 34,
ADJUSTMENT_YAW_GYRO_CUTOFF = 35,
// Dterm cutoffs
ADJUSTMENT_PITCH_DTERM_CUTOFF = 36,
ADJUSTMENT_ROLL_DTERM_CUTOFF = 37,
ADJUSTMENT_YAW_DTERM_CUTOFF = 38,
// Rescue
ADJUSTMENT_RESCUE_CLIMB_COLLECTIVE = 39,
ADJUSTMENT_RESCUE_HOVER_COLLECTIVE = 40,
ADJUSTMENT_RESCUE_HOVER_ALTITUDE = 41,
ADJUSTMENT_RESCUE_ALT_P_GAIN = 42,
ADJUSTMENT_RESCUE_ALT_I_GAIN = 43,
ADJUSTMENT_RESCUE_ALT_D_GAIN = 44,
// Leveling
ADJUSTMENT_ANGLE_LEVEL_GAIN = 45,
ADJUSTMENT_HORIZON_LEVEL_GAIN = 46,
ADJUSTMENT_ACRO_TRAINER_GAIN = 47,
// Governor
ADJUSTMENT_GOV_GAIN = 48,
ADJUSTMENT_GOV_P_GAIN = 49,
ADJUSTMENT_GOV_I_GAIN = 50,
ADJUSTMENT_GOV_D_GAIN = 51,
ADJUSTMENT_GOV_F_GAIN = 52,
ADJUSTMENT_GOV_TTA_GAIN = 53,
ADJUSTMENT_GOV_CYCLIC_FF = 54,
ADJUSTMENT_GOV_COLLECTIVE_FF = 55,
// Boost gains
ADJUSTMENT_PITCH_B_GAIN = 56,
ADJUSTMENT_ROLL_B_GAIN = 57,
ADJUSTMENT_YAW_B_GAIN = 58,
// Offset gains
ADJUSTMENT_PITCH_O_GAIN = 59,
ADJUSTMENT_ROLL_O_GAIN = 60,
// Cross-coupling
ADJUSTMENT_CROSS_COUPLING_GAIN = 61,
ADJUSTMENT_CROSS_COUPLING_RATIO = 62,
ADJUSTMENT_CROSS_COUPLING_CUTOFF = 63,
Most gyro filtering related CLI commands have been renamed in BF4.3. There are further changes in Rotorflight.
It is now possible to run the filtering task at a different speed from the PID loop. This is needed if the PID loop is running at a low speed (1Khz or lower).
There is a new parameter filter_process_denom
that works the same as pid_process_denom
.
A special value 0 indicates that the filter task is running at the PID loop speed.
Other values are relative to the gyro speed.
The filter task can't be slower than the PID task. Usually there are 2 or 3 valid values for this parameter, typically 1..4.
CLI commands listed below.
set gyro_decimation_hz = 250
set gyro_lpf1_type = FIRST_ORDER
set gyro_lpf1_static_hz = 125
set gyro_lpf1_dyn_min_hz = 25
set gyro_lpf1_dyn_max_hz = 150
set gyro_lpf2_type = NONE
set gyro_lpf2_static_hz = 0
set gyro_notch1_hz = 0
set gyro_notch1_cutoff = 0
set gyro_notch2_hz = 0
set gyro_notch2_cutoff = 0
Blackbox has been refactored in BF4.3, and further in RF2.
OFF = No logging
NORMAL = logging when both ARMED and BLACKBOX switch active
ARMED = logging when ARMED
SWITCH = logging when BLACKBOX switch active
In NORMAL mode, logging is paused if BLACKBOX switch is inactive.
Blackbox sampling is now locked to the PID loop, and can be reduced by a factor of N.
Each blackbox field can be now separately enabled/disabled.
set blackbox_log_command = ON
set blackbox_log_setpoint = ON
set blackbox_log_mixer = ON
set blackbox_log_pid = ON
set blackbox_log_gyro_raw = ON
set blackbox_log_gyro = ON
set blackbox_log_acc = ON
set blackbox_log_mag = OFF
set blackbox_log_alt = ON
set blackbox_log_battery = ON
set blackbox_log_rssi = ON
set blackbox_log_rpm = ON
set blackbox_log_motors = ON
set blackbox_log_servos = ON
set blackbox_log_gps = OFF
Debug has now eight 32bit values, instead of four 16bit values.
This will require changes in the Blackbox Explorer eventually.
Some debug modes are logging only one axis, which is selected
with the debug_axis
parameter.
This parameter replaces the following BF parameters:
- gyro_filter_debug_axis
- acro_trainer_debug_axis
- rc_smoothing_debug_axis
New settings for sensor update speed:
set vbat_update_hz = 100
set ibat_update_hz = 100
set esc_sensor_update_hz = 100
PID control has been totally rewritten.
There are now multiple PID controllers to choose from.
This is a test mode with the FF term only. Useful for debugging the firmware.
Rotorflight-1.0 compatibility mode. This is exactly the same as RF1. Parameters have different names, unfortunately.
New PID mode under development. This is the current idea what RF2 could be.
Test PID mode with a ridiculous number of parameters. Used for testing High-Speed Integral.
Selects between D-term on gyro signal vs. on error signal for cyclic.
Available in mode 2.
Selects between D-term on gyro signal vs. on error signal for yaw.
Available in mode 2.
The PID gain parameters have been renamed. Should be obvious.
Stop gain for yaw. Works differently in each mode.
Mode 1: Same as RF1.0. Both P and D gains multiplied by stop gain.
Mode 2: Only P gain multiplied by stop gain.
Mode 3: Only P gain multiplied by stop gain.
There are a few extra filters in the PID controller (for evaluation).
D-term bandwidth limit, separate for each axis.
Available in modes 2 and 3. Equivalent to RF1 D-term PT1 filter. Must be set to a reasonable value for D-term to work. Typical values 10..40.
Error term bandwidth limit. 0 = disabled.
Available in mode 1.
Gyro signal bandwidth limit, separate for each axis. 0 = disabled. This is an extra First Order filter for each gyro axis.
Available in modes 1, 2 and 3.
Selects the I-term relax type, i.e. which axis to apply to.
Sets the setpoint limit/level for I-term relax. This is fixed to 40 in BF and RF1.
I-term relax filter cutoffs for roll, pitch, and yaw.
The rates system has been rewritten for RF2.0.
There is now a curve also for collective. It is mostly useful for setting the collective min/max, but also expo.
In addition to the rate curves, it is now possible to set limits, acceleration, and smoothness.
Set waw setpoint max acceleration.
Set absolute maximum for yaw setpoint. The curve will usually control what to value is at the stick extreme, so this is an extra limit.
Set overall smoothness for setpoint changes. This is equivalent to "Style" or "Smoothness" in some FBLs. Higher is smoother. Typical values 25-200.
Set a ring limiter for cyclic setpoints. Range 0 = no limit ... 100 = round circle
A new parameter for yaw-to-throttle precompensation. This is only for main motor driven tails. For motorised tails, this parameter must be set to zero.
A time constant for throttle rampup during start. This is applied only until the motor has started up and the RPM signal is detected.
An offset value for calibrating the zero current with Hobbywing V4 ESCs.
Voltage gain - different for each HW V4 model.
*
* Voltage Gain:
* 3-6S (LV): gain = 110
* 3-8S (LVv2): gain = 154
* 5-12s (HV): gain = 210
*
Current gain - different for each HW V4 model.
*
* Current Gain:
* 60A: gain = 60
* 80A: gain = 78
* 100A: gain = 90
* 120A: gain = 100
* 130A: gain = 113
* 150A: gain = 129
* 160A: gain = 137
* 200A: gain = 169
*
Rescue mode. Climb or Altitude Hold.
Altitude Hold requires a good quality barometer.
Enable flipping the heli upright, if rescue started inverted.
Gain for initial pull up and for flipping the heli upright.
Gain for leveling the heli.
This is 2.5x less effective vs. RF1, e.g. you had 40, now you need 100.
Time for the initial pull-up. (1/10s steps)
Time for climbing. (1/10s steps)
Time(out) for flipping. (1/10s steps) If flip did not complete withint this time, climb state is entered regardless.
Time for slowly exiting rescue. (1/10s steps)
Collective value for pull-up. (1/1000 steps)
Maximum cyclic rate for any rescue action.
Maximum cyclic acceleration for any rescue action.
Collective value for climb.
Collective value for hover.
Hovering altitude in cm.
Altitude P-gain.
Altitude I-gain.
Altitude D-gain.