ros-navigation / navigation2

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

bt_navigator problem following NAV2 tutorial on ROS2 HUMBLE #3986

Closed Cristian-wp closed 10 months ago

Cristian-wp commented 10 months ago

Premise: I have close all the other issue on robotics.stackexchange

Required Info:

Steps to reproduce issue

Hello I am Trying to follow Nav2 General Tutorial but I am stuck on the 3° one. I am following (STVL) Using an External Costmap Plugin tutorial, so I have modify the .../nav2_ws/src/navigation2/nav2_bringup/params/nav2_params.yaml file as you can see below

global_costmap:
  global_costmap:
    ros__parameters:
      update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      use_sim_time: True
      robot_radius: 0.22
      resolution: 0.05
      track_unknown_space: true
      plugins: ["static_layer", "obstacle_layer", "inflation_layer","stvl_layer"]
      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
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: True
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        cost_scaling_factor: 3.0
        inflation_radius: 0.55
      stvl_layer:
        plugin: "spatio_temporal_voxel_layer/SpatioTemporalVoxelLayer"
        enabled: true
        voxel_decay: 15.
        decay_model: 0
        voxel_size: 0.05
        track_unknown_space: true
        unknown_threshold: 15
        mark_threshold: 0
        update_footprint_enabled: true
        combination_method: 1
        origin_z: 0.0
        publish_voxel_map: true
        transform_tolerance: 0.2
        mapping_mode: false
        map_save_duration: 60.0
        observation_sources: pointcloud
        pointcloud:
          data_type: PointCloud2
          topic: /intel_realsense_r200_depth/points
          marking: true
          clearing: true
          obstacle_range: 3.0
          min_obstacle_height: 0.0
          max_obstacle_height: 2.0
          expected_update_rate: 0.0
          observation_persistence: 0.0
          inf_is_valid: false
          filter: "voxel"
          voxel_min_points: 0
          clear_after_reading: true
          max_z: 7.0
          min_z: 0.1
          vertical_fov_angle: 0.8745
          horizontal_fov_angle: 1.048
          decay_acceleration: 15.0
          model_type: 0
      always_send_full_costmap: True

map_server:
  ros__parameters:
    use_sim_time: True
    # Overridden in launch by the "map" launch configuration or provided default value.
    # To use in yaml, remove the default "map" value in the tb3_simulation_launch.py file & provide full path to map below.
    yaml_filename: ""

map_saver:
  ros__parameters:
    use_sim_time: True
    save_map_timeout: 5.0
    free_thresh_default: 0.25
    occupied_thresh_default: 0.65
    map_subscribe_transient_local: True

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

smoother_server:
  ros__parameters:
    use_sim_time: True
    smoother_plugins: ["simple_smoother"]
    simple_smoother:
      plugin: "nav2_smoother::SimpleSmoother"
      tolerance: 1.0e-10
      max_its: 1000
      do_refinement: True

behavior_server:
  ros__parameters:
    costmap_topic: local_costmap/costmap_raw
    footprint_topic: local_costmap/published_footprint
    cycle_frequency: 10.0
    behavior_plugins: ["spin", "backup", "drive_on_heading", "assisted_teleop", "wait"]
    spin:
      plugin: "nav2_behaviors/Spin"
    backup:
      plugin: "nav2_behaviors/BackUp"
    drive_on_heading:
      plugin: "nav2_behaviors/DriveOnHeading"
    wait:
      plugin: "nav2_behaviors/Wait"
    assisted_teleop:
      plugin: "nav2_behaviors/AssistedTeleop"
    global_frame: odom
    robot_base_frame: base_link
    transform_tolerance: 0.1
    use_sim_time: true
    simulate_ahead_time: 2.0
    max_rotational_vel: 1.0
    min_rotational_vel: 0.4
    rotational_acc_lim: 3.2

robot_state_publisher:
  ros__parameters:
    use_sim_time: True

waypoint_follower:
  ros__parameters:
    use_sim_time: True
    loop_rate: 20
    stop_on_failure: false
    waypoint_task_executor_plugin: "wait_at_waypoint"
    wait_at_waypoint:
      plugin: "nav2_waypoint_follower::WaitAtWaypoint"
      enabled: True
      waypoint_pause_duration: 200

velocity_smoother:
  ros__parameters:
    use_sim_time: True
    smoothing_frequency: 20.0
    scale_velocities: False
    feedback: "OPEN_LOOP"
    max_velocity: [0.26, 0.0, 1.0]
    min_velocity: [-0.26, 0.0, -1.0]
    max_accel: [2.5, 0.0, 3.2]
    max_decel: [-2.5, 0.0, -3.2]
    odom_topic: "odom"
    odom_duration: 0.1
    deadband_velocity: [0.0, 0.0, 0.0]
    velocity_timeout: 1.0

Expected behavior

I can compile with colcon build without problem, and I launch the simulation with the instruction present in Getting Started guide

source install/setup.bash
source /opt/ros/humble/setup.bash
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

Rviz and Gazebo starts without problem, so I try to set the initial position using the RViz tool to set the 2D position.

Actual behavior

I get this errors related to bt_navigator_navigate_through_poses_rclcpp_node and ClearLocalCostmap-Context service.

[component_container_isolated-6] [INFO] [1700747075.744384530] [amcl]: initialPoseReceived
[component_container_isolated-6] [WARN] [1700747075.744464553] [amcl]: Failed to transform initial pose in time (Lookup would require extrapolation into the future.  Requested time 1700747075.744045 but the latest data is at time 68.620000, when looking up transform from frame [odom] to frame [base_footprint])
[component_container_isolated-6] [INFO] [1700747075.744486915] [amcl]: Setting pose (68.573000): -1.725 -0.550 -0.000
…
…
…

