Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: pointed cloning instructions at next instead of cliffs private branch

...

Currently you must be able to compile LibrePilot software / firmware yourself to be able to use this.  The pre-release source code can be found at: https://bitbucket.org/TheOtherClifflibrepilot/librepilot/branch/theothercliff/LP-76_Port_Autotune_from_dRoninnext

Before you uninstall or overwrite your old software / firmware you should run the old GCS, plug the FC (flight controller) into USB, and do a "File → Export UAV Settings" to save your old settings in case you want to know how it was set up.  You should also do screen captures (print screen) on all the setup pages you have used (and thus have non-default values).  These could be valuable later on.

Cloning Instructions (tested on Linux):
It is assumed that you have a working development environment:
git  clone  https://bitbucket.org/TheOtherClifflibrepilot/librepilot.git  autotune
cd  autotune
git  checkout  theothercliff/LP-76_Port_Autotune_from_dRonin
git  checkout   theothercliff/LP-340_AutoTune_fix_some_time_measurement_issues_in_original_code
cd  librepilot
git  checkout  next
make  build_sdk_install   (I avoid this by sym linking my global downloads and tools directories into this directory, so whatever you need to do for downloads and tools)
nice  -n15  make  -j4  gcs  revolution  revonano       sparky2   (the 4 is however many real CPU cores you have to keep all of them busy, it still works even if it is wrong)  (gcs might take 30 minutes to build)  (or remove 'nice -n15' which says to run it at low priority in case you want to do something else with the computer while it is making the software)
./build/librepilot-gcs_release/bin/librepilot-gcs   (runs the GCS that you just built) (in Linux that is ./b <tab> l (lower case L) <tab> b <tab> <tab>)

The instructions above are written with several spaces between each word for clarity.  They work just as well with only one space.

Updating an old clone (tested on Linux):
This The old branch has recently been rebased onto next and uploaded with push -f.  That means you will have problems if you originally started from the version before the rebase.  One easy way around that is to delete the old directory and clone again, but that means you will re-download the whole thing again.  Another way (assumes origin is https://bitbucket.org/TheOtherCliff/librepilot.git) is to:
git  merge  --abort
git  checkout  origin/next
git  branch  -D  theothercliff/LP-340_AutoTune_fix_some_time_measurement_issues_in_original_code
git  fetch  origin
git  checkout  -t  origin/theothercliff/LP-340_AutoTune_fix_some_time_measurement_issues_in_original_code
make  all_clean

make  build_sdk_install   (I avoid this by sym linking my global downloads and tools directories into this directory, so whatever you need to do for downloads and tools)
nice  -n15  make  -j4  gcs  revolution  revonano   (the 4 is however many real CPU cores you have to keep all of them busy, it still works even if it is wrong)  (gcs might take 30 minutes to build)  (or remove 'nice -n15' which says to run it at low priority in case you want to do something else with the computer while it is making the software)
./build/librepilot-gcs_release/bin/librepilot-gcs   (runs the GCS that you just built) (in Linux that is ./b <tab> l (lower case L) <tab> b <tab> <tab>)
The instructions above are written with two spaces between each word for clarity.  They work just as well with only one spacefrom the version before the rebase.  AutoTune has been merged into next, so the best way now is to delete the old directory and clone "next".
With GCS running and firmware built, go to the Firmware page, press Halt.  Wait about 15 seconds for the Flash button to appear.  Also, it should automatically select firmware that matches your flight controller.  Press Flash.  You will also have to erase settings and run the setup wizard again.  With that complete, you need to do your calibrations before anything else.

Flight Mode Switch setup:
Note that when AutoTune is complete, it writes the calculated PIDs into the destination stabilization (PID) bank which by default is configured to be bank 2.  The standard procedure has you flying the AutoTune mode on bank 1 and writing the new PIDs to bank 3 (default destination PID bank was changed from 2 to 3).

...

The recommended setup for running AutoTune uses a 3 position FMS (Flight Mode Switch).  With this, you can take off and fly Attitude mode with known working PIDs, run AutoTune with known working PIDs and fly Attitude mode with new PIDs, all without using the GCS:
Pos#1 - Attitude mode using bank 1
Pos#2 - AutoTune using bank 1 with SystemIdentSettings.DestinationPidBank set to 3 (that is the default)
Pos#3 - Attitude mode using bank 3 (bank 3 is where the tuned PIDs are written by default)
PID bank 1 should have default PIDs or something that is at least known to fly without oscillations.
PID bank 3 should have default PIDs or something that is at least known to fly without oscillations in case you use it before successfully completing a tune.
This setup can all be done at home, and everything else can be done at the flying field, without using the GCS.
With this FMS setup, you always have Pos#1 to fall back on.  Use Pos#1 to recover from any bad situation or to start over and run AutoTune again.

An alternate FMS setup for a 2 position FMS removes the ability to fly with default PIDs once you have run AutoTune:
Pos#1 - Attitude mode using bank 3 (bank 3 is where the tuned PIDs are written by default)
Pos#2 - AutoTune using bank 1 with SystemIdentSettings.DestinationPidBank set to 3 (that is the default)
PID bank 1 should have default PIDs or something that is at least known to fly without oscillations.
PID bank 3 should have default PIDs or something that is at least known to fly without oscillations.
PID bank 3 starts out with the same PIDs as bank 1, but the PIDs will be changed by AutoTune.
It is possible to arm in Pos#1, then switch to Pos#2 and immediately take off before the AutoTune shaking starts (two seconds), if your tuned PIDs don't work and you want to retune.

Remove anything that is expensive or fragile (e.g. cameras and antennas, but understand that transmitters must remain unpowered any time they don't have an antenna attached) from the multicopter if this is your first experience with AutoTune on this multicopter.  Be aware though, that you eventually need to tune in "flight trim".  Things like cameras and FPV gear that even moderately noticeably affect the total weight of the copter should be mounted to get a the best tune good tune.

Arm and take off in Pos#1 which is Attitude mode with default (or other known-good) PIDs.  These PIDs must not oscillate for the tuning to work.  Switch to Pos#2 which is AutoTune mode which is also configured to use default (or other known-good) PIDs.  After a few seconds the copter begins to shake (and may tend to climb).  Fly it smoothly.  Don't let the copter touch anything (such as the ground) while tuning is running.  60 seconds after switching into AutoTune, the shaking stops and the tuning is complete.  The PIDs have already been written to the destination PID bank, but are only stored in RAM memory at this point.  The standard procedure is to land and disarm which writes the PIDs to permanent storage.  (The PIDs will be written to permanent settings if you disarm before powering off.  The PIDs will be discarded if the copter is powered off without disarming it.)  Note that you can disarm while in AutoTune mode, but you cannot arm while in AutoTune mode.

Switch to Pos#3 (Pos#1 for the 2 position FMS) which now holds the tuned PIDs.  Cautiously take off, and be ready to immediately cut power to zero if there is any problem.  You are now flying tuned PIDs.  If for some reason you want to run AutoTune again, just switch to Pos#2 as before.

...