Browse Source

land_detector: cleanup actuator_armed and battery_status naming

* Rename _arming -> _actuator_armed
 * Rename _battery -> _battery_status in the MulticopterLandDetector class.
sbg
Mark Sauder 6 years ago committed by Daniel Agar
parent
commit
1466d11acc
  1. 2
      src/modules/land_detector/FixedwingLandDetector.cpp
  2. 6
      src/modules/land_detector/LandDetector.cpp
  3. 2
      src/modules/land_detector/LandDetector.h
  4. 14
      src/modules/land_detector/MulticopterLandDetector.cpp
  5. 2
      src/modules/land_detector/MulticopterLandDetector.h
  6. 2
      src/modules/land_detector/RoverLandDetector.cpp

2
src/modules/land_detector/FixedwingLandDetector.cpp

@ -88,7 +88,7 @@ float FixedwingLandDetector::_get_max_altitude()
bool FixedwingLandDetector::_get_landed_state() bool FixedwingLandDetector::_get_landed_state()
{ {
// only trigger flight conditions if we are armed // only trigger flight conditions if we are armed
if (!_arming.armed) { if (!_actuator_armed.armed) {
return true; return true;
} }

6
src/modules/land_detector/LandDetector.cpp

@ -80,7 +80,7 @@ void LandDetector::Run()
perf_begin(_cycle_perf); perf_begin(_cycle_perf);
_check_params(false); _check_params(false);
_actuator_armed_sub.update(&_arming); _actuator_armed_sub.update(&_actuator_armed);
_update_topics(); _update_topics();
_update_state(); _update_state();
@ -124,7 +124,7 @@ void LandDetector::Run()
// set the flight time when disarming (not necessarily when landed, because all param changes should // set the flight time when disarming (not necessarily when landed, because all param changes should
// happen on the same event and it's better to set/save params while not in armed state) // happen on the same event and it's better to set/save params while not in armed state)
if (_takeoff_time != 0 && !_arming.armed && _previous_armed_state) { if (_takeoff_time != 0 && !_actuator_armed.armed && _previous_armed_state) {
_total_flight_time += now - _takeoff_time; _total_flight_time += now - _takeoff_time;
_takeoff_time = 0; _takeoff_time = 0;
@ -139,7 +139,7 @@ void LandDetector::Run()
_param_total_flight_time_low.commit_no_notification(); _param_total_flight_time_low.commit_no_notification();
} }
_previous_armed_state = _arming.armed; _previous_armed_state = _actuator_armed.armed;
perf_end(_cycle_perf); perf_end(_cycle_perf);

2
src/modules/land_detector/LandDetector.h

@ -153,7 +153,7 @@ protected:
systemlib::Hysteresis _ground_contact_hysteresis{true}; systemlib::Hysteresis _ground_contact_hysteresis{true};
systemlib::Hysteresis _ground_effect_hysteresis{false}; systemlib::Hysteresis _ground_effect_hysteresis{false};
actuator_armed_s _arming {}; actuator_armed_s _actuator_armed {};
private: private:

14
src/modules/land_detector/MulticopterLandDetector.cpp

@ -93,7 +93,7 @@ MulticopterLandDetector::MulticopterLandDetector()
void MulticopterLandDetector::_update_topics() void MulticopterLandDetector::_update_topics()
{ {
_actuator_controls_sub.update(&_actuator_controls); _actuator_controls_sub.update(&_actuator_controls);
_battery_sub.update(&_battery); _battery_sub.update(&_battery_status);
_sensor_bias_sub.update(&_sensor_bias); _sensor_bias_sub.update(&_sensor_bias);
_vehicle_attitude_sub.update(&_vehicle_attitude); _vehicle_attitude_sub.update(&_vehicle_attitude);
_vehicle_control_mode_sub.update(&_control_mode); _vehicle_control_mode_sub.update(&_control_mode);
@ -141,7 +141,7 @@ bool MulticopterLandDetector::_get_freefall_state()
bool MulticopterLandDetector::_get_ground_contact_state() bool MulticopterLandDetector::_get_ground_contact_state()
{ {
// When not armed, consider to have ground-contact // When not armed, consider to have ground-contact
if (!_arming.armed) { if (!_actuator_armed.armed) {
return true; return true;
} }
@ -192,7 +192,7 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
const hrt_abstime now = hrt_absolute_time(); const hrt_abstime now = hrt_absolute_time();
// When not armed, consider to be maybe-landed // When not armed, consider to be maybe-landed
if (!_arming.armed) { if (!_actuator_armed.armed) {
return true; return true;
} }
@ -239,7 +239,7 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
bool MulticopterLandDetector::_get_landed_state() bool MulticopterLandDetector::_get_landed_state()
{ {
// When not armed, consider to be landed // When not armed, consider to be landed
if (!_arming.armed) { if (!_actuator_armed.armed) {
return true; return true;
} }
@ -265,15 +265,15 @@ float MulticopterLandDetector::_get_max_altitude()
/* ToDo: add a meaningful altitude */ /* ToDo: add a meaningful altitude */
float valid_altitude_max = _params.altitude_max; float valid_altitude_max = _params.altitude_max;
if (_battery.warning == battery_status_s::BATTERY_WARNING_LOW) { if (_battery_status.warning == battery_status_s::BATTERY_WARNING_LOW) {
valid_altitude_max = _params.altitude_max * 0.75f; valid_altitude_max = _params.altitude_max * 0.75f;
} }
if (_battery.warning == battery_status_s::BATTERY_WARNING_CRITICAL) { if (_battery_status.warning == battery_status_s::BATTERY_WARNING_CRITICAL) {
valid_altitude_max = _params.altitude_max * 0.5f; valid_altitude_max = _params.altitude_max * 0.5f;
} }
if (_battery.warning == battery_status_s::BATTERY_WARNING_EMERGENCY) { if (_battery_status.warning == battery_status_s::BATTERY_WARNING_EMERGENCY) {
valid_altitude_max = _params.altitude_max * 0.25f; valid_altitude_max = _params.altitude_max * 0.25f;
} }

2
src/modules/land_detector/MulticopterLandDetector.h

@ -132,7 +132,7 @@ private:
uORB::Subscription _vehicle_local_position_setpoint_sub{ORB_ID(vehicle_local_position_setpoint)}; uORB::Subscription _vehicle_local_position_setpoint_sub{ORB_ID(vehicle_local_position_setpoint)};
actuator_controls_s _actuator_controls {}; actuator_controls_s _actuator_controls {};
battery_status_s _battery {}; battery_status_s _battery_status {};
vehicle_control_mode_s _control_mode {}; vehicle_control_mode_s _control_mode {};
sensor_bias_s _sensor_bias {}; sensor_bias_s _sensor_bias {};
vehicle_attitude_s _vehicle_attitude {}; vehicle_attitude_s _vehicle_attitude {};

2
src/modules/land_detector/RoverLandDetector.cpp

@ -67,7 +67,7 @@ bool RoverLandDetector::_get_maybe_landed_state()
bool RoverLandDetector::_get_landed_state() bool RoverLandDetector::_get_landed_state()
{ {
if (!_arming.armed) { if (!_actuator_armed.armed) {
return true; return true;
} }

Loading…
Cancel
Save