Skip to content

Autopilot Tuning, Firmware

Ajay Shankar edited this page Mar 14, 2022 · 3 revisions

Freyja can be used with several different autopilot boards, as long as the vehicle flies stable, and the autopilot has an interface that accepts [roll, pitch, yaw(rate), thrust] commands. Freyja has been tested with Ascending Technologies autopilots (Hummingbird, Firefly), and with Pixhawk boards running ArduCopter flight stack.

The following instructions are written for ArduCopter; adapt these to your specific vehicle/autopilot. Ensure that the vehicle flies well following the next steps.

Necessary

  1. Install correct firmware.

    • Freyja typically works with a customized ArduPilot firmware. The source files are maintained here. See the README-nimbus file to get the pre-built binaries for common boards. Install this custom firmware. It removes no features from the official firmware, but adds a custom flight mode: "Computer" COMP_CTRL. Configure your RC to switch in and out of this mode. If MP/QGC doesn't show this as a drop-down option, search for the corresponding FLT_MODE_N parameter, and set it to the number 25. This is the enumeration for this custom mode.

      When updating the firmware, the parameters are retained as such - so if the vehicle flew well before, it should fly well after.

    • New versions of ArduPilot (4.1+) now be directly used without customisation. The suitable mode now is Guided_NoGPS. For this to work, you must also set ThrustAsThrust field within the parameter G2_OPTIONS.

    • Other autopilot stacks can also work if they provide an interface for Freyja's output. For example, PX4's OFFBOARD mode should work almost similar (although untested), especially if using mavros.

  2. Change flight response (careful!).
    Freyja requires the vehicle response to commands to be very "crisp". If the vehicle response to pilot roll/pitch commands is too soft (or damped), the implicit "no-lag" assumption made by classical formulations is violated. Tune the vehicle to be very responsive to user stick commands. Then, in MP/QGC, search for a parameter called atc_input_tc and set it to between [0.06 .. 0.1] (0.1 is the safer end). Note that some input filtering is desirable to attenuate high-frequency command responses. Changing this to less than 0.05 can make the vehicle very difficult to fly.

  3. Adjust communication rates.
    Pipe Freyja's commands preferably to the Telem2 port (also known as serial2). If using a wireless telemetry radio (or Xbee), edit the following two sets of params:

    • serial : change baudrate. Usually 57600 is a good compromise.
    • sr2 : change all publish rates to zeros, except for EXTRA3 (battery info, system state) which can be set to 1Hz.

    These steps are essential !! Free up the radio channel for Freyja's transmission of control signals.

    Wired connections should use higher baudrate (can go more than 115200).

  4. Suppress unused mavros plugins.
    The default mavros plugins enabled/disabled by Freyja are usually ok. Please check the pluginlists.yaml file to add more whitelisted plugins. Note that some plugins attempt to use communication channel, so don't spawn them needlessly.

Recommended Checks

  • Ensure battery failsafes are in place. For 3-cell LiPo, low battery is usually at 10.6V; for 4-cell, set it to 13.9V.
  • Make sure to calibrate your compass and accelerometers. Consider using vibration-damping mounts for the autopilot board.

Frustrated?

  • If your vehicle refuses to arm, verify that you don't have unnecessary (unsatisfiable) arming checks enabled.
    • Additionally, some older boards might have an EK3_GPS check enabled; disable that if indoors.
  • Check that the firmware uses EK3_* parameters (and not EK2_*).

Still frustrated?

Sip coffee, raise an issue on GitHub! :)