mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 02:13:33 +08:00
Flight tasks: avoid using *= for scalar to vector assignment
It's confusing and there is a corner case where the result is incorrect: *= 0 will not set the variable to 0 if it's already NAN.
This commit is contained in:
committed by
Dennis Mannhart
parent
bb756e0e12
commit
206baa7432
@@ -68,8 +68,8 @@ bool FlightTaskOffboard::activate()
|
||||
{
|
||||
bool ret = FlightTask::activate();
|
||||
_position_setpoint = _position;
|
||||
_velocity_setpoint *= 0.0f;
|
||||
_position_lock *= NAN;
|
||||
_velocity_setpoint.setZero();
|
||||
_position_lock.setAll(NAN);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ bool FlightTaskOffboard::update()
|
||||
return true;
|
||||
|
||||
} else {
|
||||
_position_lock *= NAN;
|
||||
_position_lock.setAll(NAN);
|
||||
}
|
||||
|
||||
// Takeoff
|
||||
@@ -135,7 +135,7 @@ bool FlightTaskOffboard::update()
|
||||
return true;
|
||||
|
||||
} else {
|
||||
_position_lock *= NAN;
|
||||
_position_lock.setAll(NAN);
|
||||
}
|
||||
|
||||
// Land
|
||||
@@ -155,7 +155,7 @@ bool FlightTaskOffboard::update()
|
||||
return true;
|
||||
|
||||
} else {
|
||||
_position_lock *= NAN;
|
||||
_position_lock.setAll(NAN);
|
||||
}
|
||||
|
||||
// IDLE
|
||||
|
||||
Reference in New Issue
Block a user