tsengapola / costmap_depth_camera

This is a costmap plugin for costmap_2d pkg. This plugin supports multiple depth cameras and run in real time.
https://github.com/tsengapola/costmap_depth_camera
BSD 2-Clause "Simplified" License
64 stars 19 forks source link

Obstacle does not inflate around it #11

Open mustafaktaasbirfen opened 3 months ago

mustafaktaasbirfen commented 3 months ago

Hello good work, I can get the package to work properly. But I have a problem, the obstacle that appears in the inflation layer does not inflate around it. Therefore it is moving too close to the target. What do you suggest for this? Also, is there a problem if I add it to both local and global costmap? I think you only added it to global_costmap. Below are the parameters and an example image:

global_costmap: global_costmap: ros__parameters: update_frequency: 1.0 publish_frequency: 1.0 global_frame: map robot_base_frame: base_footprint use_sim_time: True footprint: "[[-0.599, -0.389], [-0.599, 0.389], [0.599, 0.389], [0.599, -0.389]]" resolution: 0.05 track_unknown_space: true plugins: ["static_layer", "depth_camera", "obstacle_layer", "voxel_layer", "inflation_layer"] static_layer: plugin: "nav2_costmap_2d::StaticLayer" map_subscribe_transient_local: True depth_camera: plugin: "nav2_costmap_2d::DepthCameraObstacleLayer" use_global_frame_to_mark: True forced_clearing_distance: 0.3 #0.1 ec_seg_distance: 0.1 # 0.2 ec_cluster_min_size: 6 # 5 size_of_cluster_rejection: 6 # 5 voxel_resolution: 0.2 check_radius: 0.2 # 0.1 number_clearing_threshold: 2 #2 enable_near_blocked_protection: False #False number_points_considered_as_blocked: 6 # 5 use_voxelized_observation: False observation_sources: top_depth_cam bottom_depth_cam rear_depth_cam top_depth_cam: sensor_frame: front_top_link #front_top_bottom_screw_frame topic: /front_top/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.3962 #FOV_W: 1.3962 FOV_V: 0.9599 #FOV_V: 0.9599 min_detect_distance: 0.15 # 0.15 max_detect_distance: 2.5 # 4.0 min_obstacle_height: 0.1 # 0.2 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: False marking: True bottom_depth_cam: sensor_frame: front_bottom_link topic: /front_bottom/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.0 FOV_V: 0.9 min_detect_distance: 0.05 max_detect_distance: 3.0 min_obstacle_height: 0.085 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: True marking: True rear_depth_cam: sensor_frame: rear_link #front_top_bottom_screw_frame topic: /rear/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.3962 #FOV_W: 1.3962 FOV_V: 0.9599 #FOV_V: 0.9599 min_detect_distance: 0.15 # 0.15 max_detect_distance: 2.5 # 4.0 min_obstacle_height: 0.1 # 0.2 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: False marking: True obstacle_layer: plugin: "nav2_costmap_2d::ObstacleLayer" enabled: True observation_sources: scan scan: topic: /scan max_obstacle_height: 2.0 clearing: True marking: True data_type: "LaserScan" raytrace_max_range: 3.0 raytrace_min_range: 0.0 obstacle_max_range: 2.5 obstacle_min_range: 0.0

scan:

    #   topic: /depth_scan
    #   max_obstacle_height: 2.0
    #   clearing: True
    #   marking: True
    #   data_type: "LaserScan"
  voxel_layer:
    plugin: "nav2_costmap_2d::VoxelLayer"
    enabled: True
    publish_voxel_map: True
    origin_z: 0.0
    z_resolution: 0.05
    z_voxels: 16
    max_obstacle_height: 2.0
    mark_threshold: 0
    observation_sources: scan
    scan:
      topic: /scan
      max_obstacle_height: 2.0
      clearing: True
      marking: True
      data_type: "LaserScan"
      raytrace_max_range: 3.0
      raytrace_min_range: 0.0
      obstacle_max_range: 2.5
      obstacle_min_range: 0.0
  inflation_layer:
    plugin: "nav2_costmap_2d::InflationLayer"
    cost_scaling_factor: 7.58 # 5.0 , 6.58
    inflation_radius: 0.45
    inflate_around_unknown: True
    inflate_unknown: true
  always_send_full_costmap: True

global_costmap_client: ros__parameters: use_sim_time: False global_costmap_rclcpp_node: ros__parameters: use_sim_time: False

planner_server: ros__parameters: expected_planner_frequency: 20.0 use_sim_time: False planner_plugins: ["GridBased"] GridBased: plugin: "nav2_navfn_planner/NavfnPlanner" tolerance: 0.2 use_astar: false allow_unknown: true

