Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linorobot2 : when moves in real environment hitting objects which are left /right side which are not in same height of LIDAR plane #123

Open
hemsinghb opened this issue May 30, 2024 · 18 comments

Comments

@hemsinghb
Copy link

If anyone made a sonar range sensor with linorobot2 , please share the code to avoid obstacles.
Regars,
Hem.

@hippo5329
Copy link
Contributor

@hemsinghb
Copy link
Author

Thank You dear [hippo5329] !. I did the ultrasound sensor data publishes and also got range sensor cone on RVIZ.
Only issue is costmap_2d is not forming when place any obstruction in front of USS. only the cone size is increasing / decreasing. what is next.

my navigation.yaml is as under, please guide further:

global_costmap:
global_costmap:
ros__parameters:
use_sim_time: false
footprint_padding: 0.03
update_frequency: 10.0
publish_frequency: 10.0
global_frame: map
robot_base_frame: base_link
robot_radius: 0.22 # radius set and used, so no footprint points
resolution: 0.05
plugins: ["static_layer", "obstacle_layer", "voxel_layer", "inflation_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: true
observation_sources: scan base_scan
footprint_clearing_enabled: true
max_obstacle_height: 2.0
combination_method: 1
scan:
topic: /scan
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
max_obstacle_height: 2.0
min_obstacle_height: 0.0
clearing: true
marking: true
data_type: "LaserScan"
inf_is_valid: false
base_scan:
topic: /base/scan
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
max_obstacle_height: 2.0
min_obstacle_height: 0.0
clearing: true
marking: true
data_type: "LaserScan"
inf_is_valid: false
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: true
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: true
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
unknown_threshold: 15
mark_threshold: 0
observation_sources: pointcloud
combination_method: 1
pointcloud: # no frame set, uses frame from message
topic: /camera/depth/color/points
max_obstacle_height: 2.0
min_obstacle_height: 0.01
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
clearing: true
marking: true
data_type: "PointCloud2"
static_layer:
plugin: "nav2_costmap_2d::StaticLayer"
map_subscribe_transient_local: true
enabled: true
subscribe_to_updates: true
transform_tolerance: 0.1
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
enabled: true
inflation_radius: 0.55
cost_scaling_factor: 1.0
inflate_unknown: false
inflate_around_unknown: true
always_send_full_costmap: true

local_costmap:
local_costmap:
ros__parameters:
use_sim_time: false
update_frequency: 10.0
publish_frequency: 10.0
global_frame: odom
robot_base_frame: base_link
rolling_window: true
width: 3
height: 3
resolution: 0.05
robot_radius: 0.22 # radius set and used, so no footprint points
#plugins: ["obstacle_layer", "voxel_layer", "inflation_layer"]
plugins: ["obstacle_layer", "voxel_layer", "inflation_layer","sonar_layer"]
obstacle_layer:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: true
observation_sources: scan base_scan
footprint_clearing_enabled: true
max_obstacle_height: 2.0
combination_method: 1
scan:
topic: /scan
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 5.0
raytrace_min_range: 0.0
max_obstacle_height: 2.0
min_obstacle_height: 0.0
clearing: false
marking: true
data_type: "LaserScan"
inf_is_valid: false
track_unknown_space: true
inflate_unknown: true
base_scan:
topic: /base/scan
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
max_obstacle_height: 2.0
min_obstacle_height: 0.0
clearing: false
marking: true
data_type: "LaserScan"
inf_is_valid: false
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: true
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: true
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
unknown_threshold: 15
mark_threshold: 0
observation_sources: pointcloud
combination_method: 1
pointcloud: # no frame set, uses frame from message
topic: /camera/depth/color/points
max_obstacle_height: 2.0
min_obstacle_height: 0.01
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
clearing: true
marking: true
data_type: "PointCloud2"
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
enabled: true
inflation_radius: 0.3
cost_scaling_factor: 1.0
inflate_unknown: true
inflate_around_unknown: true

  sonar_layer:
    plugin: "nav2_costmap_2d::RangeSensorLayer"
    #plugin:"range_sensor_layer::RangeSensorLayer"
    frame_id: /range_link
    topic: /ultrasound_FL
    no_readings_timeout: 0.0
    clear_on_max_reading: true
    clear_threshold: 0.2
    mark_threshold: 1.0

---regards, Hem

@hippo5329
Copy link
Contributor

Indentation is very important in YAML. Please check your indentation. To show your code here, please fence your code blocks with three backticks (```) or three tildes (~~~) on the lines before and after the code block.

@hippo5329
Copy link
Contributor

hippo5329 commented Jul 3, 2024

mark_threshold: 0.8 , which is the default , probability.

@hippo5329
Copy link
Contributor

hippo5329 commented Jul 4, 2024

local_costmap.plugins: move sonar_layer before inflation_layer
global_costmap.plugins: add sonar_layer before inflation_layer

@hippo5329
Copy link
Contributor

  sonar_layer:
    plugin: "nav2_costmap_2d::RangeSensorLayer"
    topics: ["/ultrasound_FL"]
    clear_on_max_reading: true

@hemsinghb
Copy link
Author

hemsinghb commented Jul 5, 2024

hi dear Friends and Sirs.

From the above advises I just edited my .yaml file as follows:

global_costmap:
  global_costmap:
    ros__parameters:
      use_sim_time: false
      footprint_padding: 0.03
      update_frequency: 10.0
      publish_frequency: 10.0
      global_frame: map
      robot_base_frame: base_link
      robot_radius: 0.22 # radius set and used, so no footprint points
      resolution: 0.05
      plugins: ["static_layer", "obstacle_layer", "voxel_layer", "inflation_layer","sonar_layer"]
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: true
        observation_sources: scan base_scan
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        combination_method: 1
        scan:
          topic: /scan
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          clearing: true
          marking: true
          data_type: "LaserScan"
          inf_is_valid: false
        base_scan:
          topic: /base/scan
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          clearing: true
          marking: true
          data_type: "LaserScan"
          inf_is_valid: false
      voxel_layer:
        plugin: "nav2_costmap_2d::VoxelLayer"
        enabled: true
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        publish_voxel_map: true
        origin_z: 0.0
        z_resolution: 0.05
        z_voxels: 16
        max_obstacle_height: 2.0
        unknown_threshold: 15
        mark_threshold: 0
        observation_sources: pointcloud
        combination_method: 1
        pointcloud:  # no frame set, uses frame from message
          topic: /camera/depth/color/points
          max_obstacle_height: 2.0
          min_obstacle_height: 0.01
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          clearing: true
          marking: true
          data_type: "PointCloud2"
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: true
        enabled: true
        subscribe_to_updates: true
        transform_tolerance: 0.1
      sonar_layer:
        plugin: "nav2_costmap_2d::RangeSensorLayer"
        enabled: True
        topics: ["ultrasound_FL"]
        no_readings_timeout: 0.0
        clear_on_max_reading: true
        clear_threshold: 0.2
        mark_threshold: 0.8
        inflate_cone: 0.99         
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        enabled: true
        inflation_radius: 0.3
        cost_scaling_factor: 1.0
        inflate_unknown: false
        inflate_around_unknown: true
      always_send_full_costmap: true

local_costmap:
  local_costmap:
    ros__parameters:
      use_sim_time: false
      update_frequency: 5.0
      publish_frequency: 2.0
      global_frame: odom
      robot_base_frame: base_link
      rolling_window: true
      width: 3
      height: 3
      resolution: 0.05
      robot_radius: 0.22 # radius set and used, so no footprint points
      resolution: 0.05
      plugins: ["obstacle_layer", "voxel_layer", "inflation_layer","sonar_layer"]
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: true
        observation_sources: scan base_scan
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        combination_method: 1
        scan:
          topic: /scan
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          clearing: false
          marking: true
          data_type: "LaserScan"
          inf_is_valid: false
        base_scan:
          topic: /base/scan
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          clearing: false
          marking: true
          data_type: "LaserScan"
          inf_is_valid: false
      voxel_layer:
        plugin: "nav2_costmap_2d::VoxelLayer"
        enabled: true
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        publish_voxel_map: true
        origin_z: 0.0
        z_resolution: 0.05
        z_voxels: 16
        max_obstacle_height: 2.0
        unknown_threshold: 15
        mark_threshold: 0
        observation_sources: pointcloud
        combination_method: 1
        pointcloud:  # no frame set, uses frame from message
          topic: /camera/depth/color/points
          max_obstacle_height: 2.0
          min_obstacle_height: 0.01
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          clearing: true
          marking: true
          data_type: "PointCloud2"
      sonar_layer:
        plugin: "nav2_costmap_2d::RangeSensorLayer"
        enabled: True
        topics: ["ultrasound_FL"]
        no_readings_timeout: 0.0
        clear_on_max_reading: true
        clear_threshold: 0.2
        mark_threshold: 0.8
        inflate_cone: 0.99           
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        enabled: true
        inflation_radius: 0.3
        cost_scaling_factor: 1.0
        inflate_unknown: false
        inflate_around_unknown: true

But the costmap is not forming on rviz with USS (RangeSensorLayer).

I need your help to complete my project please..., Thank you.

---regards., Hem.

@hippo5329
Copy link
Contributor

The order of plugins is important.

global
plugins: ["static_layer", "obstacle_layer", "voxel_layer", "sonar_layer", "inflation_layer"]

local
plugins: ["obstacle_layer", "voxel_layer","sonar_layer", "inflation_layer"]

@hemsinghb
Copy link
Author

hemsinghb commented Jul 5, 2024 via email

@hemsinghb
Copy link
Author

the sequence is changed, however the message continuously on terminal is :

"No range readings received for --- seconds, while expected at least every 1.00 seconds"
as in my code "no_readings_timeout: 1.0 " is there.

Further help please .

@hippo5329
Copy link
Contributor

The topic must not be relative.
topics: ["/ultrasound_FL"]

Please revert to "no_readings_timeout: 0.0".

And check "ros2 topic hz /ultrasound_FL".

@hemsinghb
Copy link
Author

hemsinghb commented Jul 6, 2024 via email

@hippo5329
Copy link
Contributor

What is the rate of "ros2 topic hz /ultrasound_FL" ?

@hemsinghb
Copy link
Author

hemsinghb commented Jul 6, 2024 via email

@hemsinghb
Copy link
Author

hemsinghb commented Jul 6, 2024 via email

@hemsinghb
Copy link
Author

hemsinghb commented Jul 6, 2024 via email

@hippo5329
Copy link
Contributor

It might be a bug. I will look into this later. Thanks.

@hemsinghb
Copy link
Author

Hi ,

The bug is located on my .ino file .

changed Frame_id : "/range_link" to Frame_id : "range_link" in .ino hardware file, Now the costmap is working.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants