Skip to content

Position controller gains and parameters (so3_control)

Alex Z edited this page Apr 18, 2022 · 7 revisions

Our position controller requires two parameters to be configured:

  • Thrust/RPM and RPM/Throttle coefficients
  • PID gains

Propeller coefficients

To obtain these coefficients, you will need to perform a thrust test with the propeller and motor combination you will be using on your platform. You can use a thrust stand such as the Tyto Robotics Series 1520 for these tests, in which you fit a 2nd order polynomial to the Thrust vs RPM data and a line to the RPM vs Throttle data. Note that the RPM is a function of the input voltage as well, and the voltage at which you perform your thrust test will have an effect on the flight characteristics as your battery voltage deviates from it. In this case, to keep things simple you can simply run your thrust tests at the nominal voltage of your battery pack (3.7V/cell for LiPo batteries, but may depend on the chemistry). To compensate for the the variable input voltage however, you can make additional measurements at fixed throttle values while varying your input voltage, obtaining a scaling function for the RPM using the feedback voltage.

Finally, you will need to update the following propeller parameters in SO3_command_to_mavros.launch (here)

(1) Thrust vs RPM parameters, according to the following equation: Thrust = a * RPM^2 + b * RPM + c (thrust is in Newtons not grams-force)

<arg name="thrust_vs_rpm_coeff_a" default="8.401e-7"/>
<arg name="thrust_vs_rpm_coeff_b" default="-1.400e-3"/>
<arg name="thrust_vs_rpm_coeff_c" default="1.12"/>

(2) RPM vs Throttle parameters, according to the following equation: RPM = a * Throttle + b

<arg name="rpm_vs_throttle_coeff_a" default="6000"/>
<arg name="rpm_vs_throttle_coeff_b" default="0"/>

PID Control Gains

used gains:
  pos: {x: 7.4, y: 7.4, z: 10.4}   # position gains
  vel: {x: 4.8, y: 4.8, z: 6.0}    # velocity gains
  ki:  {x: 0.00, y: 0.00, z: 0.00} # position error integral gains

unused gains:
  kib: {x: 0.00, y: 0.00, z: 0.00} # body-frame position error integral gains, NOT used in so3_control control calculation
  rot: {x: 1.5, y: 1.5, z: 1.0}    # rotation gains, only used in so3_trpy_control, NOT used in so3_control
  ang: {x: 0.13, y: 0.13, z: 0.1}  # angular velocity gains, only used in so3_trpy_control, NOT used in so3_control

unused corrections: # corrections are only used in so3_trpy_control, NOT used in so3_control
  kf: 0.0e-08
  r: 0.0
  p: 0.0

max_pos_int:   0.5 #  position error integral term limit, if ki=0, this term is not important
max_pos_int_b: 0.5 # body-frame position error integral term limit, NOT used in actual control calculation