54 #include <px4_platform_common/time.h> 119 uint8_t *mavlink_base_mode, uint32_t *mavlink_custom_mode);
127 }
else if (m > 655.35
f) {
131 return (uint16_t)(m * 100.0f);
137 custom_mode->
data = 0;
138 *mavlink_base_mode = 0;
141 if (status->
hil_state == vehicle_status_s::HIL_STATE_ON) {
142 *mavlink_base_mode |= MAV_MODE_FLAG_HIL_ENABLED;
146 if (status->
arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
147 *mavlink_base_mode |= MAV_MODE_FLAG_SAFETY_ARMED;
151 *mavlink_base_mode |= MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
153 const uint8_t auto_mode_flags = MAV_MODE_FLAG_AUTO_ENABLED
154 | MAV_MODE_FLAG_STABILIZE_ENABLED
155 | MAV_MODE_FLAG_GUIDED_ENABLED;
158 case vehicle_status_s::NAVIGATION_STATE_MANUAL:
159 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
160 | (status->
vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING ? MAV_MODE_FLAG_STABILIZE_ENABLED : 0);
164 case vehicle_status_s::NAVIGATION_STATE_ACRO:
165 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED;
169 case vehicle_status_s::NAVIGATION_STATE_RATTITUDE:
170 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED;
174 case vehicle_status_s::NAVIGATION_STATE_STAB:
175 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
176 | MAV_MODE_FLAG_STABILIZE_ENABLED;
180 case vehicle_status_s::NAVIGATION_STATE_ALTCTL:
181 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
182 | MAV_MODE_FLAG_STABILIZE_ENABLED;
186 case vehicle_status_s::NAVIGATION_STATE_POSCTL:
187 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
188 | MAV_MODE_FLAG_STABILIZE_ENABLED
189 | MAV_MODE_FLAG_GUIDED_ENABLED;
193 case vehicle_status_s::NAVIGATION_STATE_ORBIT:
194 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
195 | MAV_MODE_FLAG_STABILIZE_ENABLED
196 | MAV_MODE_FLAG_GUIDED_ENABLED;
201 case vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF:
202 *mavlink_base_mode |= auto_mode_flags;
207 case vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION:
208 *mavlink_base_mode |= auto_mode_flags;
213 case vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER:
214 *mavlink_base_mode |= auto_mode_flags;
219 case vehicle_status_s::NAVIGATION_STATE_AUTO_FOLLOW_TARGET:
220 *mavlink_base_mode |= auto_mode_flags;
225 case vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND:
226 *mavlink_base_mode |= auto_mode_flags;
231 case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL:
234 case vehicle_status_s::NAVIGATION_STATE_AUTO_RCRECOVER:
235 *mavlink_base_mode |= auto_mode_flags;
240 case vehicle_status_s::NAVIGATION_STATE_AUTO_LAND:
241 case vehicle_status_s::NAVIGATION_STATE_AUTO_LANDENGFAIL:
242 case vehicle_status_s::NAVIGATION_STATE_AUTO_LANDGPSFAIL:
245 case vehicle_status_s::NAVIGATION_STATE_DESCEND:
246 *mavlink_base_mode |= auto_mode_flags;
251 case vehicle_status_s::NAVIGATION_STATE_AUTO_RTGS:
252 *mavlink_base_mode |= auto_mode_flags;
257 case vehicle_status_s::NAVIGATION_STATE_TERMINATION:
258 *mavlink_base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED;
262 case vehicle_status_s::NAVIGATION_STATE_OFFBOARD:
263 *mavlink_base_mode |= auto_mode_flags;
267 case vehicle_status_s::NAVIGATION_STATE_MAX:
275 uint8_t *mavlink_base_mode, uint32_t *mavlink_custom_mode)
278 *mavlink_base_mode = 0;
279 *mavlink_custom_mode = 0;
283 *mavlink_custom_mode = custom_mode.
data;
286 if (status->
arming_state == vehicle_status_s::ARMING_STATE_INIT
287 || status->
arming_state == vehicle_status_s::ARMING_STATE_IN_AIR_RESTORE
288 || status->
arming_state == vehicle_status_s::ARMING_STATE_STANDBY_ERROR) {
289 *mavlink_state = MAV_STATE_UNINIT;
291 }
else if (status->
arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
292 *mavlink_state = MAV_STATE_ACTIVE;
294 }
else if (status->
arming_state == vehicle_status_s::ARMING_STATE_STANDBY) {
295 *mavlink_state = MAV_STATE_STANDBY;
297 }
else if (status->
arming_state == vehicle_status_s::ARMING_STATE_SHUTDOWN) {
298 *mavlink_state = MAV_STATE_POWEROFF;
301 *mavlink_state = MAV_STATE_CRITICAL;
321 return MAVLINK_MSG_ID_HEARTBEAT;
336 return MAVLINK_MSG_ID_HEARTBEAT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
353 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status)))
361 if (!_status_sub->
update(&status)) {
363 memset(&status, 0,
sizeof(status));
366 uint8_t base_mode = 0;
367 uint32_t custom_mode = 0;
368 uint8_t system_status = 0;
372 base_mode, custom_mode, system_status);
393 return MAVLINK_MSG_ID_STATUSTEXT;
408 return _mavlink->
get_logbuffer()->empty() ? 0 : (MAVLINK_MSG_ID_STATUSTEXT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES);
428 mavlink_statustext_t
msg;
429 msg.severity = mavlink_log.
severity;
430 strncpy(msg.text, (
const char *)mavlink_log.
text,
sizeof(msg.text));
431 msg.text[
sizeof(msg.text) - 1] =
'\0';
453 return "COMMAND_LONG";
458 return MAVLINK_MSG_ID_COMMAND_LONG;
485 _cmd_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_command), 0, true))
527 return MAVLINK_MSG_ID_SYS_STATUS;
542 return MAVLINK_MSG_ID_SYS_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
550 uint64_t _status_timestamp{0};
551 uint64_t _cpuload_timestamp{0};
560 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status))),
565 _battery_status_timestamp[i] = 0;
575 const bool updated_status = _status_sub->
update(&_status_timestamp, &
status);
576 const bool updated_cpuload = _cpuload_sub->
update(&_cpuload_timestamp, &
cpuload);
578 bool updated_battery =
false;
582 updated_battery =
true;
586 if (updated_status || updated_cpuload || updated_battery) {
587 int lowest_battery_index = 0;
591 lowest_battery_index = i;
595 mavlink_sys_status_t
msg{};
613 msg.battery_remaining = ceilf(lowest_battery.
remaining * 100.0f);
616 msg.voltage_battery = UINT16_MAX;
617 msg.current_battery = -1;
618 msg.battery_remaining = -1;
640 return "BATTERY_STATUS";
645 return MAVLINK_MSG_ID_BATTERY_STATUS;
660 return MAVLINK_MSG_ID_BATTERY_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
682 bool updated =
false;
686 if (!_battery_status_sub[i]) {
694 mavlink_battery_status_t bat_msg{};
696 bat_msg.battery_function = MAV_BATTERY_FUNCTION_ALL;
697 bat_msg.type = MAV_BATTERY_TYPE_LIPO;
699 bat_msg.energy_consumed = -1;
704 case (battery_status_s::BATTERY_WARNING_NONE):
705 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_OK;
708 case (battery_status_s::BATTERY_WARNING_LOW):
709 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_LOW;
712 case (battery_status_s::BATTERY_WARNING_CRITICAL):
713 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_CRITICAL;
716 case (battery_status_s::BATTERY_WARNING_EMERGENCY):
717 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_EMERGENCY;
720 case (battery_status_s::BATTERY_WARNING_FAILED):
721 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_FAILED;
725 bat_msg.charge_state = MAV_BATTERY_CHARGE_STATE_UNDEFINED;
734 bat_msg.temperature = INT16_MAX;
737 static constexpr
int mavlink_cells_max = (
sizeof(bat_msg.voltages) /
sizeof(bat_msg.voltages[0]));
739 for (
int cell = 0; cell < mavlink_cells_max; cell++) {
744 bat_msg.voltages[cell] = UINT16_MAX;
769 return "HIGHRES_IMU";
774 return MAVLINK_MSG_ID_HIGHRES_IMU;
789 return MAVLINK_MSG_ID_HIGHRES_IMU_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
813 _sensor_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_combined))),
816 _differential_pressure_sub(
_mavlink->add_orb_subscription(
ORB_ID(differential_pressure))),
817 _magnetometer_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_magnetometer))),
818 _air_data_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_air_data))),
830 if (_sensor_sub->
update(&_sensor_time, &sensor)) {
831 uint16_t fields_updated = 0;
835 fields_updated |= (1 << 0) | (1 << 1) | (1 << 2);
839 if (_gyro_timestamp != sensor.
timestamp) {
841 fields_updated |= (1 << 3) | (1 << 4) | (1 << 5);
846 _magnetometer_sub->
update(&magnetometer);
848 if (_mag_timestamp != magnetometer.
timestamp) {
850 fields_updated |= (1 << 6) | (1 << 7) | (1 << 8);
855 _air_data_sub->
update(&air_data);
857 if (_baro_timestamp != air_data.
timestamp) {
859 fields_updated |= (1 << 9) | (1 << 11) | (1 << 12);
867 _differential_pressure_sub->
update(&differential_pressure);
869 if (_dpres_timestamp != differential_pressure.
timestamp) {
871 fields_updated |= (1 << 10);
872 _dpres_timestamp = differential_pressure.
timestamp;
875 mavlink_highres_imu_t
msg = {};
891 msg.fields_updated = fields_updated;
918 return MAVLINK_MSG_ID_SCALED_IMU;
933 return _raw_accel_sub->is_published() ? (MAVLINK_MSG_ID_SCALED_IMU_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
951 _raw_accel_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_accel), 0)),
952 _raw_gyro_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_gyro), 0)),
953 _raw_mag_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_mag), 0)),
965 bool updated =
false;
966 updated |= _raw_accel_sub->
update(&_raw_accel_time, &sensor_accel);
967 updated |= _raw_gyro_sub->
update(&_raw_gyro_time, &sensor_gyro);
968 updated |= _raw_mag_sub->
update(&_raw_mag_time, &sensor_mag);
972 mavlink_scaled_imu_t
msg = {};
974 msg.time_boot_ms = sensor_accel.
timestamp / 1000;
978 msg.xgyro = sensor_gyro.
x_raw;
979 msg.ygyro = sensor_gyro.
y_raw;
980 msg.zgyro = sensor_gyro.
z_raw;
981 msg.xmag = sensor_mag.
x_raw;
982 msg.ymag = sensor_mag.
y_raw;
983 msg.zmag = sensor_mag.
z_raw;
1005 return "SCALED_IMU2";
1010 return MAVLINK_MSG_ID_SCALED_IMU2;
1025 return _raw_accel_sub->is_published() ? (MAVLINK_MSG_ID_SCALED_IMU2_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
1043 _raw_accel_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_accel), 1)),
1044 _raw_gyro_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_gyro), 1)),
1045 _raw_mag_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_mag), 1)),
1057 bool updated =
false;
1058 updated |= _raw_accel_sub->
update(&_raw_accel_time, &sensor_accel);
1059 updated |= _raw_gyro_sub->
update(&_raw_gyro_time, &sensor_gyro);
1060 updated |= _raw_mag_sub->
update(&_raw_mag_time, &sensor_mag);
1064 mavlink_scaled_imu2_t
msg = {};
1066 msg.time_boot_ms = sensor_accel.
timestamp / 1000;
1070 msg.xgyro = sensor_gyro.
x_raw;
1071 msg.ygyro = sensor_gyro.
y_raw;
1072 msg.zgyro = sensor_gyro.
z_raw;
1073 msg.xmag = sensor_mag.
x_raw;
1074 msg.ymag = sensor_mag.
y_raw;
1075 msg.zmag = sensor_mag.
z_raw;
1096 return "SCALED_IMU3";
1101 return MAVLINK_MSG_ID_SCALED_IMU3;
1116 return _raw_accel_sub->is_published() ? (MAVLINK_MSG_ID_SCALED_IMU3_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
1134 _raw_accel_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_accel), 2)),
1135 _raw_gyro_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_gyro), 2)),
1136 _raw_mag_sub(
_mavlink->add_orb_subscription(
ORB_ID(sensor_mag), 2)),
1148 bool updated =
false;
1149 updated |= _raw_accel_sub->
update(&_raw_accel_time, &sensor_accel);
1150 updated |= _raw_gyro_sub->
update(&_raw_gyro_time, &sensor_gyro);
1151 updated |= _raw_mag_sub->
update(&_raw_mag_time, &sensor_mag);
1155 mavlink_scaled_imu3_t
msg = {};
1157 msg.time_boot_ms = sensor_accel.
timestamp / 1000;
1161 msg.xgyro = sensor_gyro.
x_raw;
1162 msg.ygyro = sensor_gyro.
y_raw;
1163 msg.zgyro = sensor_gyro.
z_raw;
1164 msg.xmag = sensor_mag.
x_raw;
1165 msg.ymag = sensor_mag.
y_raw;
1166 msg.zmag = sensor_mag.
z_raw;
1193 return MAVLINK_MSG_ID_ATTITUDE;
1208 return MAVLINK_MSG_ID_ATTITUDE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1214 uint64_t _att_time{0};
1223 _att_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_attitude))),
1224 _angular_velocity_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_angular_velocity)))
1231 if (_att_sub->
update(&_att_time, &att)) {
1233 _angular_velocity_sub->
update(&angular_velocity);
1235 mavlink_attitude_t
msg{};
1243 msg.rollspeed = angular_velocity.xyz[0];
1244 msg.pitchspeed = angular_velocity.xyz[1];
1245 msg.yawspeed = angular_velocity.xyz[2];
1267 return "ATTITUDE_QUATERNION";
1272 return MAVLINK_MSG_ID_ATTITUDE_QUATERNION;
1287 return MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1294 uint64_t _att_time{0};
1302 _att_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_attitude))),
1303 _angular_velocity_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_angular_velocity))),
1304 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status)))
1311 if (_att_sub->
update(&_att_time, &att)) {
1313 _angular_velocity_sub->
update(&angular_velocity);
1318 mavlink_attitude_quaternion_t
msg{};
1325 msg.rollspeed = angular_velocity.xyz[0];
1326 msg.pitchspeed = angular_velocity.xyz[1];
1327 msg.yawspeed = angular_velocity.xyz[2];
1340 msg.repr_offset_q[0] = 0.0f;
1341 msg.repr_offset_q[1] = 0.0f;
1342 msg.repr_offset_q[2] = 0.0f;
1343 msg.repr_offset_q[3] = 0.0f;
1371 return MAVLINK_MSG_ID_VFR_HUD;
1386 return MAVLINK_MSG_ID_VFR_HUD_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1410 _pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position))),
1412 _armed_sub(
_mavlink->add_orb_subscription(
ORB_ID(actuator_armed))),
1414 _act0_sub(
_mavlink->add_orb_subscription(
ORB_ID(actuator_controls_0))),
1415 _act1_sub(
_mavlink->add_orb_subscription(
ORB_ID(actuator_controls_1))),
1418 _air_data_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_air_data)))
1427 bool updated =
false;
1428 updated |= _pos_sub->
update(&_pos_time, &pos);
1429 updated |= _armed_sub->
update(&_armed_time, &armed);
1430 updated |= _airspeed_sub->
update(&_airspeed_time, &airspeed);
1433 mavlink_vfr_hud_t
msg = {};
1435 msg.groundspeed = sqrtf(pos.
vx * pos.
vx + pos.
vy * pos.
vy);
1441 _act0_sub->
update(&act0);
1442 _act1_sub->
update(&act1);
1450 act0.
control[actuator_controls_s::INDEX_THROTTLE],
1451 act1.
control[actuator_controls_s::INDEX_THROTTLE]);
1454 msg.throttle = 0.0f;
1463 _air_data_sub->
update(&air_data);
1472 msg.climb = -pos.
vz;
1495 return "GPS_RAW_INT";
1500 return MAVLINK_MSG_ID_GPS_RAW_INT;
1515 return MAVLINK_MSG_ID_GPS_RAW_INT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1528 _gps_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_gps_position))),
1536 if (_gps_sub->
update(&_gps_time, &gps)) {
1537 mavlink_gps_raw_int_t
msg = {};
1545 msg.eph = gps.
hdop * 100;
1546 msg.epv = gps.
vdop * 100;
1547 msg.h_acc = gps.
eph * 1e3f;
1548 msg.v_acc = gps.
epv * 1e3f;
1579 return MAVLINK_MSG_ID_GPS2_RAW;
1594 return (_gps_time > 0) ? (MAVLINK_MSG_ID_GPS2_RAW_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
1607 _gps_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_gps_position), 1)),
1615 if (_gps_sub->
update(&_gps_time, &gps)) {
1616 mavlink_gps2_raw_t
msg = {};
1623 msg.eph = gps.
eph * 1e3f;
1624 msg.epv = gps.
epv * 1e3f;
1650 return "SYSTEM_TIME";
1655 return MAVLINK_MSG_ID_SYSTEM_TIME;
1670 return MAVLINK_MSG_ID_SYSTEM_TIME_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1684 mavlink_system_time_t
msg = {};
1687 px4_clock_gettime(CLOCK_REALTIME, &tv);
1690 msg.time_unix_usec = (uint64_t)tv.tv_sec * 1000000 + tv.tv_nsec / 1000;
1694 if (msg.time_unix_usec > 978307200000000) {
1718 return MAVLINK_MSG_ID_TIMESYNC;
1733 return MAVLINK_MSG_ID_TIMESYNC_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
1747 mavlink_timesync_t
msg = {};
1768 return "ADSB_VEHICLE";
1773 return MAVLINK_MSG_ID_ADSB_VEHICLE;
1793 return (_pos_time > 0) ? MAVLINK_MSG_ID_ADSB_VEHICLE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
1806 _pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(transponder_report))),
1815 while (_pos_sub->
update(&_pos_time, &pos)) {
1816 mavlink_adsb_vehicle_t
msg = {};
1818 if (!(pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_RETRANSLATE)) {
continue; }
1821 msg.lat = pos.
lat * 1e7;
1822 msg.lon = pos.
lon * 1e7;
1824 msg.altitude = pos.
altitude * 1e3f;
1828 memcpy(&msg.callsign[0], &pos.
callsign[0],
sizeof(msg.callsign));
1830 msg.tslc = pos.
tslc;
1835 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_COORDS) { msg.flags |= ADSB_FLAGS_VALID_COORDS; }
1837 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_ALTITUDE) { msg.flags |= ADSB_FLAGS_VALID_ALTITUDE; }
1839 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_HEADING) { msg.flags |= ADSB_FLAGS_VALID_HEADING; }
1841 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_VELOCITY) { msg.flags |= ADSB_FLAGS_VALID_VELOCITY; }
1843 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_CALLSIGN) { msg.flags |= ADSB_FLAGS_VALID_CALLSIGN; }
1845 if (pos.
flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_SQUAWK) { msg.flags |= ADSB_FLAGS_VALID_SQUAWK; }
1865 return "UTM_GLOBAL_POSITION";
1870 return MAVLINK_MSG_ID_UTM_GLOBAL_POSITION;
1890 return _local_pos_time > 0 ? MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
1895 uint64_t _local_pos_time = 0;
1899 uint64_t _global_pos_time = 0;
1903 uint64_t _setpoint_triplet_time = 0;
1907 uint64_t _vehicle_status_time = 0;
1911 uint64_t _land_detected_time = 0;
1920 _local_pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position))),
1921 _global_pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_global_position))),
1922 _position_setpoint_triplet_sub(
_mavlink->add_orb_subscription(
ORB_ID(position_setpoint_triplet))),
1923 _vehicle_status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status))),
1924 _land_detected_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_land_detected)))
1931 _local_pos_sub->
update(&_local_pos_time, &_local_position);
1932 _global_pos_sub->
update(&_global_pos_time, &_global_position);
1933 _position_setpoint_triplet_sub->
update(&_setpoint_triplet_time, &_setpoint_triplet);
1934 _vehicle_status_sub->
update(&_vehicle_status_time, &_vehicle_status);
1935 _land_detected_sub->
update(&_land_detected_time, &_land_detected);
1937 mavlink_utm_global_position_t
msg = {};
1941 px4_clock_gettime(CLOCK_REALTIME, &tv);
1942 uint64_t unix_epoch = (uint64_t)tv.tv_sec * 1000000 + tv.tv_nsec / 1000;
1945 if (unix_epoch > 978307200000000) {
1946 msg.time = unix_epoch;
1947 msg.flags |= UTM_DATA_AVAIL_FLAGS_TIME_VALID;
1950 #ifndef BOARD_HAS_NO_UUID 1951 px4_guid_t px4_guid;
1952 board_get_px4_guid(px4_guid);
1953 static_assert(
sizeof(px4_guid_t) ==
sizeof(msg.uas_id),
"GUID byte length mismatch");
1954 memcpy(&msg.uas_id, &px4_guid,
sizeof(msg.uas_id));
1955 msg.flags |= UTM_DATA_AVAIL_FLAGS_UAS_ID_AVAILABLE;
1958 memset(&msg.uas_id[0], 0,
sizeof(msg.uas_id));
1962 if (_global_pos_time > 0) {
1963 msg.lat = _global_position.
lat * 1e7;
1964 msg.lon = _global_position.
lon * 1e7;
1967 msg.h_acc = _global_position.
eph * 1000.0f;
1968 msg.v_acc = _global_position.
epv * 1000.0f;
1970 msg.flags |= UTM_DATA_AVAIL_FLAGS_POSITION_AVAILABLE;
1971 msg.flags |= UTM_DATA_AVAIL_FLAGS_ALTITUDE_AVAILABLE;
1975 if (_local_pos_time > 0) {
1980 msg.vx = _local_position.
vx * 100.0f;
1981 msg.vy = _local_position.
vy * 100.0f;
1982 evh = _local_position.
evh;
1983 msg.flags |= UTM_DATA_AVAIL_FLAGS_HORIZONTAL_VELO_AVAILABLE;
1987 msg.vz = _local_position.
vz * 100.0f;
1988 evv = _local_position.
evv;
1989 msg.flags |= UTM_DATA_AVAIL_FLAGS_VERTICAL_VELO_AVAILABLE;
1992 msg.vel_acc = sqrtf(evh * evh + evv * evv) * 100.0f;
1995 msg.relative_alt = _local_position.
dist_bottom * 1000.0f;
1996 msg.flags |= UTM_DATA_AVAIL_FLAGS_RELATIVE_ALTITUDE_AVAILABLE;
2000 bool vehicle_in_auto_mode = _vehicle_status_time > 0
2001 && (_vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_FOLLOW_TARGET
2002 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTGS
2003 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND
2004 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LANDENGFAIL
2005 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND
2006 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION
2007 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER
2008 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF
2009 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL
2010 || _vehicle_status.
nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RCRECOVER);
2013 if (vehicle_in_auto_mode && _setpoint_triplet_time > 0 && _setpoint_triplet.
current.
valid) {
2014 msg.next_lat = _setpoint_triplet.
current.
lat * 1e7;
2015 msg.next_lon = _setpoint_triplet.
current.
lon * 1e7;
2019 msg.flags |= UTM_DATA_AVAIL_FLAGS_NEXT_WAYPOINT_AVAILABLE;
2023 if (_vehicle_status_time > 0 && _land_detected_time > 0
2024 && _vehicle_status.
arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
2025 if (_land_detected.
landed) {
2026 msg.flight_state |= UTM_FLIGHT_STATE_GROUND;
2029 msg.flight_state |= UTM_FLIGHT_STATE_AIRBORNE;
2033 msg.flight_state |= UTM_FLIGHT_STATE_UNKNOWN;
2036 msg.update_rate = 0;
2059 return MAVLINK_MSG_ID_COLLISION;
2074 return (_collision_time > 0) ? MAVLINK_MSG_ID_COLLISION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
2087 _collision_sub(
_mavlink->add_orb_subscription(
ORB_ID(collision_report))),
2096 while (_collision_sub->
update(&_collision_time, &report)) {
2097 mavlink_collision_t
msg = {};
2099 msg.src = report.
src;
2101 msg.action = report.
action;
2125 return "CAMERA_TRIGGER";
2130 return MAVLINK_MSG_ID_CAMERA_TRIGGER;
2150 return (_trigger_time > 0) ? MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
2171 if (_trigger_sub->
update(&_trigger_time, &trigger)) {
2172 mavlink_camera_trigger_t
msg = {};
2175 msg.seq = trigger.
seq;
2188 vcmd.param5 = (double)NAN;
2189 vcmd.param6 = (double)NAN;
2191 vcmd.command = MAV_CMD_IMAGE_START_CAPTURE;
2193 vcmd.target_component = MAV_COMP_ID_CAMERA;
2199 mavlink_command_long_t digicam_ctrl_cmd = {};
2201 digicam_ctrl_cmd.target_system = 0;
2202 digicam_ctrl_cmd.target_component = MAV_COMP_ID_CAMERA;
2203 digicam_ctrl_cmd.command = MAV_CMD_DO_DIGICAM_CONTROL;
2204 digicam_ctrl_cmd.confirmation = 0;
2205 digicam_ctrl_cmd.param1 = NAN;
2206 digicam_ctrl_cmd.param2 = NAN;
2207 digicam_ctrl_cmd.param3 = NAN;
2208 digicam_ctrl_cmd.param4 = NAN;
2209 digicam_ctrl_cmd.param5 = 1;
2210 digicam_ctrl_cmd.param6 = NAN;
2211 digicam_ctrl_cmd.param7 = NAN;
2233 return "CAMERA_IMAGE_CAPTURED";
2238 return MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED;
2258 return (_capture_time > 0) ? MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
2279 if (_capture_sub->
update(&_capture_time, &capture)) {
2281 mavlink_camera_image_captured_t
msg;
2283 msg.time_boot_ms = capture.
timestamp / 1000;
2286 msg.lat = capture.
lat * 1e7;
2287 msg.lon = capture.
lon * 1e7;
2288 msg.alt = capture.
alt * 1e3f;
2290 msg.q[0] = capture.
q[0];
2291 msg.q[1] = capture.
q[1];
2292 msg.q[2] = capture.
q[2];
2293 msg.q[3] = capture.
q[3];
2294 msg.image_index = capture.
seq;
2295 msg.capture_result = capture.
result;
2296 msg.file_url[0] =
'\0';
2317 return "GLOBAL_POSITION_INT";
2322 return MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
2337 return MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
2356 _gpos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_global_position))),
2358 _lpos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position))),
2360 _home_sub(
_mavlink->add_orb_subscription(
ORB_ID(home_position))),
2361 _air_data_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_air_data)))
2369 bool gpos_updated = _gpos_sub->
update(&_gpos_time, &gpos);
2370 bool lpos_updated = _lpos_sub->
update(&_lpos_time, &lpos);
2372 if (gpos_updated && lpos_updated) {
2373 mavlink_global_position_int_t
msg = {};
2376 msg.alt = (-lpos.
z + lpos.
ref_alt) * 1000.0
f;
2381 _air_data_sub->
update(&air_data);
2389 _home_sub->
update(&home);
2393 msg.relative_alt = -(lpos.
z - home.
z) * 1000.0
f;
2396 msg.relative_alt = msg.alt - (home.
alt * 1000.0f);
2401 msg.relative_alt = -lpos.
z * 1000.0f;
2405 msg.time_boot_ms = gpos.
timestamp / 1000;
2406 msg.lat = gpos.
lat * 1e7;
2407 msg.lon = gpos.
lon * 1e7;
2409 msg.vx = lpos.
vx * 100.0f;
2410 msg.vy = lpos.
vy * 100.0f;
2411 msg.vz = lpos.
vz * 100.0f;
2439 return MAVLINK_MSG_ID_ODOMETRY;
2454 return (_odom_time > 0) ? MAVLINK_MSG_ID_ODOMETRY_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
2470 _odom_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_odometry))),
2472 _vodom_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_visual_odometry))),
2480 bool odom_updated =
false;
2482 mavlink_odometry_t
msg = {};
2485 odom_updated = _vodom_sub->
update(&_vodom_time, &odom);
2487 msg.frame_id = MAV_FRAME_VISION_NED;
2490 odom_updated = _odom_sub->
update(&_odom_time, &odom);
2492 msg.frame_id = MAV_FRAME_ESTIM_NED;
2497 msg.child_frame_id = MAV_FRAME_BODY_FRD;
2505 msg.q[0] = odom.
q[0];
2506 msg.q[1] = odom.
q[1];
2507 msg.q[2] = odom.
q[2];
2508 msg.q[3] = odom.
q[3];
2517 msg.vx = linvel_body(0);
2518 msg.vy = linvel_body(1);
2519 msg.vz = linvel_body(2);
2530 static_assert(POS_URT_SIZE == (
sizeof(msg.pose_covariance) /
sizeof(msg.pose_covariance[0])),
2531 "Odometry Pose Covariance matrix URT array size mismatch");
2535 static_assert(VEL_URT_SIZE == (
sizeof(msg.velocity_covariance) /
sizeof(msg.velocity_covariance[0])),
2536 "Odometry Velocity Covariance matrix URT array size mismatch");
2539 for (
size_t i = 0; i < POS_URT_SIZE; i++) {
2545 for (
size_t i = 0; i < VEL_URT_SIZE; i++) {
2569 return "LOCAL_POSITION_NED";
2574 return MAVLINK_MSG_ID_LOCAL_POSITION_NED;
2589 return MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
2602 _pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position))),
2610 if (_pos_sub->
update(&_pos_time, &pos)) {
2611 mavlink_local_position_ned_t
msg = {};
2613 msg.time_boot_ms = pos.
timestamp / 1000;
2640 return "ESTIMATOR_STATUS";
2645 return MAVLINK_MSG_ID_VIBRATION;
2660 return MAVLINK_MSG_ID_VIBRATION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
2673 _est_sub(
_mavlink->add_orb_subscription(
ORB_ID(estimator_status))),
2681 if (_est_sub->
update(&_est_time, &est)) {
2683 mavlink_estimator_status_t est_msg = {};
2697 mavlink_vibration_t
msg = {};
2699 msg.vibration_x = est.
vibe[0];
2700 msg.vibration_y = est.
vibe[1];
2701 msg.vibration_z = est.
vibe[2];
2721 return "ATT_POS_MOCAP";
2726 return MAVLINK_MSG_ID_ATT_POS_MOCAP;
2741 return MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
2754 _mocap_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_mocap_odometry))),
2762 if (_mocap_sub->
update(&_mocap_time, &mocap)) {
2763 mavlink_att_pos_mocap_t
msg = {};
2766 msg.q[0] = mocap.
q[0];
2767 msg.q[1] = mocap.
q[1];
2768 msg.q[2] = mocap.
q[2];
2769 msg.q[3] = mocap.
q[3];
2794 return "HOME_POSITION";
2799 return MAVLINK_MSG_ID_HOME_POSITION;
2814 return _home_sub->is_published() ? (MAVLINK_MSG_ID_HOME_POSITION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
2836 if (_home_sub->
update(&home)) {
2838 mavlink_home_position_t
msg;
2840 msg.latitude = home.
lat * 1e7;
2841 msg.longitude = home.
lon * 1e7;
2842 msg.altitude = home.
alt * 1e3f;
2854 msg.approach_x = 0.0f;
2855 msg.approach_y = 0.0f;
2856 msg.approach_z = 0.0f;
2883 return MAVLINK_MSG_ID_SERVO_OUTPUT_RAW;
2895 return "SERVO_OUTPUT_RAW_0";
2898 return "SERVO_OUTPUT_RAW_1";
2909 return MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
2922 _act_sub(
_mavlink->add_orb_subscription(
ORB_ID(actuator_outputs), N)),
2930 if (_act_sub->
update(&_act_time, &act)) {
2931 mavlink_servo_output_raw_t
msg = {};
2933 static_assert(
sizeof(act.
output) /
sizeof(act.
output[0]) >= 16,
"mavlink message requires at least 16 outputs");
2937 msg.servo1_raw = act.
output[0];
2938 msg.servo2_raw = act.
output[1];
2939 msg.servo3_raw = act.
output[2];
2940 msg.servo4_raw = act.
output[3];
2941 msg.servo5_raw = act.
output[4];
2942 msg.servo6_raw = act.
output[5];
2943 msg.servo7_raw = act.
output[6];
2944 msg.servo8_raw = act.
output[7];
2945 msg.servo9_raw = act.
output[8];
2946 msg.servo10_raw = act.
output[9];
2947 msg.servo11_raw = act.
output[10];
2948 msg.servo12_raw = act.
output[11];
2949 msg.servo13_raw = act.
output[12];
2950 msg.servo14_raw = act.
output[13];
2951 msg.servo15_raw = act.
output[14];
2952 msg.servo16_raw = act.
output[15];
2976 return "ACTUATOR_CONTROL_TARGET0";
2979 return "ACTUATOR_CONTROL_TARGET1";
2982 return "ACTUATOR_CONTROL_TARGET2";
2985 return "ACTUATOR_CONTROL_TARGET3";
2991 return MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
3006 return _act_ctrl_sub->is_published() ? (MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
3019 _act_ctrl_sub(nullptr),
3046 if (_act_ctrl_sub->
update(&_act_ctrl_time, &act_ctrl)) {
3047 mavlink_actuator_control_target_t
msg = {};
3052 for (
unsigned i = 0; i <
sizeof(msg.controls) /
sizeof(msg.controls[0]); i++) {
3053 msg.controls[i] = act_ctrl.
control[i];
3075 return "HIL_ACTUATOR_CONTROLS";
3080 return MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS;
3095 return MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
3110 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status))),
3111 _act_sub(
_mavlink->add_orb_subscription(
ORB_ID(actuator_outputs))),
3119 if (_act_sub->
update(&_act_time, &act)) {
3121 _status_sub->
update(&status);
3125 uint8_t mavlink_state;
3126 uint8_t mavlink_base_mode;
3127 uint32_t mavlink_custom_mode;
3128 mavlink_hil_actuator_controls_t
msg = {};
3137 if (system_type == MAV_TYPE_QUADROTOR ||
3138 system_type == MAV_TYPE_HEXAROTOR ||
3139 system_type == MAV_TYPE_OCTOROTOR ||
3140 system_type == MAV_TYPE_VTOL_DUOROTOR ||
3141 system_type == MAV_TYPE_VTOL_QUADROTOR ||
3142 system_type == MAV_TYPE_VTOL_RESERVED2) {
3148 switch (system_type) {
3149 case MAV_TYPE_QUADROTOR:
3153 case MAV_TYPE_HEXAROTOR:
3157 case MAV_TYPE_VTOL_DUOROTOR:
3161 case MAV_TYPE_VTOL_QUADROTOR:
3165 case MAV_TYPE_VTOL_RESERVED2:
3174 for (
unsigned i = 0; i < 16; i++) {
3187 msg.controls[i] = 0.0f;
3194 for (
unsigned i = 0; i < 16; i++) {
3207 msg.controls[i] = 0.0f;
3213 msg.mode = mavlink_base_mode;
3236 return "POSITION_TARGET_GLOBAL_INT";
3241 return MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT;
3256 return MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
3270 _control_mode_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_control_mode))),
3271 _lpos_sp_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position_setpoint))),
3272 _pos_sp_triplet_sub(
_mavlink->add_orb_subscription(
ORB_ID(position_setpoint_triplet)))
3278 _control_mode_sub->
update(&control_mode);
3283 _pos_sp_triplet_sub->
update(&pos_sp_triplet);
3288 mavlink_position_target_global_int_t
msg = {};
3291 msg.coordinate_frame = MAV_FRAME_GLOBAL_INT;
3292 msg.lat_int = pos_sp_triplet.
current.
lat * 1e7;
3293 msg.lon_int = pos_sp_triplet.
current.
lon * 1e7;
3298 if (_lpos_sp_sub->
update(&lpos_sp)) {
3300 msg.
vx = lpos_sp.
vx;
3301 msg.vy = lpos_sp.
vy;
3302 msg.vz = lpos_sp.
vz;
3310 msg.yaw = lpos_sp.
yaw;
3335 return "POSITION_TARGET_LOCAL_NED";
3340 return MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
3355 return MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
3368 _pos_sp_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position_setpoint))),
3376 if (_pos_sp_sub->
update(&_pos_sp_time, &pos_sp)) {
3377 mavlink_position_target_local_ned_t
msg = {};
3379 msg.time_boot_ms = pos_sp.
timestamp / 1000;
3380 msg.coordinate_frame = MAV_FRAME_LOCAL_NED;
3384 msg.yaw = pos_sp.
yaw;
3413 return "ATTITUDE_TARGET";
3418 return MAVLINK_MSG_ID_ATTITUDE_TARGET;
3433 return MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
3448 _att_sp_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_attitude_setpoint))),
3449 _att_rates_sp_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_rates_setpoint))),
3457 if (_att_sp_sub->
update(&_att_sp_time, &att_sp)) {
3460 _att_rates_sp_sub->
update(&att_rates_sp);
3462 mavlink_attitude_target_t
msg = {};
3464 msg.time_boot_ms = att_sp.
timestamp / 1000;
3467 memcpy(&msg.q[0], &att_sp.
q_d[0],
sizeof(msg.q));
3472 for (
size_t i = 0; i < 4; i++) {
3477 msg.body_roll_rate = att_rates_sp.
roll;
3478 msg.body_pitch_rate = att_rates_sp.
pitch;
3479 msg.body_yaw_rate = att_rates_sp.
yaw;
3503 return "RC_CHANNELS";
3508 return MAVLINK_MSG_ID_RC_CHANNELS;
3523 return _rc_sub->is_published() ? (MAVLINK_MSG_ID_RC_CHANNELS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
3544 if (_rc_sub->
update(&_rc_time, &rc)) {
3547 mavlink_rc_channels_t
msg = {};
3591 return "MANUAL_CONTROL";
3596 return MAVLINK_MSG_ID_MANUAL_CONTROL;
3611 return _manual_sub->is_published() ? (MAVLINK_MSG_ID_MANUAL_CONTROL_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
3624 _manual_sub(
_mavlink->add_orb_subscription(
ORB_ID(manual_control_setpoint))),
3632 if (_manual_sub->
update(&_manual_time, &manual)) {
3633 mavlink_manual_control_t
msg = {};
3636 msg.x = manual.
x * 1000;
3637 msg.y = manual.
y * 1000;
3638 msg.z = manual.
z * 1000;
3639 msg.r = manual.
r * 1000;
3642 msg.buttons |= (manual.
mode_switch << (shift * 0));
3646 msg.buttons |= (manual.
acro_switch << (shift * 4));
3668 return "TRAJECTORY_REPRESENTATION_WAYPOINTS";
3673 return MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS;
3688 return _traj_wp_avoidance_sub->is_published() ? (MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN +
3689 MAVLINK_NUM_NON_PAYLOAD_BYTES)
3703 _traj_wp_avoidance_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_trajectory_waypoint_desired))),
3704 _traj_wp_avoidance_time(0)
3711 if (_traj_wp_avoidance_sub->
update(&_traj_wp_avoidance_time, &traj_wp_avoidance_desired)) {
3712 mavlink_trajectory_representation_waypoints_t
msg = {};
3714 msg.time_usec = traj_wp_avoidance_desired.
timestamp;
3715 int number_valid_points = 0;
3717 for (
int i = 0; i < vehicle_trajectory_waypoint_s::NUMBER_POINTS; ++i) {
3730 msg.pos_yaw[i] = traj_wp_avoidance_desired.
waypoints[i].
yaw;
3734 case position_setpoint_s::SETPOINT_TYPE_TAKEOFF:
3735 msg.command[i] = vehicle_command_s::VEHICLE_CMD_NAV_TAKEOFF;
3738 case position_setpoint_s::SETPOINT_TYPE_LOITER:
3739 msg.command[i] = vehicle_command_s::VEHICLE_CMD_NAV_LOITER_UNLIM;
3742 case position_setpoint_s::SETPOINT_TYPE_LAND:
3743 msg.command[i] = vehicle_command_s::VEHICLE_CMD_NAV_LAND;
3747 msg.command[i] = UINT16_MAX;
3751 number_valid_points++;
3756 msg.valid_points = number_valid_points;
3777 return "OPTICAL_FLOW_RAD";
3782 return MAVLINK_MSG_ID_OPTICAL_FLOW_RAD;
3797 return _flow_sub->is_published() ? (MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
3818 if (_flow_sub->
update(&_flow_time, &flow)) {
3819 mavlink_optical_flow_rad_t
msg = {};
3854 return "NAMED_VALUE_FLOAT";
3859 return MAVLINK_MSG_ID_NAMED_VALUE_FLOAT;
3874 return (_debug_time > 0) ? MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
3887 _debug_sub(
_mavlink->add_orb_subscription(
ORB_ID(debug_key_value))),
3895 if (_debug_sub->
update(&_debug_time, &debug)) {
3896 mavlink_named_value_float_t
msg = {};
3898 msg.time_boot_ms = debug.
timestamp / 1000ULL;
3899 memcpy(msg.name, debug.
key,
sizeof(msg.name));
3901 msg.name[
sizeof(msg.name) - 1] =
'\0';
3902 msg.value = debug.
value;
3928 return MAVLINK_MSG_ID_DEBUG;
3943 return (_debug_time > 0) ? MAVLINK_MSG_ID_DEBUG_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
3964 if (_debug_sub->
update(&_debug_time, &debug)) {
3965 mavlink_debug_t
msg = {};
3967 msg.time_boot_ms = debug.
timestamp / 1000ULL;
3968 msg.ind = debug.
ind;
3969 msg.value = debug.
value;
3990 return "DEBUG_VECT";
3995 return MAVLINK_MSG_ID_DEBUG_VECT;
4010 return (_debug_time > 0) ? MAVLINK_MSG_ID_DEBUG_VECT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4031 if (_debug_sub->
update(&_debug_time, &debug)) {
4032 mavlink_debug_vect_t
msg = {};
4035 memcpy(msg.name, debug.
name,
sizeof(msg.name));
4037 msg.name[
sizeof(msg.name) - 1] =
'\0';
4061 return "DEBUG_FLOAT_ARRAY";
4066 return MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY;
4081 return (_debug_time > 0) ? MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4094 _debug_array_sub(
_mavlink->add_orb_subscription(
ORB_ID(debug_array))),
4102 if (_debug_array_sub->
update(&_debug_time, &debug)) {
4103 mavlink_debug_float_array_t
msg = {};
4106 msg.array_id = debug.
id;
4107 memcpy(msg.name, debug.
name,
sizeof(msg.name));
4109 msg.name[
sizeof(msg.name) - 1] =
'\0';
4111 for (
size_t i = 0; i < debug_array_s::ARRAY_SIZE; i++) {
4112 msg.data[i] = debug.
data[i];
4134 return "NAV_CONTROLLER_OUTPUT";
4139 return MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
4154 return (_pos_ctrl_status_sub->is_published()) ?
4155 MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4162 uint64_t _pos_ctrl_status_timestamp{0};
4163 uint64_t _tecs_status_timestamp{0};
4171 _pos_ctrl_status_sub(
_mavlink->add_orb_subscription(
ORB_ID(position_controller_status))),
4172 _tecs_status_sub(
_mavlink->add_orb_subscription(
ORB_ID(tecs_status)))
4180 bool updated =
false;
4181 updated |= _pos_ctrl_status_sub->
update(&_pos_ctrl_status_timestamp, &pos_ctrl_status);
4182 updated |= _tecs_status_sub->
update(&_tecs_status_timestamp, &tecs_status);
4185 mavlink_nav_controller_output_t
msg = {};
4191 msg.wp_dist = (uint16_t)pos_ctrl_status.
wp_dist;
4215 return "CAMERA_CAPTURE";
4235 return MAVLINK_MSG_ID_COMMAND_LONG_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
4247 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status)))
4254 if (_status_sub->
update(&status)) {
4255 mavlink_command_long_t
msg = {};
4257 msg.target_system = 0;
4258 msg.target_component = MAV_COMP_ID_ALL;
4259 msg.command = MAV_CMD_DO_CONTROL_VIDEO;
4260 msg.confirmation = 0;
4265 msg.param4 = (status.
arming_state == vehicle_status_s::ARMING_STATE_ARMED) ? 1 : 0;
4287 return "DISTANCE_SENSOR";
4292 return MAVLINK_MSG_ID_DISTANCE_SENSOR;
4307 return _distance_sensor_sub->is_published() ? (MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) : 0;
4320 _distance_sensor_sub(
_mavlink->add_orb_subscription(
ORB_ID(distance_sensor))),
4321 _dist_sensor_time(0)
4328 if (_distance_sensor_sub->
update(&_dist_sensor_time, &dist_sensor)) {
4329 mavlink_distance_sensor_t
msg = {};
4331 msg.time_boot_ms = dist_sensor.
timestamp / 1000;
4334 switch (dist_sensor.
type) {
4335 case MAV_DISTANCE_SENSOR_ULTRASOUND:
4336 msg.type = MAV_DISTANCE_SENSOR_ULTRASOUND;
4339 case MAV_DISTANCE_SENSOR_LASER:
4340 msg.type = MAV_DISTANCE_SENSOR_LASER;
4343 case MAV_DISTANCE_SENSOR_INFRARED:
4344 msg.type = MAV_DISTANCE_SENSOR_INFRARED;
4348 msg.type = MAV_DISTANCE_SENSOR_LASER;
4353 msg.id = dist_sensor.
id;
4357 msg.covariance = dist_sensor.
variance * 1e4f;
4378 return "EXTENDED_SYS_STATE";
4383 return MAVLINK_MSG_ID_EXTENDED_SYS_STATE;
4398 return MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
4414 _status_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_status))),
4415 _landed_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_land_detected))),
4416 _pos_sp_triplet_sub(
_mavlink->add_orb_subscription(
ORB_ID(position_setpoint_triplet))),
4417 _control_mode_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_control_mode))),
4420 _msg.vtol_state = MAV_VTOL_STATE_UNDEFINED;
4421 _msg.landed_state = MAV_LANDED_STATE_ON_GROUND;
4426 bool updated =
false;
4430 if (_status_sub->
update(&status)) {
4435 _msg.vtol_state = MAV_VTOL_STATE_MC;
4438 _msg.vtol_state = MAV_VTOL_STATE_FW;
4441 _msg.vtol_state = MAV_VTOL_STATE_TRANSITION_TO_FW;
4444 _msg.vtol_state = MAV_VTOL_STATE_TRANSITION_TO_MC;
4451 if (_landed_sub->
update(&land_detected)) {
4454 if (land_detected.
landed) {
4455 _msg.landed_state = MAV_LANDED_STATE_ON_GROUND;
4457 }
else if (!land_detected.
landed) {
4458 _msg.landed_state = MAV_LANDED_STATE_IN_AIR;
4463 if (_control_mode_sub->
update(&control_mode) && _pos_sp_triplet_sub->
update(&pos_sp_triplet)) {
4465 if (pos_sp_triplet.
current.
type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF) {
4466 _msg.landed_state = MAV_LANDED_STATE_TAKEOFF;
4468 }
else if (pos_sp_triplet.
current.
type == position_setpoint_s::SETPOINT_TYPE_LAND) {
4469 _msg.landed_state = MAV_LANDED_STATE_LANDING;
4499 return MAVLINK_MSG_ID_ALTITUDE;
4514 return (_local_pos_time > 0) ? MAVLINK_MSG_ID_ALTITUDE_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4522 uint64_t _local_pos_time{0};
4530 _local_pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position))),
4531 _home_sub(
_mavlink->add_orb_subscription(
ORB_ID(home_position))),
4532 _air_data_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_air_data)))
4537 mavlink_altitude_t
msg = {};
4539 msg.altitude_monotonic = NAN;
4540 msg.altitude_amsl = NAN;
4541 msg.altitude_local = NAN;
4542 msg.altitude_relative = NAN;
4543 msg.altitude_terrain = NAN;
4544 msg.bottom_clearance = NAN;
4547 bool air_data_updated =
false;
4549 _air_data_sub->
update(&air_data);
4554 air_data_updated =
true;
4557 bool lpos_updated =
false;
4561 if (_local_pos_sub->
update(&_local_pos_time, &local_pos)) {
4565 msg.altitude_amsl = -local_pos.
z + local_pos.
ref_alt;
4568 msg.altitude_amsl = msg.altitude_monotonic;
4571 msg.altitude_local = -local_pos.
z;
4574 _home_sub->
update(&home);
4577 msg.altitude_relative = -(local_pos.
z - home.
z);
4580 msg.altitude_relative = -local_pos.
z;
4584 msg.altitude_terrain = -local_pos.
z - local_pos.
dist_bottom;
4589 lpos_updated =
true;
4596 if (lpos_updated || (air_data_updated && lpos_timeout)) {
4622 return MAVLINK_MSG_ID_WIND_COV;
4637 return (_wind_estimate_time > 0) ? MAVLINK_MSG_ID_WIND_COV_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4652 _wind_estimate_sub(
_mavlink->add_orb_subscription(
ORB_ID(wind_estimate))),
4653 _wind_estimate_time(0),
4654 _local_pos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position)))
4661 if (_wind_estimate_sub->
update(&_wind_estimate_time, &wind_estimate)) {
4662 mavlink_wind_cov_t
msg = {};
4664 msg.time_usec = wind_estimate.
timestamp;
4671 msg.var_vert = 0.0f;
4674 _local_pos_sub->
update(&lpos);
4677 msg.horiz_accuracy = 0.0f;
4678 msg.vert_accuracy = 0.0f;
4699 return "MOUNT_ORIENTATION";
4704 return MAVLINK_MSG_ID_MOUNT_ORIENTATION;
4719 return (_mount_orientation_time > 0) ? MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4732 _mount_orientation_sub(
_mavlink->add_orb_subscription(
ORB_ID(mount_orientation))),
4733 _mount_orientation_time(0)
4740 if (_mount_orientation_sub->
update(&_mount_orientation_time, &mount_orientation)) {
4741 mavlink_mount_orientation_t
msg = {};
4766 return "GROUND_TRUTH";
4771 return MAVLINK_MSG_ID_HIL_STATE_QUATERNION;
4786 return (_att_time > 0 || _gpos_time > 0) ? MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN +
4787 MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
4796 uint64_t _angular_velocity_time{0};
4797 uint64_t _att_time{0};
4798 uint64_t _gpos_time{0};
4799 uint64_t _lpos_time{0};
4807 _angular_velocity_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_angular_velocity_groundtruth))),
4808 _att_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_attitude_groundtruth))),
4809 _gpos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_global_position_groundtruth))),
4810 _lpos_sub(
_mavlink->add_orb_subscription(
ORB_ID(vehicle_local_position_groundtruth)))
4815 bool updated =
false;
4822 updated |= _angular_velocity_sub->
update(&_angular_velocity_time, &angular_velocity);
4823 updated |= _att_sub->
update(&_att_time, &att);
4824 updated |= _gpos_sub->
update(&_gpos_time, &gpos);
4825 updated |= _lpos_sub->
update(&_lpos_time, &lpos);
4828 mavlink_hil_state_quaternion_t
msg = {};
4831 msg.attitude_quaternion[0] = att.q[0];
4832 msg.attitude_quaternion[1] = att.q[1];
4833 msg.attitude_quaternion[2] = att.q[2];
4834 msg.attitude_quaternion[3] = att.q[3];
4835 msg.rollspeed = angular_velocity.xyz[0];
4836 msg.pitchspeed = angular_velocity.xyz[1];
4837 msg.yawspeed = angular_velocity.xyz[2];
4841 msg.lat = gpos.lat * 1e7;
4842 msg.lon = gpos.lon * 1e7;
4843 msg.alt = gpos.alt * 1e3f;
4844 msg.vx = lpos.vx * 1e2f;
4845 msg.vy = lpos.vy * 1e2f;
4846 msg.vz = lpos.vz * 1e2f;
4847 msg.ind_airspeed = 0;
4848 msg.true_airspeed = 0;
4877 return MAVLINK_MSG_ID_PING;
4892 return MAVLINK_MSG_ID_PING_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
4914 mavlink_ping_t
msg = {};
4917 msg.seq = _sequence++;
4918 msg.target_system = 0;
4919 msg.target_component = 0;
4937 return "ORBIT_EXECUTION_STATUS";
4942 return MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS;
4957 return MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN +
4958 MAVLINK_NUM_NON_PAYLOAD_BYTES;
4972 _orbit_status_time(0)
4979 if (_sub->
update(&_orbit_status_time, &_orbit_status)) {
4980 mavlink_orbit_execution_status_t _msg_orbit_execution_status = {};
4982 _msg_orbit_execution_status.time_usec = _orbit_status.
timestamp;
4983 _msg_orbit_execution_status.radius = _orbit_status.
radius;
4984 _msg_orbit_execution_status.frame = _orbit_status.
frame;
4985 _msg_orbit_execution_status.x = _orbit_status.
x * 1e7;
4986 _msg_orbit_execution_status.y = _orbit_status.
y * 1e7;
4987 _msg_orbit_execution_status.z = _orbit_status.
z;
4989 mavlink_msg_orbit_execution_status_send_struct(
_mavlink->
get_channel(), &_msg_orbit_execution_status);
5006 return "OBSTACLE_DISTANCE";
5011 return MAVLINK_MSG_ID_OBSTACLE_DISTANCE;
5026 return _obstacle_distance_fused_sub->is_published() ? (MAVLINK_MSG_ID_OBSTACLE_DISTANCE_LEN +
5027 MAVLINK_NUM_NON_PAYLOAD_BYTES) :
5041 _obstacle_distance_fused_sub(
_mavlink->add_orb_subscription(
ORB_ID(obstacle_distance_fused))),
5042 _obstacle_distance_time(0)
5049 if (_obstacle_distance_fused_sub->
update(&_obstacle_distance_time, &obstacke_distance)) {
5050 mavlink_obstacle_distance_t
msg = {};
5052 msg.time_usec = obstacke_distance.
timestamp;
5054 memcpy(msg.distances, obstacke_distance.
distances,
sizeof(msg.distances));
5059 msg.increment_f = obstacke_distance.
increment;
5133 for (
const auto &stream : streams_list) {
5134 if (msg_id == stream.get_id()) {
5135 return stream.get_name();
5145 if (stream_name !=
nullptr) {
5146 for (
const auto &stream : streams_list) {
5147 if (strcmp(stream_name, stream.get_name()) == 0) {
5148 return stream.new_instance(mavlink);
#define PWM_DEFAULT_MAX
Default maximum PWM in us.
#define VEHICLE_TYPE_FIXED_WING
static uint16_t get_id_static()
MavlinkOrbSubscription * _pos_sp_triplet_sub
MavlinkStreamPing(Mavlink *mavlink)
static const char * get_name_static()
unsigned get_size() override
Get maximal total messages size on update.
uint64_t _obstacle_distance_time
MavlinkStreamAltitude(Mavlink *mavlink)
uint32_t onboard_control_sensors_enabled
bool send(const hrt_abstime t) override
MavlinkStreamHeartbeat(MavlinkStreamHeartbeat &)=delete
bool send(const hrt_abstime t) override
uint16_t get_id() override
const char * get_name() const override
uint16_t get_id() override
static uint16_t get_id_static()
static const char * get_name_static()
unsigned get_size() override
Get maximal total messages size on update.
uint16_t get_id() override
static struct vehicle_status_s status
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _act_sub
uint16_t get_id() override
static uint16_t get_id_static()
uint16_t get_id() override
uint64_t _orbit_status_time
static uint16_t get_id_static()
float gyro_x_rate_integral
bool send(const hrt_abstime t) override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _magnetometer_sub
bool send(const hrt_abstime t) override
static uint16_t get_id_static()
MavlinkOrbSubscription * _debug_sub
float time_to_minimum_delta
MavlinkStreamHeartbeat & operator=(const MavlinkStreamHeartbeat &)=delete
MavlinkOrbSubscription * _sensor_sub
MavlinkStreamServoOutputRaw(Mavlink *mavlink)
MavlinkStreamDebug(Mavlink *mavlink)
bool send(const hrt_abstime t) override
bool flag_control_auto_enabled
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
float differential_pressure_raw_pa
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
API for the uORB lightweight object broker.
static const char * get_name_static()
Definition of geo / math functions to perform geodesic calculations.
static uint16_t get_id_static()
bool send(const hrt_abstime t) override
MavlinkStreamNamedValueFloat(Mavlink *mavlink)
uint16_t get_id() override
static const char * get_name_static()
bool send(const hrt_abstime t) override
MAVLink 1.0 message formatters definition.
static const char * get_name_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
MavlinkOrbSubscription * _mocap_sub
unsigned get_size() override
Get maximal total messages size on update.
unsigned get_size() override
Get maximal total messages size on update.
static const StreamListItem streams_list[]
float pixel_flow_y_integral
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _vehicle_status_sub
MavlinkOrbSubscription * _rc_sub
bool is_published()
Check if the topic has been published.
uint16_t get_id() override
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
MavlinkOrbSubscription * _att_sp_sub
MavlinkStreamOrbitStatus(Mavlink *mavlink)
static const char * get_name_static()
MavlinkOrbSubscription * _capture_sub
static uint16_t get_id_static()
MavlinkStreamHomePosition(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
uint16_t get_id() override
static MavlinkStream * new_instance(Mavlink *mavlink)
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
static uint16_t get_id_static()
const char * get_name() const override
static void get_mavlink_mode_state(const struct vehicle_status_s *const status, uint8_t *mavlink_state, uint8_t *mavlink_base_mode, uint32_t *mavlink_custom_mode)
bool send(const hrt_abstime t) override
uint16_t get_id() override
static const char * get_name_static()
static uint16_t get_id_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
MavlinkStreamGroundTruth(Mavlink *mavlink)
static const char * get_name_static()
MavlinkOrbSubscription * _att_sub
MavlinkStreamGPS2Raw(Mavlink *mavlink)
uint64_t _wind_estimate_time
static uint16_t get_id_static()
unsigned get_size() override
Get maximal total messages size on update.
uint16_t get_id() override
MavlinkStreamBatteryStatus(Mavlink *mavlink)
MavlinkOrbSubscription * _cpuload_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
MavlinkStreamGlobalPositionInt(Mavlink *mavlink)
MavlinkStreamDebugVect(Mavlink *mavlink)
MavlinkStreamHeartbeat(Mavlink *mavlink)
bool send(const hrt_abstime t) override
unsigned get_size() override
Get maximal total messages size on update.
MAVLink 2.0 protocol interface definition.
unsigned get_size() override
Get maximal total messages size on update.
static const char * get_name_static()
MavlinkOrbSubscription * _lpos_sp_sub
bool const_rate() override
uint64_t _dist_sensor_time
bool send(const hrt_abstime t) override
float pixel_flow_x_integral
static uint16_t get_id_static()
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
static const char * get_name_static()
float accelerometer_m_s2[3]
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
static uint16_t get_id_static()
unsigned get_size() override
Get maximal total messages size on update.
MavlinkStreamTrajectoryRepresentationWaypoints(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
MavlinkOrbSubscription * _raw_gyro_sub
static const char * get_name_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _wind_estimate_sub
static uint16_t get_id_static()
const char * get_name() const override
MavlinkOrbSubscription * _act0_sub
uint16_t get_id() override
unsigned get_size() override
Get maximal total messages size on update.
static const char * get_name_static()
unsigned get_size() override
Get maximal total messages size on update.
MavlinkStreamCollision(Mavlink *mavlink)
uint16_t get_id() override
static uint16_t get_id_static()
MavlinkOrbSubscription * _raw_gyro_sub
uint16_t get_id() override
static MavlinkStream * new_instance(Mavlink *mavlink)
static uint16_t get_id_static()
uint16_t get_id() override
const char * get_name() const override
constexpr T degrees(T radians)
const char * get_name() const override
bool send(const hrt_abstime t) override
static const char * get_name_static()
const char * get_name() const override
void copyTo(Type dst[M *N]) const
unsigned get_size() override
Get maximal total messages size on update.
ringbuffer::RingBuffer * get_logbuffer()
const char * get_name() const override
uint32_t time_since_last_sonar_update
unsigned get_size() override
Get maximal total messages size on update.
uint16_t get_id() override
static uint16_t get_id_static()
MavlinkOrbSubscription * _raw_accel_sub
Matrix< Type, N, M > transpose() const
MavlinkStreamLocalPositionSetpoint(Mavlink *mavlink)
static uint16_t get_id_static()
static uint16_t get_id_static()
MavlinkStreamGPSRawInt(Mavlink *mavlink)
static constexpr float CONSTANTS_ONE_G
static MavlinkStream * new_instance(Mavlink *mavlink)
float velocity_covariance[21]
MavlinkStreamAttitude(Mavlink *mavlink)
uint16_t get_id() override
MavlinkOrbSubscription * _pos_sub
uint16_t get_id() override
static const char * get_name_static()
static uint16_t get_id_static()
MavlinkStreamCommandLong(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
Type wrap_2pi(Type x)
Wrap value in range [0, 2Ï€)
const char * get_name() const override
MavlinkOrbSubscription * _differential_pressure_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
uint64_t _mount_orientation_time
static const char * get_name_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
MavlinkOrbSubscription * _odom_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
unsigned get_size() override
Get maximal total messages size on update.
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
uint16_t get_id() override
static uint16_t get_id_static()
MavlinkStreamHighresIMU(Mavlink *mavlink)
uint16_t get_id() override
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
const char * get_name() const override
static const char * get_name_static()
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
MavlinkOrbSubscription * _raw_mag_sub
uint16_t get_id() override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _traj_wp_avoidance_sub
MavlinkOrbSubscription * _pos_sub
bool send(const hrt_abstime t) override
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
MavlinkStreamStatustext(Mavlink *mavlink)
bool const_rate() override
static const char * get_name_static()
mavlink_system_t mavlink_system
static MavlinkStream * new_instance(Mavlink *mavlink)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
MavlinkStreamOdometry(Mavlink *mavlink)
uint16_t get_id() override
MavlinkStreamAttitudeTarget(Mavlink *mavlink)
MavlinkOrbSubscription * _home_sub
MavlinkOrbSubscription * _pos_ctrl_status_sub
const char * get_name() const override
struct position_setpoint_s current
static uint16_t get_id_static()
unsigned get_size() override
Get maximal total messages size on update.
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
MavlinkOrbSubscription * _trigger_sub
const char * get_name() const override
MavlinkStreamUTMGlobalPosition(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
MavlinkStreamTimesync(Mavlink *mavlink)
MavlinkOrbSubscription * _act_sub
bool send(const hrt_abstime t) override
static const char * get_name_static()
const char * get_name() const override
float attitude_euler_angle[3]
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
static uint16_t get_id_static()
uint16_t get_id() override
static uint16_t get_id_static()
static uint16_t get_id_static()
float altitude_minimum_delta
static const char * get_name_static()
MavlinkOrbSubscription * _act_ctrl_sub
MavlinkOrbSubscription * _att_rates_sp_sub
void get_mavlink_navigation_mode(const struct vehicle_status_s *const status, uint8_t *mavlink_base_mode, union px4_custom_mode *custom_mode)
uint16_t solution_status_flags
static uint16_t get_id_static()
bool send(const hrt_abstime t) override
bool send(const hrt_abstime t) override
MavlinkStreamPositionTargetGlobalInt(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
const char * get_name() const override
const char * get_name() const override
MavlinkStreamHILActuatorControls(Mavlink *mavlink)
const char * get_name() const override
MavlinkStreamSysStatus(Mavlink *mavlink)
MavlinkOrbSubscription * _air_data_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
MavlinkOrbSubscription * _home_sub
uint16_t get_id() override
bool odometry_loopback_enabled() const
const char * get_name() const override
uint16_t get_id() override
static struct actuator_armed_s armed
uint16_t get_id() override
const char * get_name() const override
MavlinkOrbSubscription * _global_pos_sub
static const char * get_name_static()
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
uint16_t get_id() override
MavlinkOrbSubscription * _status_sub
const char * get_name() const override
static uint16_t get_id_static()
static uint16_t get_id_static()
static const char * get_name_static()
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _angular_velocity_sub
unsigned get_size() override
Get maximal total messages size on update.
static hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
Compute the delta between a timestamp taken in the past and now.
float horizontal_minimum_delta
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
static uint16_t get_id_static()
float indicated_airspeed_m_s
bool update(uint64_t *time, void *data)
Check if subscription updated based on timestamp.
static uint16_t get_id_static()
static const char * get_name_static()
uint16_t get_id() override
static MavlinkStream * new_instance(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkStreamScaledIMU3(Mavlink *mavlink)
Mavlink commands sender with support for retransmission.
static const char * get_name_static()
static const char * get_name_static()
bool send(const hrt_abstime t) override
static uint16_t get_id_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
bool const_rate() override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _gps_sub
MavlinkOrbSubscription * _raw_mag_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _raw_mag_sub
static const char * get_name_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
mavlink_channel_t get_channel() const
unsigned get_size() override
Get maximal total messages size on update.
static uint16_t get_id_static()
MavlinkOrbSubscription * _airspeed_sub
static uint16_t get_id_static()
MavlinkOrbSubscription * _lpos_sub
uint16_t get_id() override
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
const char * get_name() const override
static const char * get_name_static()
const char * get_name() const override
MavlinkOrbSubscription * _debug_array_sub
MavlinkOrbSubscription * _gps_sub
static uint16_t get_id_static()
bool send(const hrt_abstime t) override
MavlinkStreamWind(Mavlink *mavlink)
MavlinkOrbSubscription * _local_pos_sub
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
MavlinkOrbSubscription * _local_pos_sub
MavlinkOrbSubscription * _gpos_sub
static const char * get_name_static()
bool send(const hrt_abstime t) override
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
MavlinkOrbSubscription * _pos_sub
uint16_t get_id() override
unsigned get_size() override
Get maximal total messages size on update.
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
MavlinkOrbSubscription * _raw_gyro_sub
MavlinkOrbSubscription * _collision_sub
MavlinkOrbSubscription * _pos_sp_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
uint16_t get_id() override
uint16_t get_id() override
MavlinkOrbSubscription * _angular_velocity_sub
bool send(const hrt_abstime t) override
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
MavlinkStreamCameraCapture(Mavlink *mavlink)
MavlinkOrbSubscription * _status_sub
MavlinkStreamLocalPositionNED(Mavlink *mavlink)
MavlinkStreamVFRHUD(Mavlink *mavlink)
mavlink_extended_sys_state_t _msg
uint16_t get_id() override
static uint16_t cm_uint16_from_m_float(float m)
static uint16_t get_id_static()
static uint16_t get_id_static()
MavlinkOrbSubscription * _debug_sub
static const char * get_name_static()
MavlinkOrbSubscription * _cmd_sub
uint16_t get_id() override
static uint16_t get_id_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
const char * get_name() const override
MavlinkOrbSubscription * _lpos_sub
MavlinkStreamDistanceSensor(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
unsigned get_size() override
Get maximal total messages size on update.
Vector3< float > Vector3f
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
static const char * get_name_static()
uint16_t get_id() override
MavlinkOrbSubscription * _raw_accel_sub
MavlinkStream * create_mavlink_stream(const char *stream_name, Mavlink *mavlink)
uint32_t onboard_control_sensors_health
uint16_t get_id() override
MavlinkOrbSubscription * _flow_sub
uint64_t _dpres_timestamp
static uint16_t get_id_static()
uint16_t get_id() override
bool send(const hrt_abstime t) override
static uint16_t get_id_static()
static MavlinkStream * new_instance(Mavlink *mavlink)
static uint16_t get_id_static()
const char * get_name() const override
MavlinkOrbSubscription * _att_sub
MavlinkStreamAttPosMocap(Mavlink *mavlink)
MavlinkOrbSubscription * _pos_sp_triplet_sub
MavlinkStreamScaledIMU(Mavlink *mavlink)
bool update_if_changed(void *data)
Check if the subscription has been updated.
const char * get_stream_name(const uint16_t msg_id)
static MavlinkStream * new_instance(Mavlink *mavlink)
bool flag_control_position_enabled
bool send(const hrt_abstime t) override
constexpr _Tp max(_Tp a, _Tp b)
MavlinkStreamSystemTime(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
bool const_rate() override
static uint16_t get_id_static()
MavlinkOrbSubscription * _armed_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
static MavlinkStream * new_instance(Mavlink *mavlink)
Quaternion< float > Quatf
MavlinkOrbSubscription * _land_detected_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
const char * get_name() const override
const char * get_name() const override
bool send(const hrt_abstime t) override
MavlinkStreamObstacleDistance(Mavlink *mavlink)
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _gpos_sub
MavlinkStreamActuatorControlTarget(Mavlink *mavlink)
bool send(const hrt_abstime t) override
MavlinkStreamDebugFloatArray(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
bool send(const hrt_abstime t) override
float pose_covariance[21]
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _air_data_sub
bool send(const hrt_abstime t) override
uint16_t get_id() override
#define ORB_MULTI_MAX_INSTANCES
Maximum number of multi topic instances.
MavlinkOrbSubscription * _sub
MavlinkOrbSubscription * _debug_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
int update(const hrt_abstime &t)
Update subscriptions and send message if necessary.
const char * get_name() const override
MavlinkOrbSubscription * _status_sub
bool send(const hrt_abstime t) override
uint16_t get_id() override
MavlinkOrbSubscription * _bias_sub
MavlinkStreamRCChannels(Mavlink *mavlink)
MavlinkOrbSubscription * _est_sub
MavlinkStreamExtendedSysState(Mavlink *mavlink)
static uint16_t get_id_static()
MavlinkOrbSubscription * _air_data_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...
static struct cpuload_s cpuload
uint16_t get_id() override
static uint16_t get_id_static()
MavlinkOrbSubscription * _distance_sensor_sub
MavlinkOrbSubscription * _local_pos_sub
uint32_t integration_timespan
unsigned get_size() override
Get maximal total messages size on update.
static const char * get_name_static()
static const char * get_name_static()
const char * get_name() const override
const char * get_name() const override
bool send(const hrt_abstime t) override
bool send(const hrt_abstime t) override
MavlinkStreamAttitudeQuaternion(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
struct trajectory_waypoint_s waypoints[5]
unsigned get_size() override
Get maximal total messages size on update.
static const char * get_name_static()
static uint16_t get_id_static()
MavlinkOrbSubscription * _control_mode_sub
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
const char * get_name() const override
MavlinkOrbSubscription * _raw_accel_sub
static const char * get_name_static()
bool send(const hrt_abstime t) override
uint64_t _traj_wp_avoidance_time
static const char * get_name_static()
MavlinkStreamMountOrientation(Mavlink *mavlink)
static MavlinkStream * new_instance(Mavlink *mavlink)
static uint16_t get_id_static()
static const char * get_name_static()
MavlinkOrbSubscription * _landed_sub
MavlinkStreamCameraImageCaptured(Mavlink *mavlink)
MavlinkOrbSubscription * _act1_sub
MavlinkOrbSubscription * _status_sub
bool send(const hrt_abstime t) override
bool send(const hrt_abstime t) override
uint16_t get_id() override
MavlinkOrbSubscription * _obstacle_distance_fused_sub
bool send(const hrt_abstime t) override
static uint16_t get_id_static()
static const char * get_name_static()
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
static const char * get_name_static()
static MavlinkCommandSender & instance()
MavlinkStreamScaledIMU2(Mavlink *mavlink)
MavlinkOrbSubscription * _position_setpoint_triplet_sub
static uint16_t get_id_static()
static const char * get_name_static()
float gyro_z_rate_integral
int32_t accelerometer_timestamp_relative
unsigned get_system_type()
__EXPORT matrix::Quatf get_rot_quaternion(enum Rotation rot)
Get the rotation quaternion.
float gyro_y_rate_integral
static uint16_t get_id_static()
static const char * get_name_static()
MavlinkStreamOpticalFlowRad(Mavlink *mavlink)
static const char * get_name_static()
MavlinkStreamManualControl(Mavlink *mavlink)
static const char * get_name_static()
static const char * get_name_static()
unsigned get_size() override
Get maximal total messages size on update.
MavlinkStreamNavControllerOutput(Mavlink *mavlink)
bool const_rate() override
uint16_t get_id() override
bool send(const hrt_abstime t) override
bool send(const hrt_abstime t) override
const char * get_name() const override
static const char * get_name_static()
static uint16_t get_id_static()
#define PWM_DEFAULT_MIN
Default minimum PWM in us.
const char * get_name() const override
MavlinkOrbSubscription * _control_mode_sub
static MavlinkStream * new_instance(Mavlink *mavlink)
static const char * get_name_static()
uint16_t get_id() override
const char * get_name() const override
static MavlinkStream * new_instance(Mavlink *mavlink)
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
uint64_t _accel_timestamp
MavlinkOrbSubscription * _mount_orientation_sub
static const char * get_name_static()
MavlinkOrbSubscription * _home_sub
static uint16_t get_id_static()
MavlinkOrbSubscription * _status_sub
MavlinkOrbSubscription * _manual_sub
static const char * get_name_static()
bool const_rate() override
unsigned get_size() override
Get maximal total messages size on update.
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _tecs_status_sub
uint16_t get_id() override
unsigned get_size() override
Get maximal total messages size on update.
void check_timeout(mavlink_channel_t channel)
Check timeouts to verify if an commands need retransmission.
static uint16_t get_id_static()
MavlinkOrbSubscription * _status_sub
MavlinkOrbSubscription * _att_sub
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
const char * get_name() const override
MavlinkStreamCameraTrigger(Mavlink *mavlink)
static const char * get_name_static()
uint32_t onboard_control_sensors_present
static const char * get_name_static()
static uint16_t get_id_static()
MavlinkStreamADSBVehicle(Mavlink *mavlink)
bool send(const hrt_abstime t) override
MavlinkOrbSubscription * _vodom_sub
uint16_t get_id() override
unsigned get_size() override
Get maximal total messages size on update.
const char * get_name() const override
unsigned get_size() override
Get maximal total messages size on update.
MavlinkOrbSubscription * _angular_velocity_sub
MavlinkOrbSubscription * _air_data_sub
uint16_t get_id() override
static uint16_t get_id_static()
static uint16_t get_id_static()
MavlinkStreamEstimatorStatus(Mavlink *mavlink)
int handle_vehicle_command(const struct vehicle_command_s &command, mavlink_channel_t channel)
Send a command on a channel and keep it in a queue for retransmission.
const char * get_name() const override
uint16_t get_id() override
uint16_t get_id() override