[component_container_isolated-6] [INFO] [1700747076.978213901] [global_costmap.global_costmap]: start
[component_container_isolated-6] [INFO] [1700747076.979088382] [global_costmap.global_costmap]: stvl_layer was activated.
[rviz2-5] [INFO] [1700747078.110917337] [rviz2]: Trying to create a map of size 384 x 384 using 1 swatches
[component_container_isolated-6] [INFO] [1700747078.130239045] [planner_server]: Activating plugin GridBased of type NavfnPlanner
[component_container_isolated-6] [INFO] [1700747078.131932311] [planner_server]: Creating bond (planner_server) to lifecycle manager.
[component_container_isolated-6] [INFO] [1700747078.235845201] [lifecycle_manager_navigation]: Server planner_server connected with bond.
[component_container_isolated-6] [INFO] [1700747078.235922404] [lifecycle_manager_navigation]: Activating behavior_server
[component_container_isolated-6] [INFO] [1700747078.236110266] [behavior_server]: Activating
[component_container_isolated-6] [INFO] [1700747078.236128571] [behavior_server]: Activating spin
[component_container_isolated-6] [INFO] [1700747078.236148381] [behavior_server]: Activating backup
[component_container_isolated-6] [INFO] [1700747078.236157517] [behavior_server]: Activating drive_on_heading
[component_container_isolated-6] [INFO] [1700747078.236165938] [behavior_server]: Activating assisted_teleop
[component_container_isolated-6] [INFO] [1700747078.236173881] [behavior_server]: Activating wait
[component_container_isolated-6] [INFO] [1700747078.236184165] [behavior_server]: Creating bond (behavior_server) to lifecycle manager.
[component_container_isolated-6] [INFO] [1700747078.340675430] [lifecycle_manager_navigation]: Server behavior_server connected with bond.
[component_container_isolated-6] [INFO] [1700747078.340706854] [lifecycle_manager_navigation]: Activating bt_navigator
[component_container_isolated-6] [INFO] [1700747078.340956629] [bt_navigator]: Activating
[component_container_isolated-6] [ERROR] [1700747079.353942866] [bt_navigator_navigate_through_poses_rclcpp_node]: "ClearLocalCostmap-Context" service server not available after waiting for 1 s
[component_container_isolated-6] Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"...
[ERROR] [component_container_isolated-6]: process has died [pid 39315, exit code -6, cmd '/opt/ros/humble/lib/rclcpp_components/component_container_isolated --ros-args --log-level info --ros-args -r __node:=nav2_container --params-file /tmp/launch_params_0agn279w --params-file /tmp/launch_params_qg_e7vqu -r /tf:=tf -r /tf_static:=tf_static'].

I can not find any clue about why the ClearLocalCostmap-Context service server is not avaiable, but I think is something related to bt_navigator because following the next tutorial Navigating Using GPS Localization when I launch ros2 launch nav2_gps_waypoint_follower_demo gps_waypoint_follower.launch.py use_rviz:=True

I get the following error:

[lifecycle_manager-14] [INFO] [1700832618.874720224] [lifecycle_manager_navigation]: Configuring bt_navigator
[bt_navigator-11] [INFO] [1700832618.874903793] [bt_navigator]: Configuring
[bt_navigator-11] [ERROR] [1700832618.913140548] [bt_navigator]: Caught exception in callback for transition 10
[bt_navigator-11] [ERROR] [1700832618.913171216] [bt_navigator]: Original error: Could not load library: libnav2_are_error_codes_active_condition_bt_node.so: cannot open shared object file: No such file or directory
[bt_navigator-11] [WARN] [1700832618.913190111] [bt_navigator]: Error occurred while doing error handling.
[bt_navigator-11] [FATAL] [1700832618.913198917] [bt_navigator]: Lifecycle node bt_navigator does not have error state implemented
[lifecycle_manager-14] [ERROR] [1700832618.913455290] [lifecycle_manager_navigation]: Failed to change state for node: bt_navigator
[lifecycle_manager-14] [ERROR] [1700832618.913479267] [lifecycle_manager_navigation]: Failed to bring up all requested nodes. Aborting bringup.

Can someone please help me to solve this problem? Thanks in advance.

SteveMacenski commented 10 months ago

libnav2_are_error_codes_active_condition_bt_node.so

You’re pulling params from the wrong branch. That doesnt exist in humble. We also don’t support BT.CPP v4 yet so there are likely other errors going on outside of our support versions. Please use what we ship with, debug, or ask on Robotics Stack Exchange. We don’t have cycles as a maintaining team to debug all specific user errors in system configuration. It works in our nightly CI, developer local work, dozens of companies, and build farm. We’re confident that things like this work properly.

Cristian-wp commented 10 months ago

I use this command: git clone --recursive https://github.com/ros-planning/navigation2.git -b humble Maybe the branch is worng...It is not the firts time I read this kind of reply "You’re pulling params from the wrong branch." from you.

I do not want be impolite to you but, if I have downloaded it with that command how is possible get another branch?

Plus investigating I found that use the following instruction reported in Getting Started:

sudo apt install ros-<ros2-distro>-navigation2
sudo apt install ros-<ros2-distro>-nav2-bringup

does not install all the necessary package, even if I launch rosdep install --from-paths src --ignore-src. So I decided to install all the package with: sudo apt install ros-humble-nav2-* It is not a clean solution, but it install all the package relative to nav2 and had fix this error.