local_costmap: local_costmap: ros__parameters: update_frequency: 5.0 publish_frequency: 2.0 global_frame: odom robot_base_frame: base_footprint use_sim_time: False rolling_window: true width: 10 height: 10 resolution: 0.05 footprint: "[[-0.599, -0.389], [-0.599, 0.389], [0.599, 0.389], [0.599, -0.389]]" plugins: ["depth_camera", "obstacle_layer", "voxel_layer", "inflation_layer"] depth_camera: plugin: "nav2_costmap_2d::DepthCameraObstacleLayer" use_global_frame_to_mark: False forced_clearing_distance: 0.3 #0.1 ec_seg_distance: 0.1 # 0.2 ec_cluster_min_size: 6 # 5 size_of_cluster_rejection: 6 # 5 voxel_resolution: 0.2 check_radius: 0.2 # 0.1 number_clearing_threshold: 2 #2 enable_near_blocked_protection: False #False number_points_considered_as_blocked: 6 # 5 use_voxelized_observation: False observation_sources: top_depth_cam bottom_depth_cam rear_depth_cam top_depth_cam: sensor_frame: front_top_link #front_top_bottom_screw_frame topic: /front_top/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.3962 #FOV_W: 1.3962 FOV_V: 0.9599 #FOV_V: 0.9599 min_detect_distance: 0.15 # 0.15 max_detect_distance: 2.5 # 4.0 min_obstacle_height: 0.1 # 0.2 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: True marking: True bottom_depth_cam: sensor_frame: front_bottom_link topic: /front_bottom/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.0 FOV_V: 0.9 min_detect_distance: 0.05 max_detect_distance: 3.0 min_obstacle_height: 0.085 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: True marking: True rear_depth_cam: sensor_frame: rear_link #front_top_bottom_screw_frame topic: /rear/depth/color/points/voxel_grid expected_update_rate: 20.0 FOV_W: 1.3962 #FOV_W: 1.3962 FOV_V: 0.9599 #FOV_V: 0.9599 min_detect_distance: 0.15 # 0.15 max_detect_distance: 2.5 # 4.0 min_obstacle_height: 0.1 # 0.2 obstacle_range: 4.0 raytrace_range: 4.0 clearing: True inf_is_valid: False marking: True obstacle_layer: plugin: "nav2_costmap_2d::ObstacleLayer" enabled: True observation_sources: scan scan: topic: /scan max_obstacle_height: 2.0 clearing: True marking: True data_type: "LaserScan"

scan:

    #   topic: /depth_scan
    #   max_obstacle_height: 2.0
    #   clearing: True
    #   marking: True
    #   data_type: "LaserScan" 
  voxel_layer:
    plugin: "nav2_costmap_2d::VoxelLayer"
    enabled: True
    publish_voxel_map: True
    origin_z: 0.0
    z_resolution: 0.05
    z_voxels: 16
    max_obstacle_height: 2.0
    mark_threshold: 0
    observation_sources: scan
    scan:
      topic: /scan
      max_obstacle_height: 2.0
      clearing: True
      marking: True
      data_type: "LaserScan"
      raytrace_max_range: 6.0
      raytrace_min_range: 0.0
      obstacle_max_range: 2.5
      obstacle_min_range: 0.0
  inflation_layer:
    plugin: "nav2_costmap_2d::InflationLayer"
    inflation_radius: 0.3 # 0.3 , 0.2
    cost_scaling_factor: 7.58 # 5.0 , 6.58
  static_layer:
    map_subscribe_transient_local: True
  always_send_full_costmap: True

local_costmap_client: ros__parameters: use_sim_time: False local_costmap_rclcpp_node: ros__parameters: use_sim_time: False

deneme

mustafaktaasbirfen commented 3 months ago

I solved the problems I mentioned as follows. I changed the order of the other layers in the code and it worked. However, I am still not sure about adding to both local and global. I would appreciate if you could answer me about this.

Now I am having a problem with the camera I am trying to recognize objects on the ground. This camera is looking at the ground at an angle of 45 degrees. The min_obstacle_height parameter makes sense for this problem but it still doesn't help. What is your suggestion? Thanks for your help.

Finally, I think I'm having a problem with the rate even though I added all my cameras. I couldn't understand why this was happening. I am sharing a video about this. As far as you see in the video, can you give me suggestions? With what parameters can I solve this? Thank you for your help :)

https://github.com/tsengapola/costmap_depth_camera/assets/146711068/e76483a9-66fe-40a5-a132-fb8e16dd6e46

I know I'm asking a lot, but there's also this. When I set a target, while on the road, the robot restarts itself as follows. What could be the reason for this?

[controller_server-4] [WARN] [1713435607.389645516] [controller_server]: Control loop missed its desired rate of 20.0000Hz [controller_server-4] [INFO] [1713435607.537871033] [controller_server]: Passing new path to controller. [controller_server-4] [WARN] [1713435608.393579341] [controller_server]: Control loop missed its desired rate of 20.0000Hz [controller_server-4] [INFO] [1713435608.587873359] [controller_server]: Passing new path to controller. [controller_server-4] [WARN] [1713435609.388577696] [controller_server]: Control loop missed its desired rate of 20.0000Hz [controller_server-4] [ERROR] [1713431614.190267569] [controller_server]: Failed to make progress [controller_server-4] [WARN] [1713431614.190313717] [controller_server]: [follow_path] [ActionServer] Aborting handle. [bt_navigator-8] [WARN] [1713431614.223529956] [BehaviorTreeEngine]: Behavior Tree tick rate 100.00 was exceeded! [bt_navigator-8] [WARN] [1713431614.233657685] [bt_navigator_navigate_to_pose_rclcpp_node]: Node timed out while executing service call to local_costmap/clear_entirely_local_costmap. [behavior_server-7] [INFO] [1713431614.234263159] [behavior_server]: Running backup [bt_navigator-8] [WARN] [1713431614.234601292] [BehaviorTreeEngine]: Behavior Tree tick rate 100.00 was exceeded! [controller_server-4] [INFO] [1713431614.321130461] [local_costmap.local_costmap]: Received request to clear entirely the local_costmap [controller_server-4] [INFO] [1713431614.322130052] [local_costmap.local_costmap]: depth_camera was reseted. [controller_server-4] [INFO] [1713431614.322156736] [local_costmap.local_costmap]: depth_camera was deactivated. [controller_server-4] [INFO] [1713431614.325269695] [local_costmap.local_costmap]: depth_camera was activated.