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/Rover/GCS_Rover.cpp
Views: 1798
#include "GCS_Rover.h"12#include "Rover.h"34#include <AP_RangeFinder/AP_RangeFinder_Backend.h>56uint8_t GCS_Rover::sysid_this_mav() const7{8return rover.g.sysid_this_mav;9}1011bool GCS_Rover::simple_input_active() const12{13if (rover.control_mode != &rover.mode_simple) {14return false;15}16return (rover.g2.simple_type == ModeSimple::Simple_InitialHeading);17}1819bool GCS_Rover::supersimple_input_active() const20{21if (rover.control_mode != &rover.mode_simple) {22return false;23}24return (rover.g2.simple_type == ModeSimple::Simple_CardinalDirections);25}2627void GCS_Rover::update_vehicle_sensor_status_flags(void)28{29// mode-specific:30control_sensors_present |=31MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |32MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |33MAV_SYS_STATUS_SENSOR_YAW_POSITION |34MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;3536if (rover.control_mode->attitude_stabilized()) {37control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL; // 3D angular rate control38control_sensors_health |= MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL; // 3D angular rate control39control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION; // 3D angular rate control40control_sensors_health |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION; // 3D angular rate control41}42if (rover.control_mode->is_autopilot_mode()) {43control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_YAW_POSITION; // yaw position44control_sensors_health |= MAV_SYS_STATUS_SENSOR_YAW_POSITION; // yaw position45control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL; // X/Y position control46control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL; // X/Y position control47}4849#if HAL_PROXIMITY_ENABLED50const AP_Proximity *proximity = AP_Proximity::get_singleton();51if (proximity && proximity->get_status() > AP_Proximity::Status::NotConnected) {52control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;53control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;54}55if (proximity && proximity->get_status() != AP_Proximity::Status::NoData) {56control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;57}58#endif5960#if AP_RANGEFINDER_ENABLED61const RangeFinder *rangefinder = RangeFinder::get_singleton();62if (rangefinder && rangefinder->num_sensors() > 0) {63control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;64control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;65AP_RangeFinder_Backend *s = rangefinder->get_backend(0);66if (s != nullptr && s->has_data()) {67control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;68}69}70#endif71}727374