# Revision history [back]

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map   obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map   obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package. package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map   obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map   obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Rviz Visualization

As you can see, costmap visualization of the sonar obstacles does not look correct. The entire region in front of the sonar should be an obstacle which is not the case.

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map    obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Rviz Visualization

As you can see, costmap visualization of the sonar obstacles does not look correct. The entire region in front of the sonar should be an obstacle which is not the case.

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Rviz Visualization

As you can see, costmap visualization of the sonar obstacles in RViz does not look seem to be correct. The entire region in front of the sonar should be an obstacle which is not the case.

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Rviz Visualization

As you can see, costmap visualization of the sonar obstacles in RViz does not seem to be look correct. The entire region in front of the sonar should be an obstacle which is not the case.happening.

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Rviz Visualization

As you can see, costmap visualization of the sonar obstacles in RViz does not look correct. The entire region in front of the sonar should be an obstacle which is not happening.

Update 2 (@Humpelstilzchen): I have pasted rostopic echo of single sonar message:

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation simulation

Global costmap Rviz Visualization Visualization

As you can see, costmap visualization of the sonar obstacles in RViz does not look correct. The entire region in front of the sonar should be an obstacle which is not happening.

Update 2 (@Humpelstilzchen): I have pasted rostopic echo of single sonar message:

Update 3: The local costmap visualization of the sonar obstacles looks correct. Its only the global costmap which is wrong.

Local costmap Rviz visualization

It looks like I am missing out on something obvious but I am not able to figure it out. Does anyone have any idea about it?

Naman Kumar

### Adding range_sensor_layer to layered costmap for global planning

Hi all,

I am working on mobile robot navigation with the Hokuyo and Ultrasonic sensors. Hokuyo will be the main sensor for navigation and Ultrasound sensors will be used to detect obstacles not seen by the hokuyo (like Overhangs, etc). I already have the map of the environment. I have Rotational encoders to get the odometry information and IMU/UWB for localization.
I have added a range_sensor_layer (http://wiki.ros.org/range_sensor_layer) for the ultrasound sensor to the costmap (local and global). I am using the move_base (http://wiki.ros.org/move_base) package for navigation. The problem is that global planner still gives a path which passes through the obstacles detected by the ultrasound sensor and only the local planner takes care of avoiding that obstacle. The global planner takes care of the objects detected by the Hokuyo sensor and plans the path accordingly but ignores the obstacles detected by the ultrasound sensor while global planning. So, I want to ask how can I correctly include range_sensor_layer in the global costmap so that the global path does not give a path through the obstacles detected by the ultrasound sensor?

The relevant parameters are shown:

local_costmap_params.yaml

plugins:
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}
sonar_layer:
topics: ["/sonar"]


global_costmap_params.yaml

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
- {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}

#Configuration for the sensors that the costmap will use to update a map
obstacle_layer:
observation_sources: base_scan
base_scan: {data_type: LaserScan, sensor_frame: /base_laser_link, topic: /base_scan, expected_update_rate: 0.4,
observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.08}

sonar_layer:
topics: ["/sonar"]


Update 1:
Gazebo simulation

Global costmap Rviz Visualization

As you can see, costmap visualization of the sonar obstacles in RViz does not look correct. The entire region in front of the sonar should be an obstacle which is not happening.

Update 2 (@Humpelstilzchen): I have pasted rostopic echo of single sonar message:

Update 3: The local costmap visualization of the sonar obstacles looks correct. Its only the global costmap which is wrong.

Local costmap Rviz visualization

It looks like I am missing out on something obvious but I am not able to figure it out. Does anyone have any idea about it?