LibrePilot Forum

Users => Vehicles - MultiRotors => Topic started by: DocHardinger on November 29, 2016, 10:13:28 pm

Title: Using Velocity Roam with Cruise Control
Post by: DocHardinger on November 29, 2016, 10:13:28 pm
Hi,

It seems when i use Velocity Roam, and tilt forward or sidewards the quad doesnt hold its Altitude anymore, means its going down because motor power is not adjusted automatically .
Think this is normal because Position Hold and Altitude Hold ist only active  when sticks are centered. Or am i wrong?

But wouldnt it be nice when you fly in any direction in Velocity Roam that Cruise Control can be activated, so the quad is not loosing height so much?
Or did i get somwething wrong?

Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on November 30, 2016, 05:12:52 am
VelocityRoam is supposed to automatically use CruiseControl.  If you increase your max angle in VtolPathFollowerSettings for a test, you should be able to hear the motors rev up just from the banking.

Is your quad fairly heavy, doesn't have much lift?

How well does it do in Attitude mode with CruiseControl?  If you see the same problem there, you should tune your vertical PIDs.  I'm not sure if which PID is used for what has changed recently, but there are several places.
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on November 30, 2016, 07:53:29 am
In attitude mode it works well ...yes its quiet heavy but also got a lot power...anyway i think my problem is that my quad not hovers at 50% input but maybe at 60...if i get everything right i just have to adjust the motors output curves. If i then switch to VR with throttle at 50% and move sticks it should work better, right?

And i will also try to adjust PIDs. Thx again cliff! Another service star for you :-)
Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on November 30, 2016, 08:10:50 am
There is also a "throttle range" (I forget what it is called) with max, min, and neutral settings.  On my heavy quad that hovers above half I have it set to something like 30, 60, 100.
Title: Re: Using Velocity Roam with Cruise Control
Post by: Mateusz on November 30, 2016, 08:37:34 am
And i will also try to adjust PIDs. Thx again cliff! Another service star for you :-)

Hi Doc,

I will just supplement what Cliff wrote.

There are two categories of PIDs related to different things.

So while I had my stabilization PIDs working well on defaults, very small difference after tunning and it was flying great with CruiseControl on throttle.
The altitude hold (different thing than position hold) was not working for me and copter was oscillating whenever I switched to Throttle mode with Altitude-Vario or Altitude-Hold. These values depend on the quad-copter build, after adjusting them my Altitude Hold started working as expected.


Altitude hold is not a flight mode like position hold (similar names/different thing). But Position Hold or Velocity Roam are flight modes working with INS13 which require all sensors (including GPS) consequently also working altitude hold. Altitude hold on another hand is applied on Throttle and can be combined with Complementary (do not require INS13).

Another important thing to get good altitude is

Another thing is I usually change throttle curve a bit, to be flatter in the middle. This gives me more fine grained control in hover.
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on November 30, 2016, 09:11:24 am
Thx for your detailed instructions.
I already done calibration and case and foam...altitude hold alone is nearly perfect...and with VR sticks in the middle its nailed in the air, i can smoke a cigarette and afterwards its exactly at the same position.
Anyway i think i need to adjust throttle curve or adjust Vertical PID's in VTolPathFollowerSetting cause Altitude PID's working just fine. And adjust the ThrustLimits under VTolPathFollowerSetting. There are also some Settings under StabilizationSettings especially for CruiseControl.

So i got a lot of things to try out, day is rescued  ;D
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 06, 2016, 05:05:14 pm
So VR is working nearly perfect, but i got one strange issue here. When flying to the south copter is always coming down. All other directions are fine. No matter which orientation copter has. I read about the east-west oscilation but this seems different. Seems to have something to do with CruiseControl but not sure. See the video for details and sorry for my bad english pronouncement  :-[ and yes its the queen you hear when changing flightmode :-)

https://www.youtube.com/watch?v=hXXXyqhNN00
Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on December 07, 2016, 01:14:34 am
baro is very light sensitive. make sure it is covered so light doesn't get in.  when light level changes, the sensor values change.

also, prop blast and wind affects it.  partial solution is cover with open cell foam to smooth out the wind.  you can still have issues if simply flying forward increases pressure (like inside an air scoop) and maybe flying backward decreases pressure.  If there is wind, then flying into the wind will have large effect and flying downwind may have zero effect.
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 07, 2016, 07:45:55 am
Its covered with foam and in a dark case but not fully light protected...
Hmm but i also thought about this light sensitivity...but then i thought when sticks are not centered copter dont use altitude hold anymore but only cruisecontrol...but if i am wrong with this that would make sense because in the directipn where copter is going down, the sun shined directly onto the top of the revo. I will try to protect it more against the light.

So to make it short: what kind of algorithm does VR uses when sticks are  not centered

Thx for your help again
Title: Re: Using Velocity Roam with Cruise Control
Post by: Mateusz on December 07, 2016, 09:11:47 am
So to make it short: what kind of algorithm does VR uses when sticks are  not centered

