Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/ArduSub/GCS_Sub.cpp
Views: 1798
#include "GCS_Sub.h"12#include "Sub.h"34uint8_t GCS_Sub::sysid_this_mav() const5{6return sub.g.sysid_this_mav;7}89void GCS_Sub::update_vehicle_sensor_status_flags()10{11// mode-specific sensors:12control_sensors_present |=13MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |14MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |15MAV_SYS_STATUS_SENSOR_YAW_POSITION;1617control_sensors_enabled |=18MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |19MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |20MAV_SYS_STATUS_SENSOR_YAW_POSITION;2122control_sensors_health |=23MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |24MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |25MAV_SYS_STATUS_SENSOR_YAW_POSITION;2627control_sensors_present |=28MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL |29MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;3031switch (sub.control_mode) {32case Mode::Number::ALT_HOLD:33case Mode::Number::AUTO:34case Mode::Number::GUIDED:35case Mode::Number::CIRCLE:36case Mode::Number::SURFACE:37case Mode::Number::POSHOLD:38control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;39control_sensors_health |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;40control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;41control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;42break;43default:44break;45}4647// override the parent class's values for ABSOLUTE_PRESSURE to48// only check internal barometer:49if (sub.ap.depth_sensor_present) {50control_sensors_present |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;51control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;52}53control_sensors_health &= ~MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE; // check the internal barometer only54if (sub.sensor_health.depth) {55control_sensors_health |= MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE;56}5758#if AP_TERRAIN_AVAILABLE59switch (sub.terrain.status()) {60case AP_Terrain::TerrainStatusDisabled:61break;62case AP_Terrain::TerrainStatusUnhealthy:63// To-Do: restore unhealthy terrain status reporting once terrain is used in Sub64//control_sensors_present |= MAV_SYS_STATUS_TERRAIN;65//control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;66//break;67case AP_Terrain::TerrainStatusOK:68control_sensors_present |= MAV_SYS_STATUS_TERRAIN;69control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;70control_sensors_health |= MAV_SYS_STATUS_TERRAIN;71break;72}73#endif7475#if AP_RANGEFINDER_ENABLED76const RangeFinder *rangefinder = RangeFinder::get_singleton();77if (sub.rangefinder_state.enabled) {78control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;79control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;80if (rangefinder && rangefinder->has_data_orient(ROTATION_PITCH_270)) {81control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;82}83}84#endif85}8687#if AP_LTM_TELEM_ENABLED88// avoid building/linking LTM:89void AP_LTM_Telem::init() {};90#endif91#if AP_DEVO_TELEM_ENABLED92// avoid building/linking Devo:93void AP_DEVO_Telem::init() {};94#endif959697