2019-02-19 17:32:22 -04:00
|
|
|
#include "GCS_Sub.h"
|
|
|
|
|
|
|
|
#include "Sub.h"
|
|
|
|
|
2020-02-11 21:01:18 -04:00
|
|
|
uint8_t GCS_Sub::sysid_this_mav() const
|
|
|
|
{
|
|
|
|
return sub.g.sysid_this_mav;
|
|
|
|
}
|
|
|
|
|
2019-02-19 21:59:40 -04:00
|
|
|
void GCS_Sub::update_vehicle_sensor_status_flags()
|
2019-02-19 17:32:22 -04:00
|
|
|
{
|
2021-04-13 00:55:54 -03:00
|
|
|
// mode-specific sensors:
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_present |=
|
|
|
|
MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |
|
|
|
|
MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |
|
|
|
|
MAV_SYS_STATUS_SENSOR_YAW_POSITION;
|
|
|
|
|
|
|
|
control_sensors_enabled |=
|
|
|
|
MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |
|
|
|
|
MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |
|
|
|
|
MAV_SYS_STATUS_SENSOR_YAW_POSITION;
|
|
|
|
|
|
|
|
control_sensors_health |=
|
|
|
|
MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |
|
|
|
|
MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |
|
|
|
|
MAV_SYS_STATUS_SENSOR_YAW_POSITION;
|
2019-02-19 17:32:22 -04:00
|
|
|
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_present |=
|
|
|
|
MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL |
|
|
|
|
MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
|
2019-02-19 17:32:22 -04:00
|
|
|
|
|
|
|
switch (sub.control_mode) {
|
2023-04-03 09:11:21 -03:00
|
|
|
case Mode::Number::ALT_HOLD:
|
|
|
|
case Mode::Number::AUTO:
|
|
|
|
case Mode::Number::GUIDED:
|
|
|
|
case Mode::Number::CIRCLE:
|
|
|
|
case Mode::Number::SURFACE:
|
|
|
|
case Mode::Number::POSHOLD:
|
2019-02-19 17:32:22 -04:00
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;
|
2019-02-19 17:32:22 -04:00
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
|
2019-02-19 17:32:22 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-04-13 00:55:54 -03:00
|
|
|
// override the parent class's values for ABSOLUTE_PRESSURE to
|
|
|
|
// only check internal barometer:
|
|
|
|
if (sub.ap.depth_sensor_present) {
|
|
|
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
|
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
|
|
|
|
}
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_health &= ~MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE; // check the internal barometer only
|
|
|
|
if (sub.sensor_health.depth) {
|
2019-02-19 17:32:22 -04:00
|
|
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
|
|
|
|
}
|
2021-04-13 00:55:54 -03:00
|
|
|
|
2021-02-12 23:40:10 -04:00
|
|
|
#if AP_TERRAIN_AVAILABLE
|
2019-08-20 23:11:32 -03:00
|
|
|
switch (sub.terrain.status()) {
|
2019-02-19 17:32:22 -04:00
|
|
|
case AP_Terrain::TerrainStatusDisabled:
|
|
|
|
break;
|
|
|
|
case AP_Terrain::TerrainStatusUnhealthy:
|
|
|
|
// To-Do: restore unhealthy terrain status reporting once terrain is used in Sub
|
|
|
|
//control_sensors_present |= MAV_SYS_STATUS_TERRAIN;
|
|
|
|
//control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;
|
|
|
|
//break;
|
|
|
|
case AP_Terrain::TerrainStatusOK:
|
|
|
|
control_sensors_present |= MAV_SYS_STATUS_TERRAIN;
|
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;
|
|
|
|
control_sensors_health |= MAV_SYS_STATUS_TERRAIN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if RANGEFINDER_ENABLED == ENABLED
|
|
|
|
const RangeFinder *rangefinder = RangeFinder::get_singleton();
|
|
|
|
if (sub.rangefinder_state.enabled) {
|
|
|
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
|
|
|
if (rangefinder && rangefinder->has_data_orient(ROTATION_PITCH_270)) {
|
|
|
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-06-27 19:40:05 -03:00
|
|
|
#if AP_LTM_TELEM_ENABLED
|
2019-09-05 02:01:45 -03:00
|
|
|
// avoid building/linking LTM:
|
|
|
|
void AP_LTM_Telem::init() {};
|
2022-06-27 19:40:05 -03:00
|
|
|
#endif
|
2021-11-18 23:34:22 -04:00
|
|
|
#if AP_DEVO_TELEM_ENABLED
|
2019-03-01 19:58:06 -04:00
|
|
|
// avoid building/linking Devo:
|
|
|
|
void AP_DEVO_Telem::init() {};
|
2021-11-18 23:34:22 -04:00
|
|
|
#endif
|