PX4/avoidance GlobalPlanner fly through wall (ROS)

Hello everyone,

I encountered a problem using the global planner in our simulation. Therefore I used a modified launch-file to launch the global_planner_node and the octomap_server. The PX4-SITL and our gazebo-world with our drone (and its sensor: a velodyne lidar) is launched beforehand. Normal flights perform as expected, the drone can be controlled by a gamepad in position mode and when I change to offboard mode it navigates around objects (based on the global-planner) when a rviz navigation point is set.

But after I tested for a while - especially with changes to the octomap-server for the voxel size (here 0.75m) and hit/miss evaluation - I encountered the following problems:

As you can see on the pictures (a1) and (a2) which show the same flight path from different views the drone could fly through a wall even though it is a massive wall with no way around. I expected the drone to stop before it or increase its height to reach the upper ending or fly as far as it can to the left /right side (even so this wouldn’t have worked because this wall is a big box surrounding the whole simulation area). So I would guess an internal cost term for flying around the wall is bigger than just passing through the object - maybe someone can help me to find the corresponding functions/parameters in the global_planner source code?

Something similar happened on the picture (b) the drone moved around the scaffold/framework of the gazebo water-tower model and I tried out what would happen it the target position was between/inside of the structure so the drone navigated to one of the holes and passed to the inside. I tested it multiple times and here the same happened as before, some of the paths went through the object instead of around. I would prefer to have a minimum distance which is kept at all times between an object and the drone - to even disable flying through such a narrow framework.

I was curious which data are used to determine the distance to an object - is it the octomap data or the current sensor-data?
I just hope someone can give me some information about how everything works and where to change the code to run it with no issues.