mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 01:33:34 +08:00
FlightTasks: remove unnecessary double precision floating point math
This commit is contained in:
@@ -72,7 +72,7 @@ void FlightTaskAutoLine::_setSpeedAtTarget()
|
||||
|
||||
if (Vector2f(&(_target - _next_wp)(0)).length() > 0.001f &&
|
||||
(Vector2f(&(_target - _prev_wp)(0)).length() > _target_acceptance_radius)) {
|
||||
// angle = cos(x) + 1.0
|
||||
// angle = cosf(x) + 1.0f
|
||||
angle =
|
||||
Vector2f(&(_target - _prev_wp)(0)).unit_or_zero()
|
||||
* Vector2f(&(_target - _next_wp)(0)).unit_or_zero()
|
||||
|
||||
@@ -202,8 +202,8 @@ float FlightTaskAutoLineSmoothVel::_getSpeedAtTarget()
|
||||
yaw_align_check_pass) {
|
||||
// Max speed between current and next
|
||||
const float max_speed_current_next = _getMaxSpeedFromDistance(distance_current_next);
|
||||
const float alpha = acos(Vector2f(&(_target - _prev_wp)(0)).unit_or_zero() *
|
||||
Vector2f(&(_target - _next_wp)(0)).unit_or_zero());
|
||||
const float alpha = acosf(Vector2f(&(_target - _prev_wp)(0)).unit_or_zero() *
|
||||
Vector2f(&(_target - _next_wp)(0)).unit_or_zero());
|
||||
// We choose a maximum centripetal acceleration of MPC_ACC_HOR * MPC_XY_TRAJ_P to take in account
|
||||
// that there is a jerk limit (a direct transition from line to circle is not possible)
|
||||
// MPC_XY_TRAJ_P should be between 0 and 1.
|
||||
|
||||
Reference in New Issue
Block a user