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

MPC: ORBIT: reduce jerk when transitioning into orbit #23634

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Conversation

Claudio-Chies
Copy link
Contributor

@Claudio-Chies Claudio-Chies commented Aug 30, 2024

Solved Problem

When transitioning from flying towards the orbit to orbiting, the vehicle can jerk quite alot around the axis pointing towards the orbit center (usually roll)

The Problem is the transition into the circling is implemented as a step response.

Solution

With this PR i also add a ramp of 30 samples to the initial start of the orbit maneuvre, by this the initial jerk is greatly reduced, and the transition is smoother
ADD PICTURE

Changelog Entry

For release notes:

Bugfix: Reduced Jerk when transitioning from approach to orbit circle to orbit

Alternatives

Test coverage

  • SITL Flightreview
    Tested also with higher velocities and changing radiuses, the problems described by Mathieu are not present in this fix

@bresch
Copy link
Member

bresch commented Aug 30, 2024

I tried with higher speeds and after changing the orbit radius the drone struggles a bit to settle back on the circle. This is probably because the jerk-limited trajectory makes the orbit controller oscillate.
image

@Claudio-Chies
Copy link
Contributor Author

Good catch, i'll try do find a fix on monday

Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I settled on this Orbit setpoint generation after many tests with position setpoints, smoothing, ... and this is the best implementation I found so far. The only catch which I never got to solving is accelerating into orbiting at the beginning. I think it only requires some kind of 1 dimensional acceleration phase for the velocity. Feeding everything through the trajectory generator in cartesian coordinates with position setpoints brings back all the issues I already went through during initial testing.

Note that @junwoo091400 went through a similar process making the follow me mode and also ended up smoothing on the tangential dimension.

@Claudio-Chies
Copy link
Contributor Author

Couldnt we use a linear ramp on the existing implementation?
This way we would flatten the initial jerk quite alot, and we wouldnt require the smoothing

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 3, 2024

Couldnt we use a linear ramp on the existing implementation?

Sure, that might work well. Could for example ramp in the rotation velocity using

const T interpolate(const T &value, const T &x_low, const T &x_high, const T &y_low, const T &y_high)

Copy link
Member

@bresch bresch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The orbit is made of 2 components:

  • reference trajectory used as feedforward
  • controller to bring the drone back on the circle

IMO, the slew-rate you want to add should be applied on the reference trajectory an not on everything. Also, instead of using an arbitrary time of 30dt to ramp up the velocity, why not limiting it using the acceleration parameter?

@Claudio-Chies
Copy link
Contributor Author

@bresch
good point, i now implemented the ramping with the use of a slew rate, as discussed with @MaEtUgR

@bresch bresch merged commit 4ba4b34 into main Sep 13, 2024
52 of 55 checks passed
@bresch bresch deleted the pr-orbit_roll branch September 13, 2024 08:28
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.

3 participants