mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 18:03:35 +08:00
Add a collision avoidance library which uses range data
This commit is contained in:
@@ -113,6 +113,12 @@ void FlightTaskManualPosition::_scaleSticks()
|
||||
|
||||
/* Rotate setpoint into local frame. */
|
||||
_rotateIntoHeadingFrame(vel_sp_xy);
|
||||
|
||||
//collision avoidance
|
||||
if (_ext_collision_avoidance != nullptr && _ext_collision_avoidance->is_active()) {
|
||||
_ext_collision_avoidance->modifySetpoint(vel_sp_xy, _constraints.speed_xy);
|
||||
}
|
||||
|
||||
_velocity_setpoint(0) = vel_sp_xy(0);
|
||||
_velocity_setpoint(1) = vel_sp_xy(1);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,12 @@ public:
|
||||
*/
|
||||
void setYawHandler(WeatherVane *yaw_handler) override { _weathervane_yaw_handler = yaw_handler; }
|
||||
|
||||
/**
|
||||
* Sets an external collision avoidance which can be used to modify setpoints
|
||||
*/
|
||||
void setCollisionAvoidance(CollisionAvoidance *ext_collision_avoidance) override {_ext_collision_avoidance = ext_collision_avoidance;}
|
||||
|
||||
|
||||
protected:
|
||||
void _updateXYlock(); /**< applies position lock based on stick and velocity */
|
||||
void _updateSetpoints() override;
|
||||
@@ -74,4 +80,5 @@ private:
|
||||
WeatherVane *_weathervane_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
CollisionAvoidance *_ext_collision_avoidance = nullptr; /**< external collision avoidance library*/
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user