2019-02-19 17:32:22 -04:00
|
|
|
#include "GCS_Sub.h"
|
|
|
|
|
|
|
|
#include "Sub.h"
|
|
|
|
|
2019-02-19 21:59:40 -04:00
|
|
|
void GCS_Sub::update_vehicle_sensor_status_flags()
|
2019-02-19 17:32:22 -04:00
|
|
|
{
|
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
|
|
|
|
|
|
|
// first what sensors/controllers we have
|
|
|
|
if (sub.ap.depth_sensor_present) {
|
|
|
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
|
2019-02-19 17:32:22 -04:00
|
|
|
}
|
|
|
|
#if OPTFLOW == ENABLED
|
|
|
|
const OpticalFlow *optflow = AP::opticalflow();
|
|
|
|
if (optflow && optflow->enabled()) {
|
|
|
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
|
2019-02-19 21:59:40 -04:00
|
|
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
|
2019-02-19 17:32:22 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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) {
|
|
|
|
case ALT_HOLD:
|
|
|
|
case AUTO:
|
|
|
|
case GUIDED:
|
|
|
|
case CIRCLE:
|
|
|
|
case SURFACE:
|
|
|
|
case POSHOLD:
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
#if OPTFLOW == ENABLED
|
|
|
|
if (optflow && optflow->healthy()) {
|
|
|
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
|
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
|
|
|
|
}
|
|
|
|
|
2019-09-05 02:01:45 -03:00
|
|
|
// avoid building/linking LTM:
|
|
|
|
void AP_LTM_Telem::init() {};
|
2019-03-01 19:58:06 -04:00
|
|
|
// avoid building/linking Devo:
|
|
|
|
void AP_DEVO_Telem::init() {};
|