mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 17:20:35 +08:00
FlightTasks: adapt POSIX convention to return negative values on error
This commit is contained in:
@@ -10,18 +10,20 @@ int FlightTask::update()
|
||||
_deltatime = math::min((_time_stamp_current - _time_stamp_last), _timeout) / 1e6f;
|
||||
_time_stamp_last = _time_stamp_current;
|
||||
updateSubscriptions();
|
||||
_evaluate_vehicle_position();
|
||||
return 0;
|
||||
int ret = _evaluate_vehicle_position();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FlightTask::_evaluate_vehicle_position()
|
||||
int FlightTask::_evaluate_vehicle_position()
|
||||
{
|
||||
if ((_time_stamp_current - _sub_vehicle_local_position.get().timestamp) < _timeout) {
|
||||
_position = matrix::Vector3f(&_sub_vehicle_local_position.get().x);
|
||||
_velocity = matrix::Vector3f(&_sub_vehicle_local_position.get().vx);
|
||||
_yaw = _sub_vehicle_local_position.get().yaw;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
_velocity.zero(); /* default velocity is all zero */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user