smfelton

Re: Port Tau Labs Autotune to LP
« Reply #60 on: June 28, 2016, 12:06:49 am »
Tried to compile and after about 5 minutes I get this :

/Users/smfelton/code/librepilot/flight/modules/AutoTune/autotune.c:602: undefined reference to `gyroReadTime'
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/smfelton/code/librepilot/build/firmware/fw_discoveryf4bare/fw_discoveryf4bare.elf] Error 1
make: *** [fw_discoveryf4bare_opfw] Error 2

ny ideas ?

Shane

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Port Tau Labs Autotune to LP
« Reply #61 on: June 28, 2016, 12:20:15 am »
you don't need the discoveryf4bare firmware.

Just compile the needed firmware, followed with Gcs build and start

Code: [Select]
make -j2 opfw_resource && make -j2 gcs && ./build/librepilot-gcs_release/bin/librepilot-gcs

Tomcatt

  • *
  • 23
Re: Port Tau Labs Autotune to LP
« Reply #62 on: June 28, 2016, 02:26:39 am »
i am using Windows Msys2. It works fine. Basic procedure description is given in https://librepilot.atlassian.net/wiki/display/LPDOC/Windows+Building+and+Packaging .

In "Get the code using Msys2" section instead of "ssh:" use "https:"
I mean:  "git clone https://[email protected]/TheOtherCliff/librepilot.git ". You can add the name for new directory at the end after space.
then "cd ... " to your directory
then  "git checkout  theothercliff/LP-340_AutoTune_fix_some_time_measurement_issues_in_original_code"
After that you can either choose to build specific part (although I am not that much experienced in it, so I just usually ask to make the whole package exactly as it is written in the manual. It takes longer (on my i5 laptop about 1 hour) but i will have all firmware, installation file and ready to run software (be aware, it is additional 1.8 Gb on disk).h

Your welcome.

It's better for me to use the "git clone" way.  I'm not up to speed with all the git usage but I know enough to get around.  I'm downloading it now for OS X.

smfelton

Re: Port Tau Labs Autotune to LP
« Reply #63 on: June 28, 2016, 02:39:31 am »
you don't need the discoveryf4bare firmware.

Just compile the needed firmware, followed with Gcs build and start

Code: [Select]
make -j2 opfw_resource && make -j2 gcs && ./build/librepilot-gcs_release/bin/librepilot-gcs

Brilliant thank you again. Now I can sleep !!  :)

smfelton

Re: Port Tau Labs Autotune to LP
« Reply #64 on: June 28, 2016, 03:41:46 pm »
Ok new day, new start. All compile fine now thank you so much. Only problem is there is no 'Autotune' button on the config tab. If I search in 'System' there is an optional module in HWsettings which I can enable but i'm guessing this is only a setting for the FC as it doesn't change anything in the gui.
Really sorry to be sounding like such a noob.
Shane

chromvis

  • *
  • 117
Re: Port Tau Labs Autotune to LP
« Reply #65 on: June 28, 2016, 04:07:38 pm »
There should be no button. Autotune is a flight mode. Read carefully the whole section in https://librepilot.atlassian.net/wiki/display/LPDOC/AutoTune.

smfelton

Re: Port Tau Labs Autotune to LP
« Reply #66 on: June 28, 2016, 04:53:04 pm »
Oh right ok, I must be getting confused with the Taulabs videos, as they have an 'Autotune' button under the TxPID button on the Configuration tab.
Just one thing, if there is no button where is the "SmoothQuick" mentioned in that document as I can't find it ?
Thanks for your help.
« Last Edit: June 28, 2016, 04:56:46 pm by smfelton »

Mateusz

  • *
  • 808
Re: Port Tau Labs Autotune to LP
« Reply #67 on: June 28, 2016, 05:08:30 pm »
Its not yet exposed in GUI , but you can enable it via UAV objectsbrowser, same place you enable Autotune. All your settings are there also from any other module, those are XML objects that firmware accepts. 

smfelton

Re: Port Tau Labs Autotune to LP
« Reply #68 on: June 28, 2016, 05:40:17 pm »
Ok thank you all very much.

chromvis

  • *
  • 117
Re: Port Tau Labs Autotune to LP
« Reply #69 on: June 28, 2016, 06:22:52 pm »
I did not quite get what Mateusz mean: "enable it via UAV objectsbrowser, same place you enable Autotune".
I did it by assigning in System>Settings>SystemIndentSettings>SmoothQuickSettings to 11 (which is Accessory 1) and associating Accessory 1 to input channel 6, which was assigned to rear right slider on my RadioLonk TX. These settings could be modified to your personal preference.
I myself did not quite get yet wht will happen if I copy Bank 2 (with tuning results) into Bank 1. I am not sure if SmoothQuick will be working on Bank 1.

Re: Port Tau Labs Autotune to LP
« Reply #70 on: June 29, 2016, 06:42:10 pm »
Thanks for the feedback!

On 200 (not OneShot) quad autotune process was smooth. Although copter is not very agile even at SmoothQuick Accessory at 100% (I set it to Accessory 1 slider). There are very minimal difference in the copter reaction between 0 and 100% slider position.

Minimal PID (smooth)     Roll      Pitch      Yaw
      P          0.00052      0.00098   0.00148
      I          0.00058      0.00110   0.00134
      D          0.000045   0.000085   0.000102
Max (agile)            Roll      Pitch      Yaw
      P         0.00185      0.00350   0.0042
      I         0.00408      0.00773   0.00661
      D         0.000080   0.000151   0.000168
The PIDs are more than tripled between smooth and quick.  You should have been able to feel a difference.
I would recheck my Flight Mode Switch setup to make sure that my post tune test was using bank 2.  :)
Also, make sure that both your PID bank 2 roll rates are as high as you want.  Stock is slow and maybe you forgot to increase roll rates in bank 2.  :)
Not OneShot...  What protocol (and speed if PWM) are you using?  Slow ESCs (or increasing GyroTau) will produce a slow responding tune.

Tuning of the second copter was not successful at all. With big battery (4000 mAh, 770g) it run through half of tuning process and start falling. I had to jerk throttle up to keep it flying. After two or three jerks it fall. Restart at default settings (Bank 1) was OK, it flew smooth.
With 2200 mAh batt. 700 g same copter went through autotune a bit longer but did not finish, just fell.
I have to do some more tests, I am not sure that it is autotune fault, it may be calibration or setup, or ESCs – this copter gave me headaches before too.
- In my experience, "falling" is usually caused by a bad motor wire or connector.  Randomly the vibration will make the connection be open some times and then it falls because it can't stabilize, because the disabled motor goes to 100% and the other motors go to zero.
- Were any of the motors or ESCs too hot afterward?
- Also I once had a similar problem that seems to be because I was running props that were too large.  I assumed it would be OK if I was just hovering but it wasn't OK.
- Also, do you use a battery voltage alarm?  Be aware that autotune uses a lot of power.  If you don't use a voltage alarm it may be that the battery voltage dropped so low that the ESC's reset.

Third (380) copter with Sparky 2 flight controller went through autotune without any problems. Right after original assembly, it was its maiden flight (with Sparky 2).
Results were the most impressive. Big difference between smooth and agile modes. Very fast reaction without jerks and noticeable overshoots (even in most agile form). Very good feeling to fly it.
Thanks.  Good to hear.

Re: Port Tau Labs Autotune to LP
« Reply #71 on: June 29, 2016, 06:58:21 pm »
AutoTune has not been merged into next yet,
You can search the wiki for autotune.  It shows you where to get the source code, etc.

I found some parts of the original timing measurement that the original code did not take into account and I put it into:
    ssh://[email protected]/TheOtherCliff/librepilot.git
    theothercliff/LP-340_AutoTune_fix_some_time_measurement_issues_in_original_code

It would help if you could build this and see if it works better for both your quads.

Thanks!

I'm not very familiar with bitbucket, how do I change to this repository, i'm building 'next' on my hackintosh without any issues but I must admit trying to get to this is baffling me.
Thank you
Shane

Probably the easiest way is to clone it into a new directory.

There are command line git instructions for cloning in the AutoTune wiki article:
https://librepilot.atlassian.net/wiki/display/LPDOC/AutoTune

Or you can go to this page and press the clone button to get the SSH cloning command.
https://bitbucket.org/TheOtherCliff

Edit: I see that F5soh has posted another way to do this into your current development directory.  That works too.

Re: Port Tau Labs Autotune to LP
« Reply #72 on: June 29, 2016, 07:06:14 pm »
Just one thing, if there is no button where is the "SmoothQuick" mentioned in that document as I can't find it ?
Thanks for your help.

The default is to use the flight mode switch toggle method.  This is enabled if you use defaults.  Read about it in the wiki if you want to use the FMS toggle method.

Re: Port Tau Labs Autotune to LP
« Reply #73 on: June 29, 2016, 07:20:26 pm »
I did not quite get what Mateusz mean: "enable it via UAV objectsbrowser, same place you enable Autotune".
I did it by assigning in System>Settings>SystemIndentSettings>SmoothQuickSettings to 11 (which is Accessory 1) and associating Accessory 1 to input channel 6, which was assigned to rear right slider on my RadioLonk TX. These settings could be modified to your personal preference.
I myself did not quite get yet wht will happen if I copy Bank 2 (with tuning results) into Bank 1. I am not sure if SmoothQuick will be working on Bank 1.

You two were saying the same thing.  UAVO browser is GCS -> System.  :)

When you set up the Flight Mode Switch to have AutoTune on it, you can tell it which PID bank to fly with while you are tuning.

AutoTune stores its math results (not PIDs) in System>Settings>SystemIndentSettings
Storing the math results is done after a successful running of AutoTune
AutoTune uses its stored math results when it outputs PID settings into the desired PID bank
Outputting PID settings into the desired PID bank is done after a successful running of AutoTune, but also at other times, like when you move the SmoothQuick knob.
AutoTune knows which PID bank to write by looking in System>Settings>SystemIndentSettings>DestinationPidBank
System>Settings>SystemIndentSettings>DestinationPidBank is set to 2 by default

Re: Port Tau Labs Autotune to LP
« Reply #74 on: June 29, 2016, 07:43:08 pm »
Only problem is there is no 'Autotune' button on the config tab. If I search in 'System' there is an optional module in HWsettings which I can enable but i'm guessing this is only a setting for the FC as it doesn't change anything in the gui.
Really sorry to be sounding like such a noob.
Shane

FYI: You don't even need to enable the AutoTune module as that is done automatically if it sees AutoTune in the FMS switch.

To add to explanations already given, it was done this way so that you could set it all up on your GCS at home and then run it at the flying field without using a GCS at the flying field.  Normal FMS setup for AT (see wiki) would allow you to fly with stock PIDs, tune with AT (using stock PIDs while tuning), and fly with the AT tuned PIDs; all as many times as you want.  Even fly stock PIDs after tuning.  All without GCS at the flying field.

Also: If you have a SmoothQuick slider/knob configured and you manually enable the AutoTune module in System->Settings->HwSettings->OptionalModules, then even after you remove AT from your FMS the SmoothQuick slider/knob will still work (obviously won't work with the FMS toggle version of SmoothQuick).