mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
Check for OA interface failures only after it has been activated
The OA interface is 'activated' when it receives the first trajectory message.
This commit is contained in:
committed by
Daniel Agar
parent
e721d8dd8f
commit
1e39c4828f
@@ -86,8 +86,12 @@ void ObstacleAvoidance::injectAvoidanceSetpoints(Vector3f &pos_sp, Vector3f &vel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (avoidance_invalid) {
|
if (avoidance_invalid) {
|
||||||
|
if (_avoidance_activated) {
|
||||||
|
// Invalid point received: deactivate
|
||||||
PX4_WARN("Obstacle Avoidance system failed, loitering");
|
PX4_WARN("Obstacle Avoidance system failed, loitering");
|
||||||
_publishVehicleCmdDoLoiter();
|
_publishVehicleCmdDoLoiter();
|
||||||
|
_avoidance_activated = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_failsafe_position.isAllFinite()) {
|
if (!_failsafe_position.isAllFinite()) {
|
||||||
// save vehicle position when entering failsafe
|
// save vehicle position when entering failsafe
|
||||||
@@ -98,10 +102,15 @@ void ObstacleAvoidance::injectAvoidanceSetpoints(Vector3f &pos_sp, Vector3f &vel
|
|||||||
vel_sp.setNaN();
|
vel_sp.setNaN();
|
||||||
yaw_sp = NAN;
|
yaw_sp = NAN;
|
||||||
yaw_speed_sp = NAN;
|
yaw_speed_sp = NAN;
|
||||||
|
|
||||||
|
// Do nothing further - wait until activation
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else if (!_avoidance_activated) {
|
||||||
|
// First setpoint has been received: activate
|
||||||
|
PX4_INFO("Obstacle Avoidance system activated");
|
||||||
_failsafe_position.setNaN();
|
_failsafe_position.setNaN();
|
||||||
|
_avoidance_activated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avoidance_point_valid && !wp_msg_timeout) {
|
if (avoidance_point_valid && !wp_msg_timeout) {
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ protected:
|
|||||||
matrix::Vector3f _position = {}; /**< current vehicle position */
|
matrix::Vector3f _position = {}; /**< current vehicle position */
|
||||||
matrix::Vector3f _failsafe_position = {}; /**< vehicle position when entered in failsafe */
|
matrix::Vector3f _failsafe_position = {}; /**< vehicle position when entered in failsafe */
|
||||||
|
|
||||||
|
bool _avoidance_activated{false}; /**< true after the first avoidance setpoint is received */
|
||||||
|
|
||||||
systemlib::Hysteresis _avoidance_point_not_valid_hysteresis{false}; /**< becomes true if the companion doesn't start sending valid setpoints */
|
systemlib::Hysteresis _avoidance_point_not_valid_hysteresis{false}; /**< becomes true if the companion doesn't start sending valid setpoints */
|
||||||
systemlib::Hysteresis _no_progress_z_hysteresis{false}; /**< becomes true if the vehicle is not making progress towards the z component of the goal */
|
systemlib::Hysteresis _no_progress_z_hysteresis{false}; /**< becomes true if the vehicle is not making progress towards the z component of the goal */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user