Collision prevention using PX4 for Airsim by QGC

I have set up a simple environment on Airsim and used PX4 on WSL for the Autopilot part. Then I used QGC for the path planning. But, collision prevention seems not to be working! each time the drone hits the wall.
I used the Distance and Lidar on the drone sensors as well.
Need to mention that if I enable the COM_OBS_AVOID parameter in QGS, the drone will not be armed. I put CP_DIST=5, and COM_CPU_MAX=90%.

I would appreciate it if anyone has any suggestions.

@Pooyanght , Collision prevention doesn’t work in mission mode. It’s only for position mode.

@Neo_man Thank you for your answer. So, can you tell me how I can I use a controller and px4 together with the QGC on Airsim?
I think I will need the RC for the position mode to check it, and if you could tell me how to modify the Airsim json file or if I need to do anything more as well, that would be great. If there is any link I an follow and you can share it with me, that would be great as well.

Thank you so much,