remove avoidance library and logic

Signed-off-by: Silvan <silvan@auterion.com>
This commit is contained in:
Silvan
2025-02-18 14:33:16 +01:00
committed by Silvan Fuhrer
parent d2cbe10243
commit 1f2dba68d2
21 changed files with 4 additions and 895 deletions
-26
View File
@@ -1717,8 +1717,6 @@ void Commander::updateParameters()
_vehicle_status.system_type = value_int32;
}
_vehicle_status.avoidance_system_required = _param_com_obs_avoid.get();
_auto_disarm_killed.set_hysteresis_time_from(false, _param_com_kill_disarm.get() * 1_s);
const bool is_rotary = is_rotary_wing(_vehicle_status) || (is_vtol(_vehicle_status)
@@ -1799,9 +1797,6 @@ void Commander::run()
_status_changed = true;
}
/* Update OA parameter */
_vehicle_status.avoidance_system_required = _param_com_obs_avoid.get();
handlePowerButtonState();
systemPowerUpdate();
@@ -2814,16 +2809,6 @@ void Commander::dataLinkCheck()
_vehicle_status.open_drone_id_system_present = true;
_vehicle_status.open_drone_id_system_healthy = healthy;
}
if (telemetry.heartbeat_component_obstacle_avoidance) {
if (_avoidance_system_lost) {
_avoidance_system_lost = false;
_status_changed = true;
}
_datalink_last_heartbeat_avoidance_system = telemetry.timestamp;
_vehicle_status.avoidance_system_valid = telemetry.avoidance_system_healthy;
}
}
}
@@ -2875,17 +2860,6 @@ void Commander::dataLinkCheck()
_open_drone_id_system_lost = true;
_status_changed = true;
}
// AVOIDANCE SYSTEM state check (only if it is enabled)
if (_vehicle_status.avoidance_system_required && !_onboard_controller_lost) {
// if heartbeats stop
if (!_avoidance_system_lost && (_datalink_last_heartbeat_avoidance_system > 0)
&& (hrt_elapsed_time(&_datalink_last_heartbeat_avoidance_system) > 5_s)) {
_avoidance_system_lost = true;
_vehicle_status.avoidance_system_valid = false;
}
}
}
void Commander::battery_status_check()
-3
View File
@@ -241,7 +241,6 @@ private:
Hysteresis _auto_disarm_killed{false};
hrt_abstime _datalink_last_heartbeat_open_drone_id_system{0};
hrt_abstime _datalink_last_heartbeat_avoidance_system{0};
hrt_abstime _datalink_last_heartbeat_gcs{0};
hrt_abstime _datalink_last_heartbeat_onboard_controller{0};
hrt_abstime _datalink_last_heartbeat_parachute_system{0};
@@ -268,7 +267,6 @@ private:
bool _failsafe_user_override_request{false}; ///< override request due to stick movements
bool _open_drone_id_system_lost{true};
bool _avoidance_system_lost{false};
bool _onboard_controller_lost{false};
bool _parachute_system_lost{true};
@@ -342,7 +340,6 @@ private:
(ParamBool<px4::params::COM_FORCE_SAFETY>) _param_com_force_safety,
(ParamFloat<px4::params::COM_KILL_DISARM>) _param_com_kill_disarm,
(ParamBool<px4::params::COM_MOT_TEST_EN>) _param_com_mot_test_en,
(ParamBool<px4::params::COM_OBS_AVOID>) _param_com_obs_avoid,
(ParamFloat<px4::params::COM_OBC_LOSS_T>) _param_com_obc_loss_t,
(ParamInt<px4::params::COM_PREARM_MODE>) _param_com_prearm_mode,
(ParamInt<px4::params::COM_RC_OVERRIDE>) _param_com_rc_override,
@@ -121,27 +121,6 @@ void SystemChecks::checkAndReport(const Context &context, Report &reporter)
}
}
// avoidance system
if (context.status().avoidance_system_required) {
if (context.status().avoidance_system_valid) {
reporter.setIsPresent(health_component_t::avoidance);
} else {
/* EVENT
* @description
* <profile name="dev">
* This check can be configured via <param>COM_OBS_AVOID</param> parameter.
* </profile>
*/
reporter.armingCheckFailure(NavModes::All, health_component_t::system, events::ID("check_system_avoidance_not_ready"),
events::Log::Error, "Avoidance system not ready");
if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Avoidance system not ready");
}
}
}
// VTOL in transition
if (context.status().is_vtol && !context.isArmed()) {
if (context.status().in_transition_mode) {
-8
View File
@@ -640,14 +640,6 @@ PARAM_DEFINE_INT32(COM_RCL_EXCEPT, 0);
*/
PARAM_DEFINE_INT32(COM_ACT_FAIL_ACT, 0);
/**
* Flag to enable obstacle avoidance.
*
* @boolean
* @group Commander
*/
PARAM_DEFINE_INT32(COM_OBS_AVOID, 0);
/**
* Expect and require a healthy MAVLink parachute system
*
@@ -35,5 +35,5 @@ px4_add_library(FlightTaskAuto
FlightTaskAuto.cpp
)
target_link_libraries(FlightTaskAuto PUBLIC avoidance FlightTask FlightTaskUtility WeatherVane)
target_link_libraries(FlightTaskAuto PUBLIC FlightTask FlightTaskUtility WeatherVane)
target_include_directories(FlightTaskAuto PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
@@ -156,12 +156,6 @@ bool FlightTaskAuto::update()
break;
}
if (_param_com_obs_avoid.get()) {
_obstacle_avoidance.updateAvoidanceDesiredSetpoints(_position_setpoint, _velocity_setpoint, (int)_type);
_obstacle_avoidance.injectAvoidanceSetpoints(_position_setpoint, _velocity_setpoint, _yaw_setpoint,
_yawspeed_setpoint);
}
_checkEmergencyBraking();
Vector3f waypoints[] = {_prev_wp, _position_setpoint, _next_wp};
@@ -477,17 +471,6 @@ bool FlightTaskAuto::_evaluateTriplets()
_updateInternalWaypoints();
}
if (_param_com_obs_avoid.get()
&& _sub_vehicle_status.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
_obstacle_avoidance.updateAvoidanceDesiredWaypoints(_triplet_target, _yaw_setpoint, _yawspeed_setpoint,
_triplet_next_wp,
_sub_triplet_setpoint.get().next.yaw,
(float)NAN,
_weathervane.isActive(), _sub_triplet_setpoint.get().current.type);
_obstacle_avoidance.checkAvoidanceProgress(
_position, _triplet_prev_wp, _target_acceptance_radius, Vector2f(_closest_pt));
}
// set heading
_weathervane.update();
@@ -53,13 +53,6 @@
#include "StickAccelerationXY.hpp"
#include "StickYaw.hpp"
// TODO: make this switchable in the board config, like a module
#if CONSTRAINED_FLASH
#include <lib/avoidance/ObstacleAvoidance_dummy.hpp>
#else
#include <lib/avoidance/ObstacleAvoidance.hpp>
#endif
/**
* This enum has to agree with position_setpoint_s type definition
* The only reason for not using the struct position_setpoint is because
@@ -147,8 +140,6 @@ protected:
AlphaFilter<float> _yawspeed_filter;
bool _yaw_sp_aligned{false};
ObstacleAvoidance _obstacle_avoidance{this}; /**< class adjusting setpoints according to external avoidance module's input */
PositionSmoothing _position_smoothing;
Vector3f _unsmoothed_velocity_setpoint;
Sticks _sticks{this};
@@ -165,7 +156,6 @@ protected:
(ParamFloat<px4::params::NAV_MC_ALT_RAD>)
_param_nav_mc_alt_rad, //vertical acceptance radius at which waypoints are updated
(ParamInt<px4::params::MPC_YAW_MODE>) _param_mpc_yaw_mode, // defines how heading is executed,
(ParamInt<px4::params::COM_OBS_AVOID>) _param_com_obs_avoid, // obstacle avoidance active
(ParamFloat<px4::params::MPC_YAWRAUTO_MAX>) _param_mpc_yawrauto_max,
(ParamFloat<px4::params::MIS_YAW_ERR>) _param_mis_yaw_err, // yaw-error threshold
(ParamFloat<px4::params::MPC_ACC_HOR>) _param_mpc_acc_hor, // acceleration in flight
@@ -68,5 +68,5 @@ private:
uint8_t _reset_counter{0}; /**< counter for estimator resets in xy-direction */
WeatherVane _weathervane{this}; /**< weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
CollisionPrevention _collision_prevention{this}; /**< collision avoidance setpoint amendment */
CollisionPrevention _collision_prevention{this}; /**< collision prevention setpoint amendment */
};
+1 -1
View File
@@ -123,7 +123,7 @@ PARAM_DEFINE_INT32(SDLOG_MISSION, 0);
* 4 : Full rates for analysis of fast maneuvers (RC, attitude, rates and actuators)
* 5 : Debugging topics (debug_*.msg topics, for custom code)
* 6 : Topics for sensor comparison (low rate raw IMU, Baro and magnetometer data)
* 7 : Topics for computer vision and collision avoidance
* 7 : Topics for computer vision and collision prevention
* 8 : Raw FIFO high-rate IMU (Gyro)
* 9 : Raw FIFO high-rate IMU (Accel)
* 10: Logging of mavlink tunnel message (useful for payload communication debugging)