Robotics StackExchange | Archived questions

local costmap not showing in rviz2

Background info:

ROS 2 info:

ROSVERSION=2 ROSPYTHONVERSION=3 ROSLOCALHOSTONLY=0 ROSDISTRO=galactic

Problem:

Hello all,

I am encountering a very strange issue in rviz2.
I have recorded a ros2 bag that contains tf transform from map->odom->baselink by using the robotlocalization package, as shown below.

image description

After I launch my Nav2, I was able to see both map information on both /global_costmap/costmap and /map topics. However, I was not able to see the localcostmap on /localcostmap/costmap.

Moreover, when I tried to echo to the local_costmap/costmap topic, I was able to see information published on the local_costmap, as shown below. image description

Error Code:

The only that I have gotten a "Message Filter dropping message: frame 'odom' at time 1690921914.628 for reason 'discarding message because the queue is full' message in the rviz2 terminal, as shown below. According to a similar ros answer, the issue is caused by a missing transform. However, I don't think to be the case in this situation, because I do have a complete TF transform from map -> base_link as shown in the first picture. image description

Things I have tried:

  1. Change the QOS setting in rviz2 from Reliable to Best Effort, as shown below. However, I am still not getting any update in Rviz2 for local costmap. Note: the moving of the robot (red and green arrow) is just a replay of history from the bag, I have not yet set a goal to Nav2 to tell it where to move the robot. image description
  2. According to This ros answer, I have double-check that my RMW_IMPLEMENTATION ins cyclonedds, which is the default of Galactic.

configure file

bt_navigator:
  ros__parameters:
    use_sim_time: False
    global_frame: map
    robot_base_frame: base_link
    odom_topic: /odometry/global
    bt_loop_duration: 10
    default_server_timeout: 20
    enable_groot_monitoring: True
    groot_zmq_publisher_port: 1666
    groot_zmq_server_port: 1667
    # 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
    # nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
    # nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
    # They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
    plugin_lib_names:
    - nav2_compute_path_to_pose_action_bt_node
    - nav2_compute_path_through_poses_action_bt_node
    - nav2_follow_path_action_bt_node
    - nav2_back_up_action_bt_node
    - nav2_spin_action_bt_node
    - nav2_wait_action_bt_node
    - nav2_clear_costmap_service_bt_node
    - nav2_is_stuck_condition_bt_node
    - nav2_goal_reached_condition_bt_node
    - nav2_goal_updated_condition_bt_node
    - nav2_initial_pose_received_condition_bt_node
    - nav2_reinitialize_global_localization_service_bt_node
    - nav2_rate_controller_bt_node
    - nav2_distance_controller_bt_node
    - nav2_speed_controller_bt_node
    - nav2_truncate_path_action_bt_node
    - nav2_goal_updater_node_bt_node
    - nav2_recovery_node_bt_node
    - nav2_pipeline_sequence_bt_node
    - nav2_round_robin_node_bt_node
    - nav2_transform_available_condition_bt_node
    - nav2_time_expired_condition_bt_node
    - nav2_distance_traveled_condition_bt_node
    - nav2_single_trigger_bt_node
    - nav2_is_battery_low_condition_bt_node
    - nav2_navigate_through_poses_action_bt_node
    - nav2_navigate_to_pose_action_bt_node
    - nav2_remove_passed_goals_action_bt_node
    - nav2_planner_selector_bt_node
    - nav2_controller_selector_bt_node
    - nav2_goal_checker_selector_bt_node