Velocity roam requires GPS (https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+Flight+modes).
Every flight-mode that involves GPS, uses INS13 (which is Extended Kalman Filter implementation for navigation) https://librepilot.atlassian.net/wiki/display/LPDOC/INS13+-+GPS+Navigation
There are two steps prediction step and correction step. In correction step amongst other measurements also barometer altitude and GPS altitude are used. INS13 uses all sensors for estimation. If curious you could probably record each sensor data in scopes and see what happens if you enter brighter area.

Hope that answers your question :)
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 07, 2016, 09:43:38 am
Yes sir!
Thx!
Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on December 07, 2016, 10:53:43 am
PH and VR both use all sensors, including baro and mags.  Basically any GPS mode uses all sensors.

There are different PIDs for different modes though, so it may respond more quickly in one mode than another.
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 13, 2016, 12:49:40 am
Ok now I did another test with just Altitude Vario with Complementary Mode. Baro with foam and perfectly light protected.
Totally stable when hovering. But when flying in any direction it goes down and comes up again when in stable position(no stick input).
So i read a post from you @TheOtherCliff where you wrote that Altitude Vario uses Cruisce Control as a helper.
So am i right that Baro is also in use when flying tilted? Or just Cruise Control? Maybe i have to adjust some Cruise Control Settings under "Stabilization>Expert"?
Or are there any other settings when flying in any direction in Altitude Vario mode?

If its the wind or the prop blast when flying tilted then normally it should go up not down, cause pressure rises, right?

Edit:
An ive found a setting called "CruiseControlFlightModeSwitchPosEnable" under "StabilizationSettings" where all 6 positions are set to False? Is this correct?

Sorry for all this questions, but i really need to learn :-)
Title: Re: Using Velocity Roam with Cruise Control
Post by: Mateusz on December 13, 2016, 08:44:31 am
So am i right that Baro is also in use when flying tilted? Or just Cruise Control?

Yes, Baro is always in use when INS13 is selected for position estimation in our three dimensional space. If Cruise Control (CC) applies additionally in Velocity Roam (VR) like Cliff wrote, then it's only used to compensate for less thrust when banking, but it "knows" nothing about altitude. I imagine PID controller must be tuned between two extrema a) overshooting or b) under-compensating. If it's overshooting it will oscillate, and when it's under-compensating it will take at worst forever to reach desired position. I would try to play with altitude PIDs such that copter comes back to desired altitude fast, but it's not oscillating. I think PID control is pretty well explained here https://www.youtube.com/watch?v=0vqWyramGy8
Save your current PIDs somewhere and experiment, watch out for your fingers (don't hurt yourself)...

That would be my gut's feeling what might be wrong form what you describe.

P.S Complementary is not using baro for position estimation, so INS13 might be better in maintaining altitude as there baro is fused with other sensors.
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 13, 2016, 09:28:14 am
Thx! But i dont use INS13, only complementary with altitude vario. (Its another quad, i build for my dad without mag and gps. And thought would be easier to fly with altitude vario).

So question again what is used when flying tilted in altitude vario in complementary mode? Cruise Control only? Or is baro also read(altitude vario is acting)and so the PIDs are used too?

Hope you get what i mean...

Just to be sure and i know where to search and tune.

PIDs seems to work fine cause with no stick input it goes straight up and stops quiet exactly on the correct height after going down when flying tilted. And i use PID controllers often in my work, so i know how they work, but its really good explained in the video. Only thing i need to know is answer to the question above so i can find out whats wrong..

Thx again

Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on December 13, 2016, 09:13:55 pm
Baro is always in use in Altitude Hold or Altitude Vario.

CruiseControl increases thrust for higher bank angles and at the same time, the baro increases thrust if it sees higher pressure.

Fly a long straight pass at fairly high speed.  If it dips and comes back up while flying, the baro is acting correctly and you can maybe increase CruiseControlFactor (I forget what it is called, default is 100).  If it dips and stays low as long as you are flying forward at speed that implies the baro is seeing lower pressure than it should and it thinks it is too high and so it decreases the altitude.  To fix that, you must determine why the baro is seeing lower pressure.  Maybe a Bernoulli effect or maybe a big hole in the back of the quad causing a suction.  Does it gain altitude when flying backwards?
Title: Re: Using Velocity Roam with Cruise Control
Post by: DocHardinger on December 13, 2016, 09:33:27 pm
Thx! I will do some tests tomorrow...just designed a special cover for the revo and printed it... should be better cover the baro from light and airflow...
Title: Re: Using Velocity Roam with Cruise Control
Post by: TheOtherCliff on December 13, 2016, 10:37:34 pm
So to be clear, all GPS modes and any non-GPS mode that uses CruiseControl use both CruiseControl and baro all the time.  Of course CruiseControl adds zero thrust when the sticks are centered.

Any mode that uses the baro and has either a loss or gain in altitude as long as you are traveling forward and recovers when you stop either doesn't have enough power to travel constantly at that angle, has bad altitude PIDs, or (usual case) has a baro that is getting blown on.  Higher pressure makes it thing it is lower and so it gains altitude.  Lower pressure (Bernoulli effect or big hole in back) makes it think it is higher and so it looses altitude.

Also, there are more PIDs in VtolPathFollower.  Some for altitude, some for horizontal, and one especially for VR mode horizontal.