mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 16:33:35 +08:00
FlightTasks: refactor NAN initializations, spacing
This commit is contained in:
@@ -105,11 +105,11 @@ const vehicle_local_position_setpoint_s FlightTask::getPositionSetpoint()
|
||||
|
||||
void FlightTask::_resetSetpoints()
|
||||
{
|
||||
_position_setpoint.setAll(NAN);
|
||||
_velocity_setpoint.setAll(NAN);
|
||||
_acceleration_setpoint.setAll(NAN);
|
||||
_jerk_setpoint.setAll(NAN);
|
||||
_thrust_setpoint.setAll(NAN);
|
||||
_position_setpoint.setNaN();
|
||||
_velocity_setpoint.setNaN();
|
||||
_acceleration_setpoint.setNaN();
|
||||
_jerk_setpoint.setNaN();
|
||||
_thrust_setpoint.setNaN();
|
||||
_yaw_setpoint = _yawspeed_setpoint = NAN;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +168,9 @@ public:
|
||||
const matrix::Vector3f &thrust_sp) {_velocity_setpoint_feedback = vel_sp; _thrust_setpoint_feedback = thrust_sp; }
|
||||
|
||||
protected:
|
||||
|
||||
uORB::SubscriptionData<vehicle_local_position_s> _sub_vehicle_local_position{ORB_ID(vehicle_local_position)};
|
||||
uORB::SubscriptionData<vehicle_attitude_s> _sub_attitude{ORB_ID(vehicle_attitude)};
|
||||
uORB::SubscriptionData<home_position_s> _sub_home_position{ORB_ID(home_position)};
|
||||
uORB::SubscriptionData<vehicle_local_position_s> _sub_vehicle_local_position{ORB_ID(vehicle_local_position)};
|
||||
uORB::SubscriptionData<vehicle_attitude_s> _sub_attitude{ORB_ID(vehicle_attitude)};
|
||||
uORB::SubscriptionData<home_position_s> _sub_home_position{ORB_ID(home_position)};
|
||||
|
||||
/** Reset all setpoints to NAN */
|
||||
void _resetSetpoints();
|
||||
@@ -201,18 +200,18 @@ protected:
|
||||
|
||||
/* Time abstraction */
|
||||
static constexpr uint64_t _timeout = 500000; /**< maximal time in us before a loop or data times out */
|
||||
float _time = 0; /**< passed time in seconds since the task was activated */
|
||||
float _deltatime = 0; /**< passed time in seconds since the task was last updated */
|
||||
hrt_abstime _time_stamp_activate = 0; /**< time stamp when task was activated */
|
||||
hrt_abstime _time_stamp_current = 0; /**< time stamp at the beginning of the current task update */
|
||||
hrt_abstime _time_stamp_last = 0; /**< time stamp when task was last updated */
|
||||
float _time{}; /**< passed time in seconds since the task was activated */
|
||||
float _deltatime{}; /**< passed time in seconds since the task was last updated */
|
||||
hrt_abstime _time_stamp_activate{}; /**< time stamp when task was activated */
|
||||
hrt_abstime _time_stamp_current{}; /**< time stamp at the beginning of the current task update */
|
||||
hrt_abstime _time_stamp_last{}; /**< time stamp when task was last updated */
|
||||
|
||||
/* Current vehicle state */
|
||||
matrix::Vector3f _position; /**< current vehicle position */
|
||||
matrix::Vector3f _velocity; /**< current vehicle velocity */
|
||||
float _yaw = 0.f; /**< current vehicle yaw heading */
|
||||
float _dist_to_bottom = 0.f; /**< current height above ground level */
|
||||
float _dist_to_ground = 0.f; /**< equals _dist_to_bottom if valid, height above home otherwise */
|
||||
float _yaw{}; /**< current vehicle yaw heading */
|
||||
float _dist_to_bottom{}; /**< current height above ground level */
|
||||
float _dist_to_ground{}; /**< equals _dist_to_bottom if valid, height above home otherwise */
|
||||
|
||||
/**
|
||||
* Setpoints which the position controller has to execute.
|
||||
@@ -227,20 +226,20 @@ protected:
|
||||
matrix::Vector3f _acceleration_setpoint;
|
||||
matrix::Vector3f _jerk_setpoint;
|
||||
matrix::Vector3f _thrust_setpoint;
|
||||
float _yaw_setpoint;
|
||||
float _yawspeed_setpoint;
|
||||
float _yaw_setpoint{};
|
||||
float _yawspeed_setpoint{};
|
||||
|
||||
matrix::Vector3f _velocity_setpoint_feedback;
|
||||
matrix::Vector3f _thrust_setpoint_feedback;
|
||||
|
||||
/* Counters for estimator local position resets */
|
||||
struct {
|
||||
uint8_t xy = 0;
|
||||
uint8_t vxy = 0;
|
||||
uint8_t z = 0;
|
||||
uint8_t vz = 0;
|
||||
uint8_t quat = 0;
|
||||
} _reset_counters;
|
||||
uint8_t xy;
|
||||
uint8_t vxy;
|
||||
uint8_t z;
|
||||
uint8_t vz;
|
||||
uint8_t quat;
|
||||
} _reset_counters{};
|
||||
|
||||
/**
|
||||
* Vehicle constraints.
|
||||
|
||||
Reference in New Issue
Block a user