I know exactly what you mean, this stuff is quite confusing. Honestly, I am not 100% sure I know how to detect obstacles in the SITL simulated environment. However, there are some tricks you can possibly take advantage of. For example, if you want to run the collision avoidance behavior defined by the param AVOID_BEHAVE, you can set:
- AVOID_ENABLE = 1 ( use fence for avoidance input sensing )
- FENCE_ENABLE = 1 ( enable fence functionality )
This way, when you create a fence in SITL and fly the drone into it, it should detect the fence as an obstacle and then run the collision avoidance algorithm implemented in one of the avoidance library files. I am not entirely sure how to set up an actual obstacle in SITL, unfortunately. You can look at my other post on obstacle avoidance on tips for how to set up rangefinders. One thing that you might consider is possibly setting up SITL with gazebo if you want better visualization or using the log files from mission planner if you are using that ( I think those have a good way of viewing the flight data ).
I haven’t gotten around to fully testing these features yet, so I am not entirely sure all this will work.
Hope this helps you get started!