Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotorcraft guidance fixes/improvements #539

Closed
wants to merge 23 commits into from
Closed

Conversation

flixr
Copy link
Member

@flixr flixr commented Sep 11, 2013

So now horizontal guidance returns commands in north/east earth frame and doesn't already rotate it to body frame. This allows for better handling of them in different controllers.

New and properly working transformations from earth commands to quaternions added.
No proper fixedpoint implementation so far... no change there compared to current master though. Should still be done for efficiency.

Tested the int_quat stablizitation with this in simulation and it works perfectly as expected.

IMPORTANT: This does currently not have the feature to "add" roll/pitch setpoints via RC in nav/hover anymore.
Is that really used, instead of switching to manual if needed?
Instead you can give velocity commands in hover mode via RC.

Includes max bank improvements proposed in #546

  • Split PD and I-gain with separate max bank
    • no wind: integrator (trim attitude) = 0, PD maxbank = -20 to 20 extra: total: -20 to 20
    • huge wind: integrator (trim attitude) = 20, PD maxbank = -20 to 20 extra: total: 0 to 40
  • Put gain before integrator to get better insight in the saturation values
  • Reduce integration overshoots while increasing integration speed by adding the speed error as well
    • no speed error: integrate as before
    • counterproductive speed error, integrate faster
    • if the position error is already decreasing fast, no integrator is needed or it will overshoot

@flixr flixr mentioned this pull request Sep 11, 2013
based on the idea of Sergei from pull request #532

Still need to use only the vertical thrust instead of total thrust.
Will be corrected later using the get_vertical_thrust_coeff from pull request #528
@Drumettaz
Copy link
Contributor

give velocity commands in hover is a very nice feature.
I actually use RC roll/pitch setpoints to tune PID horizontal guidance gains. But I suppose this will be also possible using speed setpoints?

@flixr
Copy link
Member Author

flixr commented Sep 12, 2013

give velocity commands in hover is a very nice feature.

Giving velocity commands in hover is not done yet. I'm also not sure what the best way is to implement that... (give actual velocity commands or rather move the position setpoint)?

I actually use RC roll/pitch setpoints to tune PID horizontal guidance gains. But I suppose this will be also possible using speed setpoints?

I'm not quite sure I understand... how do you tune guidance gains by additionally adding roll/pitch setpoints via RC? While you can probably tune the PID part a bit it is not the same as flying in nave, as your ff and horizontal guidance ref are zero...

@Drumettaz
Copy link
Contributor

I think we should give velocity commands and use the guidance_h_ref generator with update from speed.
This is consistent with RC_CLIMB mode for vertical control loops.

About tuning: I use roll/pich setpoint to move the rotorcraft from hover position. Then I release the sticks to see how the rototcraft comes back to hover position. This is equivalent to a wind gust moving the rotorcraft in nav mode, so you can see if the tuning is fast but stable, otherwise P and D term of the guidance_h loop can be tuned.
But this test can also be performed by moving the waypoint in NAV mode, without reference generator.

@flixr
Copy link
Member Author

flixr commented Sep 13, 2013

The problem with the current simple gh_update_ref_from_speed_sp that if you can't follow the ref (e.g. not well tuned, wind, etc..), the position setpoint will be further and further away from where you are.
And when you release the stick it will continue flying to the position setpoint that is still further away.
And when you give a zero velocity command you want it to stop quickly... should the new position setpoint be exactly where the vehicle was when speed sp was set to zero? Then it would briefly continue (inertia) and come back to that point.
Also you can't just simply set the the position setpoint to the current position if the speed sp is zero.
That would mean you keep setting the pos setpoint to your current position even if external forces push you away from the original position.

merge to get refactored vert loop with get_vertical_thrust_coeff
- enable/disable via settings
- gets a better approximation of vertical thrust using guidance_v_thrust_coeff
- vertical thrust is recomputed in guidance_h to take the latest thrust command after guidance_v was run
@Drumettaz
Copy link
Contributor

If the "rc_max_speed" is set to reasonably small speed, 4 m/s for example.
Then the reference will certainly stay close to the actual position, even
with wind?
To me that feature would be similar to rc_climb mode: it works well with
"reasonable" saturated speeds.

@flixr
Copy link
Member Author

flixr commented Sep 13, 2013

IHMO just advancing the reference from the speed setpoint does not give satisfatory results (neither for vertical).
It works OK if it's well tuned, but we should think about how we could improve that (ie. stopping where you are when you let go of the stick).

@softsr
Copy link
Contributor

softsr commented Sep 15, 2013

I think resetting a setpoint to the current position when stick released could be useful, but... it can cause other problems. People may think the airframe is tuned well enough (but it isn't), so they switch to nav and have troubles.
Imho at the first step would be reasonable to simply use gh_update_ref_from_speed_sp, but reduce the default max ref speed to, for example, 1,5-2m/s. As soon as they will be unsatisfied with the max speed (which could mean the proper tuning), they can increase it.

softsr and others added 2 commits September 15, 2013 04:02
- fix rc_x and rc_y values
  - still needs to be scaled to max speed using circle instead of box bounding,
    but while making sure a division by zero can't occur!
- only copy pos_ref to pos_sp in hover mode
- move GUIDANCE_H_REF_MAX_SPEED|ACCEL to ref header file so it can be used
- refactor rc speed setpoint reading into separate function

closes #543
softsr and others added 3 commits September 15, 2013 21:12
- add GUIDANCE_V_CLIMB_RC_DEADBAND (in pprz units, default MAX_PPRZ/10)
  - GUIDANCE_V_RC_CLIMB_DEAD_BAND is obsolete
- GUIDANCE_V_MAX_RC_CLIMB_SPEED defaults to GUIDANCE_V_REF_MIN_ZD
- GUIDANCE_V_MAX_RC_DESCENT_SPEED defaults to GUIDANCE_V_REF_MAX_ZD
This was referenced Sep 15, 2013
In case of wind, the -20 to 20 max bank should become -40 deg in the wind direction and +0 in
the opposite direction. The i-gain should be sufficiently SLOW but with HIGH authority.
This commit suggests to split the max-bank from PD an I with separate saturation and have the
I-gain before the integrator so better insight is gained in its authority.
Integrate twice as fast when not only POS but also SPEED are wrong,
but do not integrate POS errors when the SPEED is already catching up.
@OpenUAS
Copy link
Contributor

OpenUAS commented Sep 28, 2013

Time for a new quadcopter for me.. Then some October wind and my tests can continue... For sure a good development for real flights in real scenarios, nice!

flixr added a commit that referenced this pull request Sep 28, 2013
Can only be removed once pull request #539 is merged
@flixr
Copy link
Member Author

flixr commented Oct 7, 2013

@dewagter, @OpenUAS, @gautierhattenberger, @softsr, @Drumettaz
I would like to merge this rather sooner than later to master, any objections?

@flixr flixr closed this in ede94e0 Oct 11, 2013
@flixr flixr added this to the v5.2 milestone Mar 5, 2014
@OpenUAS
Copy link
Contributor

OpenUAS commented May 19, 2014

THX, will be put to the test again asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants