You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.7 KiB
69 lines
2.7 KiB
6 years ago
|
#include "GCS_Rover.h"
|
||
|
|
||
|
#include "Rover.h"
|
||
|
|
||
5 years ago
|
#include <AP_RangeFinder/AP_RangeFinder_Backend.h>
|
||
6 years ago
|
|
||
5 years ago
|
uint8_t GCS_Rover::sysid_this_mav() const
|
||
|
{
|
||
|
return rover.g.sysid_this_mav;
|
||
|
}
|
||
|
|
||
6 years ago
|
bool GCS_Rover::simple_input_active() const
|
||
|
{
|
||
|
if (rover.control_mode != &rover.mode_simple) {
|
||
|
return false;
|
||
|
}
|
||
|
return (rover.g2.simple_type == ModeSimple::Simple_InitialHeading);
|
||
|
}
|
||
|
|
||
|
bool GCS_Rover::supersimple_input_active() const
|
||
|
{
|
||
|
if (rover.control_mode != &rover.mode_simple) {
|
||
|
return false;
|
||
|
}
|
||
|
return (rover.g2.simple_type == ModeSimple::Simple_CardinalDirections);
|
||
|
}
|
||
|
|
||
6 years ago
|
void GCS_Rover::update_vehicle_sensor_status_flags(void)
|
||
6 years ago
|
{
|
||
|
// first what sensors/controllers we have
|
||
|
const AP_Proximity *proximity = AP_Proximity::get_singleton();
|
||
5 years ago
|
if (proximity && proximity->get_status() > AP_Proximity::Status::NotConnected) {
|
||
6 years ago
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
6 years ago
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
control_sensors_present |=
|
||
|
MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL |
|
||
|
MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION |
|
||
|
MAV_SYS_STATUS_SENSOR_YAW_POSITION |
|
||
|
MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
|
||
|
|
||
6 years ago
|
if (rover.control_mode->attitude_stabilized()) {
|
||
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL; // 3D angular rate control
|
||
6 years ago
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL; // 3D angular rate control
|
||
6 years ago
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION; // 3D angular rate control
|
||
6 years ago
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION; // 3D angular rate control
|
||
6 years ago
|
}
|
||
|
if (rover.control_mode->is_autopilot_mode()) {
|
||
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_YAW_POSITION; // yaw position
|
||
6 years ago
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_YAW_POSITION; // yaw position
|
||
6 years ago
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL; // X/Y position control
|
||
6 years ago
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL; // X/Y position control
|
||
6 years ago
|
}
|
||
|
|
||
|
const RangeFinder *rangefinder = RangeFinder::get_singleton();
|
||
|
if (rangefinder && rangefinder->num_sensors() > 0) {
|
||
|
control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
|
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
|
AP_RangeFinder_Backend *s = rangefinder->get_backend(0);
|
||
|
if (s != nullptr && s->has_data()) {
|
||
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
|
}
|
||
|
}
|
||
5 years ago
|
if (proximity && proximity->get_status() != AP_Proximity::Status::NoData) {
|
||
6 years ago
|
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
|
||
6 years ago
|
}
|
||
|
}
|