-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
AP_RangeFinder: allow for more than 327m range #27886
base: master
Are you sure you want to change the base?
AP_RangeFinder: allow for more than 327m range #27886
Conversation
1bf6995
to
88faf49
Compare
ea8a289
to
1239beb
Compare
|
5c0e9ae
to
09efa59
Compare
09efa59
to
0983029
Compare
ArduSub/Log.cpp
Outdated
@@ -48,7 +48,7 @@ void Sub::Log_Write_Control_Tuning() | |||
inav_alt : inertial_nav.get_position_z_up_cm() * 0.01f, | |||
baro_alt : barometer.get_altitude(), | |||
desired_rangefinder_alt : (int16_t)mode_surftrak.get_rangefinder_target_cm(), |
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.
These now being in different units will be annoying. I would vote to convert this to meters for logging.
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.
OK, adding a patch.
ArduSub/mode_surftrak.cpp
Outdated
@@ -67,9 +67,9 @@ bool ModeSurftrak::set_rangefinder_target_cm(float target_cm) | |||
sub.gcs().send_text(MAV_SEVERITY_WARNING, "wrong mode, rangefinder target not set"); | |||
} else if (sub.inertial_nav.get_position_z_up_cm() >= sub.g.surftrak_depth) { | |||
sub.gcs().send_text(MAV_SEVERITY_WARNING, "descend below %f meters to set rangefinder target", sub.g.surftrak_depth * 0.01f); | |||
} else if (target_cm < (float)sub.rangefinder_state.min_cm) { | |||
} else if (target_cm < (float)sub.rangefinder_state.min*100) { |
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.
} else if (target_cm < (float)sub.rangefinder_state.min*100) { | |
} else if (target_cm < sub.rangefinder_state.min*100) { |
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.
Fixed
libraries/AP_Scripting/docs/docs.lua
Outdated
@@ -3177,6 +3177,26 @@ function rangefinder:max_distance_cm_orient(orientation) end | |||
---@return integer | |||
function rangefinder:distance_cm_orient(orientation) end | |||
|
|||
-- desc |
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.
Full descriptions please.
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.
Fixed. Note that I did just copy the block above which used that "desc" thing :-)
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.
Fixed. Note that I did just copy the block above which used that "desc" thing :-)
Yeah, stuff that pre-dates the docs gets a pass, anything new does not. I need to take another pass at filling in the missing ones.
0983029
to
23bf660
Compare
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.
Thanks for the review, @IamPete1 !
ArduSub/mode_surftrak.cpp
Outdated
@@ -67,9 +67,9 @@ bool ModeSurftrak::set_rangefinder_target_cm(float target_cm) | |||
sub.gcs().send_text(MAV_SEVERITY_WARNING, "wrong mode, rangefinder target not set"); | |||
} else if (sub.inertial_nav.get_position_z_up_cm() >= sub.g.surftrak_depth) { | |||
sub.gcs().send_text(MAV_SEVERITY_WARNING, "descend below %f meters to set rangefinder target", sub.g.surftrak_depth * 0.01f); | |||
} else if (target_cm < (float)sub.rangefinder_state.min_cm) { | |||
} else if (target_cm < (float)sub.rangefinder_state.min*100) { |
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.
Fixed
libraries/AP_Scripting/docs/docs.lua
Outdated
@@ -3177,6 +3177,26 @@ function rangefinder:max_distance_cm_orient(orientation) end | |||
---@return integer | |||
function rangefinder:distance_cm_orient(orientation) end | |||
|
|||
-- desc |
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.
Fixed. Note that I did just copy the block above which used that "desc" thing :-)
23bf660
to
8f566a9
Compare
return _max_distance_cm; | ||
// return the larger of the base class's distance and what we | ||
// receive from the network: | ||
return MAX(baseclass_max_distance, _max_distance); |
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.
return MAX(baseclass_max_distance, _max_distance); | |
return MIN(baseclass_max_distance, _max_distance); |
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 think this is now the opposite to what it did before?
return params.max_distance_cm; | ||
} | ||
return _max_distance_cm; | ||
// return the larger of the base class's distance and what we |
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.
// return the larger of the base class's distance and what we | |
// return the lesser of the base class's distance and what we |
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.
Hmmm. That's odd. Fixed.
libraries/SITL/examples/SilentWings/Params/Rolladen-Schneider-LS8b.param
Outdated
Show resolved
Hide resolved
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
libraries/SITL/examples/SilentWings/Params/Schleicher-ASW27B.param
Outdated
Show resolved
Hide resolved
f657c9b
to
df71eb6
Compare
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.
Fixed things, thanks!
return params.max_distance_cm; | ||
} | ||
return _max_distance_cm; | ||
// return the larger of the base class's distance and what we |
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.
Hmmm. That's odd. Fixed.
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
libraries/SITL/examples/SilentWings/Params/Schleicher-ASW27B.param
Outdated
Show resolved
Hide resolved
df71eb6
to
1d91828
Compare
… rename also fix a race condition in the quadplane-tailsitter test - which is unlikely to ever trigger
1d91828
to
de16535
Compare
|
||
// return the smaller of the base class's distance and what we | ||
// receive from the network: | ||
return MIN(baseclass_min_distance, _min_distance); |
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 would have expected this one to be MAX
No description provided.