# Collision Prevention

**URL:** <https://discuss.px4.io/t/collision-prevention/34985>\
**Category:** PX4 Autopilot\
**Created:** [October 27, 2023, 9:27pm UTC](https://discuss.px4.io/t/collision-prevention/34985 "2023-10-27T21:27:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AWilkins\_Ascend](https://discuss.px4.io/user_avatar/discuss.px4.io/awilkins_ascend/32/8388_2.png) [@AWilkins\_Ascend](https://discuss.px4.io/u/AWilkins_Ascend)\
**Post date:** [October 27, 2023, 9:27pm UTC](https://discuss.px4.io/t/collision-prevention/34985/1 "2023-10-27T21:27:18Z")

</div>

Hello,

We have been getting a few requests to have our UAV “auto-yaw” to prevent collision with obstacles.

For example, let’s say we have a curved hallway, and our operator wants to fly straight down it. The operator should just move the stick forward and the drone will follow the wall around

 ![image](https://discuss.px4.io/uploads/default/original/2X/2/2511ac2c160611953b5d16038fd87f939058cbd7.png)

We were thinking of doing this on the PX4 side. Has anyone thought to do this before, and if so are there any algorithms/research we can reference to implement this?

---

<div class="post-metadata">

**Author:** ![Karl\_S](https://discuss.px4.io/user_avatar/discuss.px4.io/karl_s/32/14567_2.png) [@Karl\_S](https://discuss.px4.io/u/Karl_S)\
**Post date:** [October 28, 2023, 11:53am UTC](https://discuss.px4.io/t/collision-prevention/34985/2 "2023-10-28T11:53:10Z")

</div>

I believe this can be already done with Ardupilot using LIDAR sensors.

[https://ardupilot.org/copter/docs/common-object-avoidance-landing-page.html?highlight=obstacle+avoidance](https://ardupilot.org/copter/docs/common-object-avoidance-landing-page.html?highlight=obstacle+avoidance)

---

<div class="post-metadata">

**Author:** ![AWilkins\_Ascend](https://discuss.px4.io/user_avatar/discuss.px4.io/awilkins_ascend/32/8388_2.png) [@AWilkins\_Ascend](https://discuss.px4.io/u/AWilkins_Ascend)\
**Post date:** [November 1, 2023, 4:16pm UTC](https://discuss.px4.io/t/collision-prevention/34985/3 "2023-11-01T16:16:54Z")

</div>

From Daniel:

Depends on what data that you have. is there nice granular data to work with, or are you sticking

Collision Prevention was in manual position control mode. it constrains the allowable velocity setpoint so you dont hit something.

Daniel has personally never gotten great results. He has created a forcefield before that will bring you to a stop, but can push you back.

Daniel mentioned it might be better to check out collision prevention CP\_GUIDE\_ANG and see if there is a fix there.
