ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.48k stars 1.25k forks source link

Costmap obstacle layer do not work #3055

Closed RayOwwen closed 2 years ago

RayOwwen commented 2 years ago

Bug report

Required Info:

Steps to reproduce issue

  1. Start simulation
    ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

Expected behavior

Actual behavior

global_costmap and local_costmap obstacle layer do not work.

Additional information

Modify the obstacle_layer.cpp, comment the line 226, the costmap seems work well.

    if (data_type == "LaserScan") {
      auto sub = std::make_shared<message_filters::Subscriber<sensor_msgs::msg::LaserScan,
          rclcpp_lifecycle::LifecycleNode>>(node, topic, custom_qos_profile, sub_opt);
          // sub->unsubscribe();

      auto filter = std::make_shared<tf2_ros::MessageFilter<sensor_msgs::msg::LaserScan>>(
        *sub, *tf_, global_frame_, 50,
padhupradheep commented 2 years ago

Already reported https://github.com/ros-planning/navigation2/issues/3014 ! More info https://github.com/ros-planning/navigation2/pull/3018

SteveMacenski commented 2 years ago

Indeed More info here https://discourse.ros.org/t/nav2-issues-with-humble-binaries-due-to-fast-dds-rmw-regression/26128/2 but the other ticket is where we're tracking it.

Switch to Cyclone RMW and it is not an issue

marpeja commented 2 years ago

Sorry for my ignorance, but how can you change from Fast DDS to Cyclone RMW?

I am strugling with the same problem in ROS2 Galactic, and want to see if this solve the problem there too

padhupradheep commented 2 years ago

check here: https://docs.ros.org/en/humble/Installation/DDS-Implementations/Working-with-Eclipse-CycloneDDS.html

I am strugling with the same problem in ROS2 Galactic, and want to see if this solve the problem there too

Are you sure? We didn't experience any issues off late. Could you explain it a bit in detail?

marpeja commented 2 years ago

I am using RTABMAP along with Nav2 and ROS2 Galactic. The robot uses a RGBD camera and I am using the depthimage_to_laserscan package to transform the images into a laserscan.

First of all it is worth to mention that the local costmap only appears if it is defined with an static_layer, like the global costmap. Otherwise it doesn't appear.

Moreover, you can see here an image of the problem. Once the map is mapped using RTABMAP, I introduce a rock in the middle of the cave, that, as you can see, it is detected by the laserscan and so by the camera. However, the local costmap doesn`t reflect this obstacle in the map.

image

I attach here the definition of the local costmap plugins.

plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        cost_scaling_factor: 3.0
        inflation_radius: 0.6
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: True
        observation_sources: scan
        scan:
          topic: /scan
          max_obstacle_height: 5.0
          min_obstacle_height: 0.0
          obstacle_max_range: 6.0
          obstacle_min_range: 0.0
          raytrace_max_range: 10.0
          raytrace_min_range: 0.0
          clearing: True
          marking: True
          data_type: "LaserScan"
      static_layer:
        map_subscribe_transient_local: True
      always_send_full_costmap: True
padhupradheep commented 2 years ago

I understand, but this issue is not anyways related to the original issue posted in this forum. The original issue is somehow related to the FastRTPS middleware and yours I assume it somehow related to the configuration.

I hope someone can help you at answers.ros.org

marpeja commented 2 years ago

So you believe this isn't a problem related to FastRPS right?