trust

  • ****
  • 301
Axis Hold / Rate stabilization
« on: December 23, 2017, 08:18:04 pm »
I'm using a pair of Atom C3CCD controllers in an experimental aircraft, and I need the servo output to hold the deflection required to get to the desired endpoint, rather than just a short deflection. None of the control modes I've tried seem to do this.
Like rate, I should be able to apply a angle change based on the amount of stick movement, and return to center should then have the updated deflection angle change in the servo position until the craft reaches that angle.
For example, with stationary aircraft, short movement of stick, then back to center should move the control surface - and it should stay there until aircraft attitude moves to the updated angle.
Is there a mode for this?

Re: Axis Hold / Rate stabilization
« Reply #1 on: December 24, 2017, 01:53:33 am »
If all you want is servo signal that is proportional to the bank angle, you might look into pretending you are using a camera gimbal and setting that up.

Other than that, you could use Attitude mode and tune the PIDs.  You can get servo signal proportional to bank angle by setting "ID" (of PID) to zero and just adjusting P to what you need.

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #2 on: December 24, 2017, 03:46:17 am »
Thanks for the quick reply. No, attitude is not quite it. I dont want to have to hold the aircraft angle by holding an angle in the sticks. Rate is what SEEMS like it should be what I want - servo will hold whatever angle the aircraft is at when sticks are 0 - and deflections of the stick move that angle. But that's not what I get when I set rate. Servo deflects x amount, then returns to 0 deflection, or whatever offset I have in the sticks. Every pulse of the stick should add a delta to the current angle.
Axis hold doesn't seem to do it either.

Re: Axis Hold / Rate stabilization
« Reply #3 on: December 24, 2017, 05:42:36 am »
Then Rate (or AxisLock), but you will have to adjust the PIDs.  It sounds like you need PD=0 and adjust "I" to suit.  That is what I would play with to start with anyway.

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #4 on: December 24, 2017, 08:15:55 am »
Using rate, Setting PD=0 and adjusting I, I ran I up to 5 and get a deflection, short pause (maybe 0.5s) then it returns to center. 10 or above and it starts oscillating. Axis Lock is similar.
The pause seems like its trending in the right direction, but I can't go anymore and still be stable.
Is there anywhere with a diagram of the process flow for different stabilization cases?
Thanks

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Axis Hold / Rate stabilization
« Reply #5 on: December 24, 2017, 11:59:11 am »
Using Rate or AxisLock there is no angle involved in stabilization and only Gyro sensors are used.
Rate/AxisLock simply play with angular velocity, middle stick mean 0deg/s rotation and full stick the max rate defined in stabilization bank.
If you apply a brief stick movement and return to 0, rotation will be applied briefly and stops since you go back to 0.

Attitude stabilization will simply stabilize at one bank angle, proportional to the stick deflection (see Attitude response) and you need to maintain the stick position of course.

Seems you need to develop your own stabilization mode, using stick to define a offset angle according to the maximum stick deflection, waiting for stick back to zero and finally applying this offset to a value/setpoint angle used for Attitude stabilization.
Remember the CC3D/Atom will not give a reliable angle/heading in Yaw axis because this board do not use magnetometer and heading is only estimated using Gyros.

Maybe you can explain why the stick deflection need to be applied briefly in your application ?

Here is a diagram describing how Rate/AxisLock and Attitude works.

Re: Axis Hold / Rate stabilization
« Reply #6 on: December 24, 2017, 05:53:58 pm »
With PD=0 and I=? you might try increasing System->Settings->StabbilizationSettingsBank1(or 2,3 if you are using those banks instead of the default of 1)->RollRatePID->ILimit

Click red "up arrow" at top of the window to save value.

Also PitchRatePID

Reboot FC afterward to make sure it uses new settings.

Find a good minimum value that works, and don't go too much higher.  Maybe double the good min value.  If I were to guess and without bothering to read the code, this is in degrees of bank angle per second or radians per second, so maybe 30.0 for a test and go from there ??  Depending on speed of servos you have this could even need to be 1000.0
« Last Edit: December 24, 2017, 07:36:09 pm by TheOtherCliff »

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #7 on: December 24, 2017, 08:32:56 pm »
Fiddling with the rate limit didn't help.
But I went back to an earlier suggestion - using the camera gimbal. I set the inputs to drive the accessory channels, and set the pitch and roll gimbals, and set it to axislock. This is exactly what I'm looking for!
I'm unclear on the input and output angle settings. How do these define the range? I need to be able to set full 360 degree motion for both axis. Usually gimbals have limits, but in my case I don't.

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #8 on: December 25, 2017, 01:04:39 am »
I transferred the hardware from the test rig to the actual aircraft. I only use input 1 and input 5 (even that's not that necessary).
I set channel 1 as accessory 1, and put that as the input to the pitch gimbal.
The stabilization - ie moving the servo in response to the pitch change - works fine.
But I cant get any input control!
I can see the input - its registering in the remote control input properly.
But its not doing anything on the servo!
What am I missing?

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #9 on: December 25, 2017, 02:07:04 am »
OK. I got the input working again, by making sure all the inputs were connected to something (ALARMS went green). Also somehow the output got tuned off - needed to turn that back on.
I had to switch to roll gyro, as the pitch only goes +/-90 degrees, then it flips over!
Changed the input & output ranges to 180 degrees, and turned the inputrate to max 255.
But the rate is too slow and the deflection angles too weak. How can I increase them?

Re: Axis Hold / Rate stabilization
« Reply #10 on: December 25, 2017, 03:21:33 am »
Where is the FC mounted?  It must be mounted on the surface that moves when you "bank" it for any of this to work.

Camera gimbal is basically a hard coded "Attitude mode for camera" that depends only on the FC bank angle and nothing else (i.e. does not depend on RC input), so that won't work.  Sorry about that one.

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #11 on: December 25, 2017, 06:15:07 am »
I have it mounted where it needs to be on the wing, and adjusted position and range using the board rotation. Its doing what I want now, just the rate is too slow and the angle is only marginally good enough.
I've upped the angle by using the servo horn as a lever amplifier. It may be enough to work for testing.
But I'd sure like to increase the rate somehow - it's at 255 and it won't let me set it any higher - can I set it higher in the XML and upload it somehow?. I was hoping I didn't need to dive into code, but *sigh* looks like the only way left.
How do I make sure the modifications stay? I've been making changes using the System list, and hitting the upload button, but when I turn everything off, then on again, my changes aren't always saved in the FC. I've been exporting the list to save it - how do I reload configurations? If I import I get a whole new list of tabs with identical names.

Re: Axis Hold / Rate stabilization
« Reply #12 on: December 25, 2017, 06:38:34 am »
File -> ExportUavFile or Import... to save and restore from a file

255 ... It sounds like the UAVO you are setting is an 8 bit field and it can only store a number from 0 to 255, like 1 bit can only store 0 or 1.

trust

  • ****
  • 301
Re: Axis Hold / Rate stabilization
« Reply #13 on: December 25, 2017, 07:27:52 am »
For some reason, the board rotation values are lost every time I power down & back up again. Is there something I'm missing about how to save the current settings so they come up after power down?
Thanks for all the help btw - Happy Holidays to you!

Re: Axis Hold / Rate stabilization
« Reply #14 on: December 25, 2017, 06:13:15 pm »
It must be disarmed to save correctly.

So "Always Armed" is a large pain.