controller_server:
  ros__parameters:
    # controller server parameters (see Controller Server for more info)
    controller_frequency: 20.0
    min_x_velocity_threshold: 0.001
    min_y_velocity_threshold: 0.5
    min_theta_velocity_threshold: 0.001
    progress_checker_plugin: "progress_checker"
    goal_checker_plugins: ["goal_checker"]
    controller_plugins: ["FollowPath"]
    progress_checker:
      plugin: "nav2_controller::SimpleProgressChecker"
      required_movement_radius: 0.5
      movement_time_allowance: 10.0
    goal_checker:
      plugin: "nav2_controller::SimpleGoalChecker"
      xy_goal_tolerance: 1.0
      yaw_goal_tolerance: 6.29
      stateful: True
    # DWB controller parameters
    FollowPath:
      transform_tolerance: 5.0
      plugin: "dwb_core::DWBLocalPlanner"
      debug_trajectory_details: False
      forward_prune_distance: 0.2
      min_vel_x: 0.0
      min_vel_y: 0.0
      max_vel_x: 0.0
      max_vel_y: 1.0 # 1.0 # was 2.23
      max_vel_theta: 0.5 # 0.5 # was 1.0
      min_speed_xy: 0.0
      max_speed_xy: 1.0 # 0.5 # was 2.23
      min_speed_theta: 0.0
      acc_lim_x: 0.0
      acc_lim_y: 1.25
      acc_lim_theta: 3.2
      decel_lim_x: 0.0
      decel_lim_y: -2.5
      decel_lim_theta: -3.2
      vx_samples: 1
      vy_samples: 20
      vtheta_samples: 20
      sim_time: 1.7
      linear_granularity: 0.05
      angular_granularity: 0.025
      xy_goal_tolerance: 1.0
      trans_stopped_velocity: 0.25
      short_circuit_trajectory_evaluation: True
      stateful: True
      critics: ["Oscillation", "BaseObstacle", "PathDist", "PathAlign", "GoalDist"] #, "PreferForward"]
      BaseObstacle.scale: 0.16
      PathAlign.scale: 64.0
      PathAlign.forward_point_distance: 0.1
      # PreferForward.scale: 16.0
      # PreferForward.strafe_theta: 0.3
      PathDist.scale: 32.0
      GoalDist.scale: 24.0

global_costmap:
  global_costmap:
    ros__parameters:
      transform_timeout: 5.0
     update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      footprint: "[ [ 0.28, 0.4 ], [ -0.25, 0.4 ], [ -0.65, 0.4 ], [ -1.05, 0 ],[ -0.65, -0.4 ], [ -0.25, -0.4 ], [ 0.28, -0.4 ] ]"
      resolution: 0.1
      track_unknown_space: false
      rolling_window: false
      width: 100
      height: 100
      origin_x: -50.0
      origin_y: -50.0
      plugins: ["static_layer"]
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: True
        subscribe_to_updates: True
      always_send_full_costmap: True
local_costmap:
  local_costmap:
    ros__parameters:
      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
      plugins: ["static_layer"]
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: True
        subscribe_to_updates: True
      always_send_full_costmap: True


planner_server:
  ros__parameters:
    planner_plugins: ['GridBased']
    use_sim_time: False
    GridBased:
      plugin: 'nav2_navfn_planner/NavfnPlanner'
      use_final_approach_orientation: True
      use_astar: True
      allow_unknown: True
      tolerance: 1.0

recoveries_server:
  ros__parameters:
    costmap_topic: local_costmap/costmap_raw
    footprint_topic: local_costmap/published_footprint
    cycle_frequency: 10.0
    recovery_plugins: ["spin", "wait", "backup"]
    spin:
      plugin: "nav2_recoveries/Spin"
    backup:
      plugin: "nav2_recoveries/BackUp"
    wait:
      plugin: "nav2_recoveries/Wait"
    global_frame: odom
    robot_base_frame: base_link
    transform_timeout: 0.1
    use_sim_time: False
    simulate_ahead_time: 2.0
    max_rotational_vel: 1.0
    min_rotational_vel: 0.4
    rotational_acc_lim: 3.0



map_server:
  ros__parameters:
    # use_sim_time: True
    #TODO: change to relative
    yaml_filename: "/home/shouyu/nav2_ws/src/fishbot/src/fishbot_navigation2/maps/fishbot_map.yaml" # this is being overrided

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
waypoint_follower:
  ros__parameters:
    waypoint_task_executor_plugin: "wait_at_waypoint"
    wait_at_waypoint:
      plugin: "nav2_waypoint_follower::WaitAtWaypoint"
      enabled: True
      waypoint_pause_duration: 0

Asked by sdu568 on 2023-08-01 16:09:25 UTC

Comments

Answers