BYOAQ-BAT IX: Testing and tuning

If you haven’t already, please read the previous BYOAQ-BAT articles first – just search for the BYOAQ-BAT tag.

Only one very simple test is required before HoG takes to the air.  With your quad on the ground, and motors and HoG powered up, simply type

sudo python ./ --tc 1 -h 200

Each blade props should spin in turn in the order of front left, front right, back left and back right.  The front left and back right props should spin anti- / counter-clockwise, the front right and back left props clockwise.  If the props don’t spin, increase -h slowly (in tens) until they do.  If any of the props spin the wrong way, swap any pair of the three wires driving the ESC.  If each props is rotating in the right direction, check that each prop is producing a down-draft, not an up-draft.  If there’s an up-draft, then swap the props.

For PID tuning, I’m not going into the details of how to do it from scratch, but here are some guidelines of how you can take my PID gains and tweak them to fit your quad.

First, only the inner PIDs which control stability need proper tuning specific to your quad.  The are the pitch, roll and yaw rate PIDs.  The rest are almost certainly fine for any quad.

In the code, look in CheckCLI at the various i_am_phoebe, i_am_chloe, i_am_zoe and i_am_hog settings:

  • cli_hover_target is not strictly necessary – it’s just used to slowly spin up the motors to roughly hover speed before takeoff.  I general have it set to 500 for 12″ props, 550 for 11″ props and 600 for 10″ props.  This value is the size of the PWM pulse width from the HoG to ESCs in microseconds
  • cli_pr*_gain, cli_rr*_gain and cli_yr*_gain vary with length of arms and power of motors, and the weight distribution of the quad.  The ratio of 2:1:0 for P:I:D seems to work well.  Phoebe has short arms and small props, Zoe had larger props, and HoG has long arms and large props – compare the setting for each to see the effect.  In addition, all my batteries face front to back, so it takes more power to pitch rather than roll, hence the difference between cli_pr*_gains and cli_rr*_gains.
  • finally, cli_vv*_gains are for vertical acceleration, but if you compare Phoebe to Zoe and HoG, you’ll see the setting is inconsistent.  Because of gravity, the only real tuning required is “enough” power; hence small props have larger PID values.

Leave a Reply

Your email address will not be published. Required fields are marked *