65 _actuator_sub_0(_mavlink->add_orb_subscription(
ORB_ID(actuator_controls_0))),
67 _actuator_sub_1(_mavlink->add_orb_subscription(
ORB_ID(actuator_controls_1))),
71 _attitude_sp_sub(_mavlink->add_orb_subscription(
ORB_ID(vehicle_attitude_setpoint))),
73 _estimator_status_sub(_mavlink->add_orb_subscription(
ORB_ID(estimator_status))),
74 _estimator_status_time(0),
75 _pos_ctrl_status_sub(_mavlink->add_orb_subscription(
ORB_ID(position_controller_status))),
76 _pos_ctrl_status_time(0),
77 _geofence_sub(_mavlink->add_orb_subscription(
ORB_ID(geofence_result))),
79 _global_pos_sub(_mavlink->add_orb_subscription(
ORB_ID(vehicle_global_position))),
81 _gps_sub(_mavlink->add_orb_subscription(
ORB_ID(vehicle_gps_position))),
83 _mission_result_sub(_mavlink->add_orb_subscription(
ORB_ID(mission_result))),
84 _mission_result_time(0),
85 _status_sub(_mavlink->add_orb_subscription(
ORB_ID(vehicle_status))),
87 _status_flags_sub(_mavlink->add_orb_subscription(
ORB_ID(vehicle_status_flags))),
88 _status_flags_time(0),
89 _tecs_status_sub(_mavlink->add_orb_subscription(
ORB_ID(tecs_status))),
91 _wind_sub(_mavlink->add_orb_subscription(
ORB_ID(wind_estimate))),
116 mavlink_high_latency2_t
msg = {};
147 msg.timestamp = t / 1000;
150 msg.autopilot = MAV_AUTOPILOT_PX4;
167 if (battery_connected && battery_is_lowest) {
220 PX4_DEBUG(
"Resetting HIGH_LATENCY2 analysers");
256 msg->failure_flags |= HL_FAILURE_FLAG_DIFFERENTIAL_PRESSURE;
279 bool updated =
false;
286 if (battery.
warning > battery_status_s::BATTERY_WARNING_LOW) {
287 msg->failure_flags |= HL_FAILURE_FLAG_BATTERY;
305 msg->failure_flags |= HL_FAILURE_FLAG_ESTIMATOR;
319 uint16_t target_distance;
321 msg->target_distance = target_distance;
335 msg->failure_flags |= HL_FAILURE_FLAG_GEOFENCE;
349 msg->latitude = global_pos.
lat * 1e7;
350 msg->longitude = global_pos.
lon * 1e7;
352 int16_t altitude = 0;
354 if (global_pos.
alt > 0) {
361 msg->altitude = altitude;
389 int16_t target_altitude;
391 msg->target_altitude = target_altitude;
406 msg->failure_flags |= HL_FAILURE_FLAG_ABSOLUTE_PRESSURE;
413 msg->failure_flags |= HL_FAILURE_FLAG_3D_ACCEL;
420 msg->failure_flags |= HL_FAILURE_FLAG_3D_GYRO;
427 msg->failure_flags |= HL_FAILURE_FLAG_3D_MAG;
432 msg->failure_flags |= HL_FAILURE_FLAG_TERRAIN;
436 msg->failure_flags |= HL_FAILURE_FLAG_RC_RECEIVER;
440 msg->failure_flags |= HL_FAILURE_FLAG_ENGINE;
444 msg->failure_flags |= HL_FAILURE_FLAG_MISSION;
449 uint8_t mavlink_base_mode;
465 msg->failure_flags |= HL_FAILURE_FLAG_GPS;
469 msg->failure_flags |= HL_FAILURE_FLAG_OFFBOARD_LINK;
483 msg->wind_heading =
static_cast<uint8_t
>(
539 if (
_batteries[i].subscription->update(&battery)) {
572 if (status.
arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
607 msg.autopilot = MAV_AUTOPILOT_ENUM_END;
610 msg.custom0 = INT8_MIN;
611 msg.custom1 = INT8_MIN;
612 msg.custom2 = INT8_MIN;
615 msg.failure_flags = 0;
621 msg.target_altitude = 0;
622 msg.target_distance = 0;
623 msg.target_heading = 0;
624 msg.temperature_air = INT8_MIN;
627 msg.type = MAV_TYPE_ENUM_END;
628 msg.wind_heading = 0;
630 msg.wp_num = UINT16_MAX;
#define VEHICLE_TYPE_FIXED_WING
bool write_battery_status(mavlink_high_latency2_t *msg)
uint32_t onboard_control_sensors_enabled
hrt_abstime _last_reset_time
bool write_global_position(mavlink_high_latency2_t *msg)
void update_tecs_status()
void update_battery_status()
static struct vehicle_status_s status
MavlinkOrbSubscription * _airspeed_sub
API for the uORB lightweight object broker.
Definition of geo / math functions to perform geodesic calculations.
bool write_vehicle_status(mavlink_high_latency2_t *msg)
bool write_mission_result(mavlink_high_latency2_t *msg)
void update_wind_estimate()
MavlinkOrbSubscription * _wind_sub
float air_temperature_celsius
MavlinkStreamHighLatency2(MavlinkStreamHighLatency2 &)
MavlinkOrbSubscription * _global_pos_sub
uint64_t _pos_ctrl_status_time
uint16_t filter_fault_flags
uint64_t _mission_result_time
SimpleAnalyzer _windspeed
bool condition_global_position_valid
bool write_tecs_status(mavlink_high_latency2_t *msg)
constexpr T degrees(T radians)
bool offboard_control_signal_found_once
void update_global_position()
bool write_airspeed(mavlink_high_latency2_t *msg)
Type wrap_2pi(Type x)
Wrap value in range [0, 2π)
PerBatteryData _batteries[ORB_MULTI_MAX_INSTANCES]
void reset()
Reset the analyzer to the initial state.
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
MavlinkOrbSubscription * _actuator_sub_0
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
float get_scaled(float scalingfactor) const
Get the scaled value of the current result of the analyzer.
SimpleAnalyzer _groundspeed
MavlinkOrbSubscription * _gps_sub
void get_mavlink_navigation_mode(const struct vehicle_status_s *const status, uint8_t *mavlink_base_mode, union px4_custom_mode *custom_mode)
SimpleAnalyzer _airspeed_sp
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
bool offboard_control_signal_lost
MavlinkOrbSubscription * _estimator_status_sub
float indicated_airspeed_m_s
bool update(uint64_t *time, void *data)
Check if subscription updated based on timestamp.
MavlinkOrbSubscription * _attitude_sp_sub
MavlinkOrbSubscription * _pos_ctrl_status_sub
mavlink_channel_t get_channel() const
MavlinkOrbSubscription * _actuator_sub_1
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
hrt_abstime _last_update_time
void update_vehicle_status()
bool write_fw_ctrl_status(mavlink_high_latency2_t *msg)
bool write_attitude_sp(mavlink_high_latency2_t *msg)
bool write_vehicle_status_flags(mavlink_high_latency2_t *msg)
MavlinkOrbSubscription * _status_sub
MavlinkOrbSubscription * _tecs_status_sub
bool valid() const
Returns true if at least one value has been added to the analyzer.
uint64_t _estimator_status_time
float _update_rate_filtered
void update_data()
Function to collect/update data for the streams at a high rate independant of actual stream rate...
MavlinkOrbSubscription * _geofence_sub
uint32_t onboard_control_sensors_health
SimpleAnalyzer _temperature
bool write_estimator_status(mavlink_high_latency2_t *msg)
#define ORB_MULTI_MAX_INSTANCES
Maximum number of multi topic instances.
MavlinkOrbSubscription * _mission_result_sub
MavlinkOrbSubscription * add_orb_subscription(const orb_id_t topic, int instance=0, bool disable_sharing=false)
Add a mavlink orb topic subscription while ensuring that only a single object exists for a given topi...
MavlinkOrbSubscription * subscription
SimpleAnalyzer _climb_rate
uint16_t gps_check_fail_flags
bool write_geofence_result(mavlink_high_latency2_t *msg)
void reset_analysers(const hrt_abstime t)
uint64_t _attitude_sp_time
MavlinkOrbSubscription * _status_flags_sub
uint64_t _global_pos_time
void set_default_values(mavlink_high_latency2_t &msg) const
void convert_limit_safe(float in, uint16_t &out)
bool send(const hrt_abstime t)
unsigned get_system_type()
uint64_t _status_flags_time
uint16_t innovation_check_flags
void reset_last_sent()
Reset the time of last sent to 0.
bool write_wind_estimate(mavlink_high_latency2_t *msg)
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
void add_value(float val, float update_rate)
Add a new value to the analyzer and update the result according to the mode.