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
Plane: most plane centi parameters to deg or m or m/s #26025
Conversation
3e036a4
to
5de9174
Compare
ping @timtuxworth |
So we use Why not |
This is not just about cruise mode, it applies in all auto modes, e,g. if you flip to LOITER it will try to loiter at this speed, it's the default flying speed in AUTO if you don't set a specific speed. I think Pete's comment raises an issue though - it will definitely confuse people to have _CRUISE as the parameter name for a parameter that is NOT specifically about CRUISE mode. I do like CRUISE - it is more understandable to new/casual users. I can sort of see Pete's point, but it really isn't the same concept, especially for plane users who might come from RC, 'trim' is about setting the surfaces' hands off location, this airspeed value is not that. The only other name I can think of that would make sense might be AIRSPEED_AUTO. I'll make one last comment that I really think it should be ARSPD not AIRSPEED for consistency, but I won't mention it again. |
Do you think Q_TRIM_PITCH should be converted to Q_TRIM_PITCH_DEG @tridge ? I think it would be a good idea for consistency. I was looking at doing that in my PR, it's a very simple change. |
Does this mean my PR should be closed then? |
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.
Some suggestions, some fixes from my own incomplete work. (mostly leftover PITCH_TRIM needing _DEG in param files).
libraries/SITL/examples/SilentWings/Params/Rolladen-Schneider-LS8b.param
Outdated
Show resolved
Hide resolved
libraries/SITL/examples/SilentWings/Params/Schleicher-ASW27B.param
Outdated
Show resolved
Hide resolved
I will re-state that I'm not a fan of adding |
What convinced me was finding some Q_ parameters (e.g. Q_ANGLE_MAX) that were in centi-degrees that did NOT have _CD at the end, so anyone using a converted parameter might easily use centidegrees when the refactored parameter should be degrees. So Q_ANGLE_MAX needs to become Q_ANGLE_MAX_DEG otherwise - planes will fall from the sky. So by extension if you are adding _DEG for one it should be added for all. MIN_GROUNDSPEED (should be GROUNDSPEED_MIN) is a velocity not a distance, but I note that ALT_HOLD_RTL (was centimeters) is now RTL_ALTITUDE - and yes maybe it could be RTL_ALT_M for a similar reasons (I think "M" should be ok for meters, it's a standard). veloclity and accelerations are harder. centidegrees/s and centidegrees/s/s (yes we have both) become what? "DEGS", "DS" and "DEGSS" and "DSS"? hardly user friendly. GROUNDSPEED_MIN could be GROUNDSPEED_MIN_MS - oh wait, is that milliseconds? :-D In essence, I think the call is - _CD becomes _DEG because the risk is higher with this one, but otherwise - no units in the name, it's in the metadata - right? Do less harm. |
I'm not sure that is really true that the angle params are more "risky", there are plenty of scenarios where incorrect params make bad things happen. Don't forget the risk to the vehicle it's self not the only factor. The obvious example is setting your RTL alt 100 times too high will not cause your vehicle to crash (into the ground anyway). The whole point of the rename is to make the parameters more consistent with units and naming. We only currently have one parameter with |
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.
Oh I had a pending review - sorry.
it is a per-parameter judgement, but it is partly because there is no obvious suffix for m/s that users will instantly recognise, whereas I think all users will understand XX_DEG as being degrees |
I discussed with @priseborough and he and I agreed it really has nothing to do with "trim". The "cruise" speed of an aircraft is standard parlance for what this variable represents, the original "trim" name was a mistake |
These two look suspicious because of the swapping of "Alt" and "Cruise"... also "min" and "floor" are very similar.
We should be careful that when MIN, MAX, TRIM etc are in the parameter name that they appear at the end except when the parameter name includes the Units. In this case it become Min/Max/Trim _ Units. I think this is all fine in this PR but I haven't checked everything carefully. |
|
||
// @Param: LIM_PITCH_MAX | ||
// @Param: PTCH_LIM_MAX_DEG |
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.
In copter we've used the short form, PIT when we didn't have enough room for Pitch.
@@ -637,35 +637,34 @@ const AP_Param::Info Plane::var_info[] = { | |||
// @User: Advanced | |||
GSCALAR(scaling_speed, "SCALING_SPEED", SCALING_SPEED), | |||
|
|||
// @Param: MIN_GNDSPD_CM | |||
// @Param: MIN_GROUNDSPEED |
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.
MIn should not really be at the front if possible.
// | ||
#ifndef MIN_GNDSPEED | ||
# define MIN_GNDSPEED 0 // m/s (0 disables) | ||
#ifndef MIN_GROUNDSPEED |
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.
If the definitions being changed, I'd also put the MIN at the end.
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.
If the definitions being changed, I'd also put the MIN at the end.
Agree
Everyone please concentrate on actual errors in this PR. It is clear we're not going to get any two people to agree on every point, so what I want if for it to meet the main objectives |
@@ -1545,6 +1543,19 @@ void Plane::load_parameters(void) | |||
#if AP_FENCE_ENABLED | |||
AP_Param::convert_class(g.k_param_fence, &fence, fence.var_info, 0, 0, true); | |||
#endif | |||
|
|||
// PARAMETER_CONVERSION - Added: Dec 2023 |
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.
// PARAMETER_CONVERSION - Added: Dec 2023 | |
// PARAMETER_CONVERSION - Added: Jan 2023 for Plane 4.5 |
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.
Jan 2024?
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.
Basically looks good, I left a few comments, but no bugs I can see.
@@ -1314,7 +1313,6 @@ static const AP_Param::ConversionInfo conversion_table[] = { | |||
|
|||
{ Parameters::k_param_land_slope_recalc_shallow_threshold,0,AP_PARAM_FLOAT, "LAND_SLOPE_RCALC" }, | |||
{ Parameters::k_param_land_slope_recalc_steep_threshold_to_abort,0,AP_PARAM_FLOAT, "LAND_ABORT_DEG" }, | |||
{ Parameters::k_param_land_pitch_cd, 0, AP_PARAM_INT16, "LAND_PITCH_CD" }, |
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.
I wonder if we should just take the opportunity to remove all of these landing param conversions. With this change you get most converted but not all. Looks like there 8 years old. #5269
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.
separate PR so I don't need to retest for the 4.5 beta
@@ -359,9 +359,9 @@ void Plane::check_fbwb_altitude(void) | |||
} | |||
#endif | |||
|
|||
if (g.FBWB_min_altitude_cm != 0) { |
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.
This is a change in behavior. I guess setting a negative altitude is a bit of a edge case, especially if 0 is a magic disable.
break; | ||
case AUTOTUNE_PITCH: | ||
att_limit_deg = MIN(abs(aparm.pitch_limit_max_cd),abs(aparm.pitch_limit_min_cd))*0.01; | ||
att_limit_deg = MIN(abs(aparm.pitch_limit_max*100),abs(aparm.pitch_limit_min*100))*0.01; |
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.
att_limit_deg = MIN(abs(aparm.pitch_limit_max*100),abs(aparm.pitch_limit_min*100))*0.01; | |
att_limit_deg = MIN(fabsf(aparm.pitch_limit_max), fabsf(aparm.pitch_limit_min)); |
This builds on #25768 and converts:
This includes one real bug fix, in AP_Landing::type_slope_get_target_airspeed_cm() where cm and m was mixed up