mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 12:03:34 +08:00
land_detector: cleanup actuator_armed and battery_status naming
* Rename _arming -> _actuator_armed * Rename _battery -> _battery_status in the MulticopterLandDetector class.
This commit is contained in:
@@ -88,7 +88,7 @@ float FixedwingLandDetector::_get_max_altitude()
|
||||
bool FixedwingLandDetector::_get_landed_state()
|
||||
{
|
||||
// only trigger flight conditions if we are armed
|
||||
if (!_arming.armed) {
|
||||
if (!_actuator_armed.armed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void LandDetector::Run()
|
||||
perf_begin(_cycle_perf);
|
||||
|
||||
_check_params(false);
|
||||
_actuator_armed_sub.update(&_arming);
|
||||
_actuator_armed_sub.update(&_actuator_armed);
|
||||
_update_topics();
|
||||
_update_state();
|
||||
|
||||
@@ -124,7 +124,7 @@ void LandDetector::Run()
|
||||
|
||||
// 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)
|
||||
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;
|
||||
_takeoff_time = 0;
|
||||
|
||||
@@ -139,7 +139,7 @@ void LandDetector::Run()
|
||||
_param_total_flight_time_low.commit_no_notification();
|
||||
}
|
||||
|
||||
_previous_armed_state = _arming.armed;
|
||||
_previous_armed_state = _actuator_armed.armed;
|
||||
|
||||
perf_end(_cycle_perf);
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ protected:
|
||||
systemlib::Hysteresis _ground_contact_hysteresis{true};
|
||||
systemlib::Hysteresis _ground_effect_hysteresis{false};
|
||||
|
||||
actuator_armed_s _arming {};
|
||||
actuator_armed_s _actuator_armed {};
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ MulticopterLandDetector::MulticopterLandDetector()
|
||||
void MulticopterLandDetector::_update_topics()
|
||||
{
|
||||
_actuator_controls_sub.update(&_actuator_controls);
|
||||
_battery_sub.update(&_battery);
|
||||
_battery_sub.update(&_battery_status);
|
||||
_sensor_bias_sub.update(&_sensor_bias);
|
||||
_vehicle_attitude_sub.update(&_vehicle_attitude);
|
||||
_vehicle_control_mode_sub.update(&_control_mode);
|
||||
@@ -141,7 +141,7 @@ bool MulticopterLandDetector::_get_freefall_state()
|
||||
bool MulticopterLandDetector::_get_ground_contact_state()
|
||||
{
|
||||
// When not armed, consider to have ground-contact
|
||||
if (!_arming.armed) {
|
||||
if (!_actuator_armed.armed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
|
||||
// When not armed, consider to be maybe-landed
|
||||
if (!_arming.armed) {
|
||||
if (!_actuator_armed.armed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ bool MulticopterLandDetector::_get_maybe_landed_state()
|
||||
bool MulticopterLandDetector::_get_landed_state()
|
||||
{
|
||||
// When not armed, consider to be landed
|
||||
if (!_arming.armed) {
|
||||
if (!_actuator_armed.armed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -265,15 +265,15 @@ float MulticopterLandDetector::_get_max_altitude()
|
||||
/* ToDo: add a meaningful altitude */
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
uORB::Subscription _vehicle_local_position_setpoint_sub{ORB_ID(vehicle_local_position_setpoint)};
|
||||
|
||||
actuator_controls_s _actuator_controls {};
|
||||
battery_status_s _battery {};
|
||||
battery_status_s _battery_status {};
|
||||
vehicle_control_mode_s _control_mode {};
|
||||
sensor_bias_s _sensor_bias {};
|
||||
vehicle_attitude_s _vehicle_attitude {};
|
||||
|
||||
@@ -67,7 +67,7 @@ bool RoverLandDetector::_get_maybe_landed_state()
|
||||
|
||||
bool RoverLandDetector::_get_landed_state()
|
||||
{
|
||||
if (!_arming.armed) {
|
||||
if (!_actuator_armed.armed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user