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/ArduCopter/GCS_Copter.cpp
Views: 1798
#include "GCS_Copter.h"12#include "Copter.h"34uint8_t GCS_Copter::sysid_this_mav() const5{6return copter.g.sysid_this_mav;7}89const char* GCS_Copter::frame_string() const10{11if (copter.motors == nullptr) {12return "MultiCopter";13}14return copter.motors->get_frame_string();15}1617bool GCS_Copter::simple_input_active() const18{19return copter.simple_mode == Copter::SimpleMode::SIMPLE;20}2122bool GCS_Copter::supersimple_input_active() const23{24return copter.simple_mode == Copter::SimpleMode::SUPERSIMPLE;25}2627void GCS_Copter::update_vehicle_sensor_status_flags(void)28{29control_sensors_present |=30MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |31MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |32MAV_SYS_STATUS_SENSOR_YAW_POSITION;3334control_sensors_enabled |=35MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |36MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |37MAV_SYS_STATUS_SENSOR_YAW_POSITION;3839control_sensors_health |=40MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |41MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |42MAV_SYS_STATUS_SENSOR_YAW_POSITION;4344// Update position controller flags45if (copter.pos_control != nullptr) {46control_sensors_present |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;47control_sensors_present |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;4849// XY position controller50if (copter.pos_control->is_active_xy()) {51control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;52control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;53}5455// Z altitude controller56if (copter.pos_control->is_active_z()) {57control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;58control_sensors_health |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;59}60}6162// optional sensors, some of which are essentially always63// available in the firmware:64#if HAL_PROXIMITY_ENABLED65if (copter.g2.proximity.sensor_present()) {66control_sensors_present |= MAV_SYS_STATUS_SENSOR_PROXIMITY;67}68if (copter.g2.proximity.sensor_enabled()) {69control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_PROXIMITY;70}71if (!copter.g2.proximity.sensor_failed()) {72control_sensors_health |= MAV_SYS_STATUS_SENSOR_PROXIMITY;73}74#endif7576#if AP_RANGEFINDER_ENABLED77const RangeFinder *rangefinder = RangeFinder::get_singleton();78if (rangefinder && rangefinder->has_orientation(ROTATION_PITCH_270)) {79control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;80}81if (copter.rangefinder_state.enabled) {82control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;83if (rangefinder && rangefinder->has_data_orient(ROTATION_PITCH_270)) {84control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;85}86}87#endif8889#if AC_PRECLAND_ENABLED90if (copter.precland.enabled()) {91control_sensors_present |= MAV_SYS_STATUS_SENSOR_VISION_POSITION;92control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_VISION_POSITION;93}94if (copter.precland.enabled() && copter.precland.healthy()) {95control_sensors_health |= MAV_SYS_STATUS_SENSOR_VISION_POSITION;96}97#endif9899#if AP_TERRAIN_AVAILABLE100switch (copter.terrain.status()) {101case AP_Terrain::TerrainStatusDisabled:102break;103case AP_Terrain::TerrainStatusUnhealthy:104// To-Do: restore unhealthy terrain status reporting once terrain is used in copter105//control_sensors_present |= MAV_SYS_STATUS_TERRAIN;106//control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;107//break;108case AP_Terrain::TerrainStatusOK:109control_sensors_present |= MAV_SYS_STATUS_TERRAIN;110control_sensors_enabled |= MAV_SYS_STATUS_TERRAIN;111control_sensors_health |= MAV_SYS_STATUS_TERRAIN;112break;113}114#endif115116control_sensors_present |= MAV_SYS_STATUS_SENSOR_PROPULSION;117control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_PROPULSION;118// only mark propulsion healthy if all of the motors are producing119// nominal thrust120if (!copter.motors->get_thrust_boost()) {121control_sensors_health |= MAV_SYS_STATUS_SENSOR_PROPULSION;122}123}124125126