joplin-mdbooks-website/content/ardupilot/ardupilot-setup-checklist.md

117 lines
7.7 KiB
Markdown
Raw Normal View History

2021-11-19 21:13:37 -05:00
# ArduPilot setup checklist
2021-01-07 16:49:18 -05:00
This is a short guide for setting up [ArduPilot](https://ardupilot.org/) on a flying wing. I use an Omnibus F4 that was previously set up for INAV (so motor on 1, elevons on 3/4), so most of this guide will be geared to that. If you use a different controller, your mileage may vary.
You should keep the [full list of ArduPilot parameters](https://ardupilot.org/plane/docs/parameters.html) open, for your reference while tuning.
2021-05-01 12:55:01 -04:00
2021-04-27 19:33:38 -04:00
## Helper utility
I have created a utility that lets you easily get/set/backup/restore parameters from the command line.
It's called Parachute, and you can download it here:
2021-05-01 12:55:01 -04:00
[https://gitlab.com/stavros/parachute](https://gitlab.com/stavros/parachute)
2021-01-07 16:49:18 -05:00
2021-02-23 16:30:56 -05:00
## Building ArduPilot
2021-12-14 19:41:34 -05:00
See [Building ArduPilot](/ardupilot/building-ardupilot.html) for instructions on how to build the latest version.
2021-02-23 16:30:56 -05:00
2021-01-07 16:49:18 -05:00
## Hardware setup
The values in this section are specific to the Omnibus F4, but the settings aren't, so you'll usually need to adjust your outputs to your specific configuration but you probably won't need to skip many of the steps here.
2021-03-03 19:24:46 -05:00
2021-10-30 17:17:05 -04:00
- [ ] Connect GPS to UART 6 (SERIAL4). You don't need to do anything else for GPS, it should work out of the box. If it doesn't, set `SERIALn_PROTOCOL=5`.
2021-05-15 18:16:21 -04:00
- [ ] Change the FC's orientation with `AHRS_ORIENTATION` and monitor the artificial horizon to see if it moves correctly.
2022-03-27 20:27:13 -04:00
- [ ] Make sure the artificial horizon is level when the plane is level on the ground. Use the "calibrate level" button or `AHRS_TRIM_Y` to correct it if it's not.
2021-05-15 18:16:21 -04:00
- [ ] Calibrate the accelerometer. "Forward" here needs to be the forward direction of the plane, not the arrow on the FC.
2021-01-08 12:49:20 -05:00
- [ ] Connect Fport to a UART. I chose UART 3 (SERIAL2). If you want to use UART 1, you should set the RC input jumper to PPM on the F4 to disconnect the SBUS inverter from the pin.
2021-01-07 16:49:18 -05:00
- [ ] To get Fport working with UART 3, you need to set `BRD_ALT_CONFIG=1`, to get UART 3 to act like a UART instead of I2C on the Omnibus F4.
- [ ] Set the following for Fport on UART 3:
2021-11-19 21:13:37 -05:00
```js
2021-10-30 16:49:10 -04:00
SERIAL2_PROTOCOL=23 # RCIN
2021-01-07 16:49:18 -05:00
SERIAL2_BAUD=115
2021-05-14 20:09:16 -04:00
SERIAL2_OPTIONS=4
2021-01-16 15:34:47 -05:00
RSSI_TYPE=3
2021-01-07 16:49:18 -05:00
```
2021-04-17 18:40:15 -04:00
- [ ] Once Fport works, reverse the elevator with `RC2_REVERSED=1`.
2021-01-07 16:49:18 -05:00
- [ ] Set up your servo functions and trims:
2021-11-19 21:13:37 -05:00
```js
2021-10-30 16:50:49 -04:00
SERVO1_FUNCTION=70 # Throttle
2021-01-07 16:49:18 -05:00
SERVO1_MIN=1000
SERVO1_MAX=2000
SERVO1_TRIM=1000
2021-10-30 16:50:49 -04:00
SERVO3_FUNCTION=77 # Left elevon
2021-01-07 16:49:18 -05:00
SERVO3_MIN=1000
SERVO3_MAX=2000
SERVO3_TRIM=1500
2021-10-30 16:50:49 -04:00
SERVO4_FUNCTION=78 # Right elevon
2021-01-07 16:49:18 -05:00
SERVO4_MIN=1000
SERVO4_MAX=2000
SERVO4_TRIM=1500
```
All these values are necessary, because usually the `SERVOn_TRIM` won't be at 1500.
2022-04-30 20:43:34 -04:00
- [ ] Switch to FBWA and validate that the control surfaces move correctly. If they don't, set `SERVOn_REVERSED=1`. It needs to be FBWA and not MANUAL because FBWA has some additional processing like PIDs, etc.
2021-01-07 16:49:18 -05:00
- [ ] Set `SERVO_BLH_OTYPE=4` for DShot150 and `SERVO_BLH_MASK=1` to enable it for the motor.
- [ ] Set `COMPASS_ENABLE=0` if you don't have a compass, otherwise calibrate it (not detailed here).
- [ ] Set `TERRAIN_ENABLE=0` to get rid of the terrain warning.
2021-04-27 19:33:38 -04:00
- [ ] Set the FC's pitch relative to the body with `AHRS_TRIM_Y` and check that FBWA mode flies level.
2022-07-21 09:07:13 -04:00
- [ ] If you don't use logging, set `LOG_BACKEND_TYPE=0`. If you *do* use logging, set `LOG_DISARMED=1 LOG_FILE_DSRMROT=0` to prevent the EKF from diverging and causing problems on takeoff.
2021-01-08 12:49:20 -05:00
- [ ] Check the preflight errors to warn on, though usually leaving it set to "all" is fine.
2021-01-07 17:02:38 -05:00
- [ ] Set up the OSD (Mission Planner has a very nice UI for that). Keep in mind that ArduPilot's airspeed and windspeed estimation are quite good, so you may want to add those even if you don't have an airspeed sensor. You may also want to set up multiple screens, I use a potentiometer to switch between the four different screens of the OSD:
2021-01-07 16:49:18 -05:00
- One with everything on (for debugging), which is also set as the `OSD_ARM_SCR`/`OSD_DSARM_SCR`.
- One with the artificial horizon, system messages and some basic info like RSSI, battery, ground speed and altitude.
- A minimal screen with just system messages and battery/RSSI/speed/altitude.
- A screen with just system messages, for when I want to enjoy the scenery.
2021-03-03 19:24:46 -05:00
2021-01-07 16:49:18 -05:00
## Radio-related
- [ ] Set your radio channels to AETR and run the radio calibration in the calibration section of ArduPilot.
2021-03-13 12:06:12 -05:00
- [ ] Add a killswitch to the radio that overrides the mode to manual and the throttle to 0.
This way it's really easy to kill the motor right away, but you still need to go through the arming procedure to get the motor running (thanks to Michel Pastor for this great idea).
2021-01-07 17:02:38 -05:00
- [ ] Set up modes, possibly having switches override the mode channel to the mode you want.
What I do is set a given channel as the mode channel, and make that channel always output -100% on the radio. Then, I set up channel overrides for each switch, keeping in mind that overrides in OpenTX are executed in order (so the bottom override has the highest priority).
2021-03-07 14:27:40 -05:00
That way, I set MANUAL/ACRO/FBWA to be lowest priority (on the same switch), then CRUISE to override those, then LOITER, RTL in that order. Finally, I add AUTO to a switch on its own channel.
Keep in mind that whatever mode you have on its own channel might be overridden if you flick a different switch.
2022-06-09 09:55:57 -04:00
2021-01-07 16:49:18 -05:00
## Auto modes
- [ ] Set `SERVO_AUTO_TRIM=1` so the aircraft trims itself while flying.
- [ ] Set `FS_SHORT_ACTN`/`FS_SHORT_TIMEOUT`/`FS_LONG_ACTN`/`FS_LONG_TIMEOUT`. I tend to disable the short action and set long to RTL.
2021-10-29 16:51:31 -04:00
- [ ] Set `FLIGHT_OPTIONS+=16` so the aircraft climbs first before starting to return to home.
2021-01-07 16:49:18 -05:00
- [ ] Change `AUTOTUNE_LEVEL` according to how aggressive you want the tune.
2021-01-07 20:03:07 -05:00
- [ ] Set `ACRO_PITCH_RATE`/`ACRO_ROLL_RATE` according to your craft.
2021-01-08 12:49:20 -05:00
- [ ] Set `THR_PASS_STAB=1` so you have total throttle control in ACRO/FBWA/STABILIZE.
2021-03-05 15:05:33 -05:00
- [ ] Set `ARSPD_FBW_MIN`/`ARSPD_FBW_MAX` to the minimum and maximum airspeed you want auto modes to fly (see the TECS tuning guide below for details).
2022-02-16 12:30:57 -05:00
- [ ] Set `MIN_GNDSPD_CM=833` (30 km/h) so the craft makes an effort to return even under high winds.
2021-01-07 20:03:07 -05:00
## Auto takeoff
- [ ] Change `TKOFF_THR_MAX` to the desired max takeoff throttle.
- [ ] Change `TKOFF_ALT` to the altitude you want takeoff to reach.
2021-01-16 15:34:47 -05:00
- [ ] Set `THR_SUPP_MAN=1` so you can manually set the autolaunch "idle" throttle (before the throw).
2021-01-07 20:37:34 -05:00
- [ ] Set `TKOFF_THR_MINACC=18` for the takeoff throw to activate takeoff with a minimum of 2g.
2021-04-27 19:33:38 -04:00
- [ ] Set `TKOFF_LVL_PITCH` to your desired angle (20 is a good value).
2021-01-07 20:37:34 -05:00
- [ ] Set `TKOFF_THR_DELAY` to the number of deciseconds that you want the motor to wait before it starts up.
2022-01-17 18:05:12 -05:00
- [ ] Set `FLIGHT_OPTIONS+=64` so the aircraft doesn't oscillate on auto takeoff without an airspeed sensor.
2021-04-27 19:33:38 -04:00
- [ ] Potentially set `TKOFF_THR_SLEW=-1` to make the throttle spin up faster.
2021-01-07 16:49:18 -05:00
2021-10-30 16:46:46 -04:00
## Recommended settings.
2021-12-14 19:41:34 -05:00
See the [recommended settings](/ardupilot/ardupilot-recommended-settings.html) page for other recommended defaults.
2021-01-07 16:49:18 -05:00
2021-03-03 19:24:46 -05:00
## In the field
2022-01-21 20:01:20 -05:00
- [ ] Run an [autotune](/ardupilot/miscellaneous-notes.html).
2021-04-27 19:33:38 -04:00
- [ ] Fly in FBWA and see if you're gaining/losing altitude. Pitch up/down to fly level, check the pitch on the OSD, and use the formula `old_value+pitch*π/180` to get the new value for `AHRS_TRIM_Y` (in radians).
2022-03-23 06:19:24 -04:00
- [ ] After you set `AHRS_TRIM_Y` correctly above, fly in FBWA at full throttle (or whatever throttle you feel is "full" enough, and note that value), and note the pitch you need so that the wing doesn't climb or sink. Then, set `KFF_THR2PTCH` with the formula `pitch_value_in_deg * 100 / throttle_percentage`. `pitch_value_in_deg` should be positive if you needed up pitch and negative if you needed down pitch.
2021-03-03 19:24:46 -05:00
2022-04-04 18:03:34 -04:00
_(Many thanks to Michel Pastor and mfoos for their help with everything in this note.)_
2021-01-07 16:49:18 -05:00
* * *
<p style="font-size:80%; font-style: italic">
2022-07-21 09:07:13 -04:00
Last updated on July 21, 2022. For any questions/feedback,
2021-01-07 16:49:18 -05:00
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
</p>