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
Leonard's new Loiter #7258
Leonard's new Loiter #7258
Conversation
WPNAV_LOIT_JERK was added because optical flow needed to limit the maximum rotation rate to function reliably. As this parameter limits the rate of change of acceleration, not the rate of change of angle, it did not directly address the need to limit rate of change of angle. It also unnecessarily complicated the attitude controller and could cause poor performance if set incorrectly (the default value was compromising performance). The Attitude controller now provides the function to limit maximum rotation rate directly. The maximum rotation rate has a number of uses:
|
Does this also mean that if you are flying around manually in loiter or on autopilot in guided, auto, RTL, etc, and you start going too fast to maintain altitude, it will back off the lean angle to prevent the altitude decay? Wheras before you could continue to go faster and faster as altitude decayed faster and faster. And in Alt Hold, pos hold, sport, acro, and stabilize, it is unchanged? |
@Pedals2Paddles |
Ah, ok. So this will apply to all modes except stab, acro, and drift since I believe those are the only three modes that do not use the altitude hold controller. Very cool. Is there a parameter to enable/disable this functionality, or is it always on? |
@Pedals2Paddles It is always on now. |
My main question is where should we set PSC_VELXY_D on the range from 0 to 1? To set up Loiter correctly you should set WPNAV_LOIT_SPEED to your maximum speed when holding 30 degrees lean angle assuming you have default maximum lean angle set. So I would be interested in what people think we should set this to. I am thinking approximately 1500 at this stage. |
Would it be problematic or act strangely if the max loiter speed and max angle are not close together as described? The loiter speed is something that the operator would commonly adjust based on mission needs. And in those cases, the user changing the max angle to correspond is pretty rare. Is making the parameter default max speed and lean angle just for consistency, or is the programmatic and handling reason for it? |
@Pedals2Paddles If the maximum speed is a little low the aircraft tends to lean over and level out. Then after the stick is released it tends go into an immediate gentle braking maneuver. If the maximum speed is a little high the aircraft tends to lean over then slowly lean a little further as speed builds. When the stick is released the aircraft does not come all the way back to level then levels out as it slows. I generally find that the pilot experience is much better when the speed is set too high than too low. |
Also constify existing get_accel_roll/pitch/yaw_max methods
Smoothing gain value should be set once when entering a mode
also add limit_vector_length and sqrt_controller helper functions enforce angle limits rename accel-feedforward to accel-desired remove freeze_ff_xy remove unused VEL_XY_MAX_FROM_POS_ERR remove xy mode remove Jerk Limiting code
move get_horizontal_error declaration to be with other xy method declarations clarify set-accel-xy sets maximum acceleration remove blank line
Also always limit angle to maintain altitude
Also rename stability patch test to motor failure test
dcd8ab4
to
f75ecf9
Compare
} | ||
if (!is_zero(ang_vel_pitch_max)) { | ||
euler_rad.y = constrain_float(euler_rad.y, -ang_vel_pitch_max, ang_vel_pitch_max); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lthall This nested if statement doesn't make sense. first the outer if statement has a an or statement for the same test "is_zero(ang_vel_pitch_max)". Then the nested if statement tests for the reverse of the outer if statement "!is_zero(ang_vel_pitch_max)". Not say this is the issue that @ChristopherOlson found but found this inconsistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first statement checks to see if either one is zero the nested if statements then address if one of them is not zero.
It may have been more intuitive to check to see if both were not zero then handle that case then handle if either one is not zero and the other is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this first statement looking at pitch only in both evaluations and not pitch and roll
if (is_zero(ang_vel_pitch_max) || is_zero(ang_vel_pitch_max)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, dyslexic boy strikes again!!
That should be roll then pitch!!
Thanks Bill!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lthall Hi, so how about this PR? I'm trying to have a test but found that commit Copter: Loiter updates has disabled this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roger-zhao Can you please explain what you are asking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lthall Sorry for my unclear description, what I'm saying it that when I try to build a FW from source code in Randy's branch lthall-new-loiter5, I've found that branch is different with source code in your branch NewLoiter-09122017 , and after source code comparing, it seems like in your branch, the new-loiter's "mapping pilot input to lean-angle implementation" has been deleted again (mightbe I'm wrong with this becasue I'm just doing a source code comparing), so I'm not sure if I should build FW from Randy's branch lthall-new-loiter5 or your branch NewLoiter-09122017 for testing this new loiter.
Thanks to Bill for finding this
@roger-zhao Randy and I should be getting it into master soon too. |
@lthall Got it. I've watch this youtube demo, and can't wait to test it even might be little risky. :) |
Superseded by #7606. |
This PR from @lthall and I does the following:
New/Changed Parameters include:
There are some outstanding issues that need to be resolved before this can go into master: