123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #include "GCS_Sub.h"
- #include "Sub.h"
- void GCS_Sub::update_vehicle_sensor_status_flags()
- {
- 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;
- // first what sensors/controllers we have
- if (sub.ap.depth_sensor_present) {
- control_sensors_present |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
- control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
- }
- const AP_GPS &gps = AP::gps();
- if (gps.status() > AP_GPS::NO_GPS) {
- control_sensors_present |= MAV_SYS_STATUS_SENSOR_GPS;
- control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_GPS;
- }
- #if OPTFLOW == ENABLED
- const OpticalFlow *optflow = AP::opticalflow();
- if (optflow && optflow->enabled()) {
- control_sensors_present |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
- control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
- }
- #endif
- control_sensors_present |=
- MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL |
- MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
- 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;
- control_sensors_health |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;
- control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
- control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
- break;
- default:
- break;
- }
- control_sensors_health &= ~MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE; // check the internal barometer only
- if (sub.sensor_health.depth) {
- control_sensors_health |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;
- }
- if (gps.is_healthy()) {
- control_sensors_health |= MAV_SYS_STATUS_SENSOR_GPS;
- }
- #if OPTFLOW == ENABLED
- if (optflow && optflow->healthy()) {
- control_sensors_health |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
- }
- #endif
- #if AP_TERRAIN_AVAILABLE && AC_TERRAIN
- switch (sub.terrain.status()) {
- 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
- }
- // avoid building/linking Devo:
- void AP_DEVO_Telem::init() {};
|