53 return status_changed;
74 bool attitude_is_stabilized{
false};
75 const uint8_t vehicle_type = vehicle_status.
vehicle_type;
76 const uint8_t nav_state = vehicle_status.
nav_state;
78 if (vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
79 attitude_is_stabilized = nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO &&
80 nav_state != vehicle_status_s::NAVIGATION_STATE_RATTITUDE;
83 attitude_is_stabilized = nav_state != vehicle_status_s::NAVIGATION_STATE_MANUAL &&
84 nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO &&
85 nav_state != vehicle_status_s::NAVIGATION_STATE_RATTITUDE;
88 return attitude_is_stabilized;
97 if (_sub_vehicule_attitude.update(&attitude)) {
100 const float roll(euler.
phi());
101 const float pitch(euler.
theta());
103 const float max_roll_deg = _param_fd_fail_r.get();
104 const float max_pitch_deg = _param_fd_fail_p.get();
108 const bool roll_status = (max_roll > 0.0f) && (fabsf(roll) > max_roll);
109 const bool pitch_status = (max_pitch > 0.0f) && (fabsf(pitch) > max_pitch);
#define VEHICLE_TYPE_FIXED_WING
Base class for failure detection logic based on vehicle states for failsafe triggering.
systemlib::Hysteresis _pitch_failure_hysteresis
void set_state_and_update(const bool new_state, const hrt_abstime &now_us)
constexpr T radians(T degrees)
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
DEFINE_PARAMETERS((ParamInt< px4::params::FD_FAIL_P >) _param_fd_fail_p,(ParamInt< px4::params::FD_FAIL_R >) _param_fd_fail_r,(ParamFloat< px4::params::FD_FAIL_R_TTRI >) _param_fd_fail_r_ttri,(ParamFloat< px4::params::FD_FAIL_P_TTRI >) _param_fd_fail_p_ttri) uORB uint8_t _status
bool updateAttitudeStatus()
void set_hysteresis_time_from(const bool from_state, const hrt_abstime new_hysteresis_time_us)
bool isAttitudeStabilized(const vehicle_status_s &vehicle_status)
FailureDetector(ModuleParams *parent)
bool update(const vehicle_status_s &vehicle_status)
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
systemlib::Hysteresis _roll_failure_hysteresis