mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
refactor(navigator): remove unused parameters from computeReturnAltitude (#26969)
* Remove unused parameters from function signature and make the parameter accessors consistent * Update the caller function signature * Update src/modules/navigator/rtl.cpp --------- Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
This commit is contained in:
parent
550b7148a5
commit
83c41dcf87
@ -394,7 +394,7 @@ void RTL::setRtlTypeAndDestination()
|
||||
}
|
||||
}
|
||||
|
||||
const float rtl_alt = computeReturnAltitude(destination, destination_type, (float)_param_rtl_cone_ang.get());
|
||||
const float rtl_alt = computeReturnAltitude(destination);
|
||||
_rtl_direct.setRtlAlt(rtl_alt);
|
||||
_rtl_direct.setRtlPosition(destination, landing_loiter);
|
||||
|
||||
@ -579,7 +579,7 @@ void RTL::setSafepointAsDestination(PositionYawSetpoint &rtl_position, const mis
|
||||
}
|
||||
}
|
||||
|
||||
float RTL::computeReturnAltitude(const PositionYawSetpoint &rtl_position, DestinationType destination_type, float cone_half_angle_deg) const
|
||||
float RTL::computeReturnAltitude(const PositionYawSetpoint &rtl_position) const
|
||||
{
|
||||
if (_param_rtl_cone_ang.get() > 0 && _vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
||||
// horizontal distance to destination
|
||||
@ -602,7 +602,7 @@ float RTL::computeReturnAltitude(const PositionYawSetpoint &rtl_position, Destin
|
||||
if (destination_dist <= _param_rtl_min_dist.get()) {
|
||||
|
||||
// constrain cone half angle to meaningful values. All other cases are already handled above.
|
||||
const float cone_half_angle_rad = radians(constrain(cone_half_angle_deg, 1.0f, 89.0f));
|
||||
const float cone_half_angle_rad = radians(constrain((float)_param_rtl_cone_ang.get(), 1.0f, 89.0f));
|
||||
|
||||
// minimum altitude we need in order to be within the user defined cone
|
||||
const float cone_intersection_altitude_amsl = destination_dist / tanf(cone_half_angle_rad) + rtl_position.alt;
|
||||
|
||||
@ -155,11 +155,10 @@ private:
|
||||
* @brief calculate return altitude from return altitude parameter, current altitude and cone angle
|
||||
*
|
||||
* @param[in] rtl_position landing position of the rtl
|
||||
* @param[in] destination_type type of the rtl destination
|
||||
* @param[in] cone_half_angle_deg half angle of the cone [deg]
|
||||
*
|
||||
* @return return altitude
|
||||
*/
|
||||
float computeReturnAltitude(const PositionYawSetpoint &rtl_position, DestinationType destination_type, float cone_half_angle_deg) const;
|
||||
float computeReturnAltitude(const PositionYawSetpoint &rtl_position) const;
|
||||
|
||||
/**
|
||||
* @brief initialize RTL mission type
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user