ros-navigation / navigation2

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

Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3617.600000 #3746

Closed Rak-r closed 1 year ago

Rak-r commented 1 year ago

Bug report

Required Info:

Expected behavior

Should run NAV2

Actual behavior

**The launch file seems ok because the last output I am getting is [lifecycle_manager-5] [INFO] [1691409212.195861492] [lifecycle_manager_navigation]: Creating bond timer...

I have provided use_sim_time true everywhere but I don't why it is coming.**

`[bt_navigator-4] [INFO] [1691424773.213829933] [bt_navigator]: Begin navigating from current location to (-3.35, 2.02) [planner_server-2] [ERROR] [1691424774.006121032] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3617.600000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424774.006158189] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424774.006191148] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [planner_server-2] [INFO] [1691424774.024193653] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424774.864641914] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3618.100000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424774.864672393] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424774.864695616] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [controller_server-1] [INFO] [1691424774.884121835] [local_costmap.local_costmap]: Received request to clear entirely the local_costmap [planner_server-2] [INFO] [1691424774.884386162] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424775.871126413] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3618.700000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424775.871156354] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424775.871178511] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [planner_server-2] [INFO] [1691424775.885008689] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424776.872278416] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3619.400000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424776.872311456] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424776.872334640] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [behavior_server-3] [INFO] [1691424776.884494541] [behavior_server]: Running spin [behavior_server-3] [INFO] [1691424776.884605657] [behavior_server]: Turning 1.57 for spin behavior. [behavior_server-3] [WARN] [1691424786.884706643] [behavior_server]: Exceeded time allowance before reaching the Spin goal - Exiting Spin [behavior_server-3] [WARN] [1691424786.884743251] [behavior_server]: spin failed [behavior_server-3] [WARN] [1691424786.884756924] [behavior_server]: [spin] [ActionServer] Aborting handle. [behavior_server-3] [INFO] [1691424786.904300441] [behavior_server]: Running wait [behavior_server-3] [INFO] [1691424791.904446638] [behavior_server]: wait completed successfully [planner_server-2] [ERROR] [1691424792.730907641] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3629.300000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424792.730940504] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424792.730967524] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [planner_server-2] [INFO] [1691424792.744965117] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424793.884840781] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3630.100000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424793.884876311] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424793.884901487] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [behavior_server-3] [INFO] [1691424793.904321399] [behavior_server]: Running backup [behavior_server-3] [WARN] [1691424803.904854927] [behavior_server]: Exceeded time allowance before reaching the DriveOnHeading goal - Exiting DriveOnHeading [behavior_server-3] [WARN] [1691424803.904900950] [behavior_server]: backup failed [behavior_server-3] [WARN] [1691424803.904915892] [behavior_server]: [backup] [ActionServer] Aborting handle. [controller_server-1] [INFO] [1691424803.924166316] [local_costmap.local_costmap]: Received request to clear entirely the local_costmap [planner_server-2] [INFO] [1691424803.925834499] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424804.953690738] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3636.800000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424804.953725100] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424804.953756433] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [planner_server-2] [INFO] [1691424804.974156585] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap [planner_server-2] [ERROR] [1691424805.873393475] [transformPoseInTargetFrame]: Extrapolation Error looking up target frame: Lookup would require extrapolation into the future. Requested time 1691424773.212782 but the latest data is at time 3637.400000, when looking up transform from frame [map] to frame [odom] [planner_server-2] [planner_server-2] [WARN] [1691424805.873427951] [planner_server]: Could not transform the start or goal pose in the costmap frame [planner_server-2] [WARN] [1691424805.873451366] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle. [behavior_server-3] [INFO] [1691424805.886282248] [behavior_server]: Running spin [behavior_server-3] [INFO] [1691424805.886342571] [behavior_server]: Turning 1.57 for spin behavior. [behavior_server-3] [WARN] [1691424815.886495257] [behavior_server]: Exceeded time allowance before reaching the Spin goal - Exiting Spin [behavior_server-3] [WARN] [1691424815.886531813] [behavior_server]: spin failed [behavior_server-3] [WARN] [1691424815.886543222] [behavior_server]: [spin] [ActionServer] Aborting handle. [behavior_server-3] [INFO] [1691424815.904248890] [behavior_server]: Running wait ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)

[behavior_server-3] [WARN] [1691424820.013017797] [behavior_server]: [wait] [ActionServer] Current goal was not completed successfully. [behavior_server-3] [WARN] [1691424820.013030629] [behavior_server]: [wait] [ActionServer] Aborting handle.

[bt_navigator-4] [ERROR] [1691424820.015943750] [bt_navigator_navigate_to_pose_rclcpp_node]: Failed to cancel action server for wait [bt_navigator-4] [ERROR] [1691424820.015972266] [bt_navigator]: Goal failed [bt_navigator-4] [WARN] [1691424820.015978480] [bt_navigator]: [navigate_to_pose] [ActionServer] Aborting handle. ` Rviz terminal

INFO] [1691424593.162180817] [rviz2]: Stereo is NOT SUPPORTED [INFO] [1691424593.162263645] [rviz2]: OpenGl version: 4.6 (GLSL 4.6) [INFO] [1691424593.245426436] [rviz2]: Stereo is NOT SUPPORTED [INFO] [1691424594.202458378] [rviz2]: Trying to create a map of size 497 x 690 using 1 swatches [INFO] [1691424595.576636466] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.400 for reason 'discarding message because the queue is full' [INFO] [1691424595.578249360] [rviz2]: Trying to create a map of size 40 x 72 using 1 swatches [INFO] [1691424608.497790289] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.340 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424608.638460499] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.420 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424608.797992462] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.520 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424608.958005021] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.660 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.138368467] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.792 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.138433644] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.780 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.437795833] [rviz]: Message Filter dropping message: frame 'odom' at time 3503.900 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.598690495] [rviz]: Message Filter dropping message: frame 'odom' at time 3504.040 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.757843284] [rviz]: Message Filter dropping message: frame 'odom' at time 3504.160 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.757930649] [rviz]: Message Filter dropping message: frame 'odom' at time 3504.108 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424609.917779096] [rviz]: Message Filter dropping message: frame 'odom' at time 3504.280 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424610.264886326] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.500 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424610.419989745] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.600 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424610.578142275] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.700 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424610.734351666] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.800 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424610.892626986] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3503.900 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424611.053671294] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3504.000 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424611.210692273] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3504.100 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424611.376196048] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3504.200 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424611.535705311] [rviz]: Message Filter dropping message: frame 'velodyne_link' at time 3504.300 for reason 'the timestamp on the message is earlier than all the data in the transform cache' [INFO] [1691424760.451556865] [rviz2]: Setting estimate pose: Frame:map, Position(6.09147, 2.47838, 0), Orientation(0, 0, -0.502147, 0.864782) = Angle: -1.05216 Start navigation [INFO] [1691424773.213060000] [_]: NavigateToPose will be called using the BT Navigator's default behavior tree.

One change I made is remapped the odometry topic coming from gazebo to /odom topic so that it can publish the transform odom to base_link.

This looks similar : [(https://github.com/https://github.com/ros-planning/navigation2/issues/3352#issue-1522875908)] But I have already switched to Cyclone DDS Could you advice me something from the given information?

I have set the fixed frame to map and tried setting and then Nav2goal in rviz. Seems it is recieving the commands but the issue reminas same as above.

My nav2 params

`amcl: rosparameters: alpha1: 0.2 alpha2: 0.2 alpha3: 0.2 alpha4: 0.2 alpha5: 0.1 base_frame_id: "base_link" beam_skip_distance: 0.5 beam_skip_error_threshold: 0.9 beam_skip_threshold: 0.3 do_beamskip: false global_frame_id: "map" lambda_short: 0.1 laser_likelihood_max_dist: 2.0 laser_max_range: 50.0 laser_min_range: -1.0 laser_model_type: "likelihood_field" max_beams: 60 max_particles: 1000 min_particles: 10000 odom_frame_id: "odom" pf_err: 0.05 pf_z: 0.99 recovery_alpha_fast: 0.0 recovery_alpha_slow: 0.0 resample_interval: 1 robot_model_type: "nav2_amcl::DifferentialMotionModel" save_pose_rate: 0.5 sigma_hit: 0.2 tf_broadcast: true transform_tolerance: 1.0 update_min_a: 0.2 update_min_d: 0.25 z_hit: 0.5 z_max: 0.05 z_rand: 0.5 z_short: 0.05 scan_topic: scan map_topic: map set_initial_pose: false always_reset_initial_pose: false first_map_only: false initial_pose: x: 0.0 y: 0.0 z: 0.0 yaw: 0.0 amcl_map_client: rosparameters: use_sim_time: True

amcl_rclcpp_node: ros__parameters: use_sim_time: True

bt_navigator: ros__parameters: use_sim_time: True global_frame: map robot_base_frame: base_link odom_topic: /odom bt_loop_duration: 10 plugin_lib_names:

bt_navigator_navigate_through_poses_rclcpp_node: ros__parameters: use_sim_time: True

bt_navigator_navigate_to_pose_rclcpp_node: ros__parameters: use_sim_time: True controller_server: ros__parameters:

controller server parameters (see Controller Server for more info)

use_sim_time: True
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: 0.25
  yaw_goal_tolerance: 0.25
  stateful: True
# DWB controller parameters
FollowPath:
  plugin: "dwb_core::DWBLocalPlanner"
  debug_trajectory_details: True
  min_vel_x: 0.0
  min_vel_y: 0.0
  max_vel_x: 0.26
  max_vel_y: 0.0
  max_vel_theta: 1.0
  min_speed_xy: 0.0
  max_speed_xy: 0.26
  min_speed_theta: 0.0
  acc_lim_x: 2.5
  acc_lim_y: 0.0
  acc_lim_theta: 3.2
  decel_lim_x: -2.5
  decel_lim_y: 0.0
  decel_lim_theta: -3.2
  vx_samples: 20
  vy_samples: 5
  vtheta_samples: 20
  sim_time: 1.7
  linear_granularity: 0.05
  angular_granularity: 0.025
  transform_tolerance: 0.2
  xy_goal_tolerance: 0.25
  trans_stopped_velocity: 0.25
  short_circuit_trajectory_evaluation: True
  stateful: True
  critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
  BaseObstacle.scale: 0.02
  PathAlign.scale: 32.0
  GoalAlign.scale: 24.0
  PathAlign.forward_point_distance: 0.1
  GoalAlign.forward_point_distance: 0.1
  PathDist.scale: 32.0
  GoalDist.scale: 24.0
  RotateToGoal.scale: 32.0
  RotateToGoal.slowing_factor: 5.0
  RotateToGoal.lookahead_time: -1.0

controller_server_rclcpp_node: ros__parameters: use_sim_time: True

local costmap configurations

local_costmap: local_costmap: rosparameters: update_frequency: 5.0 publish_frequency: 2.0 global_frame: odom robot_base_frame: base_link use_sim_time: True rolling_window: true width: 10 height: 18 resolution: 0.25 footprint_padding: 0.01 plugins: ["obstacle_layer", "inflation_layer"] inflation_layer: plugin: "nav2_costmap_2d::InflationLayer" inflation_radius: 0.2 cost_scaling_factor: 30.0 obstacle_layer: plugin: "nav2_costmap_2d::ObstacleLayer" enabled: True observation_sources: scan scan: topic: /scan max_obstacle_height: 2.5 clearing: True marking: True data_type: "LaserScan" static_layer: map_subscribe_transient_local: True always_send_full_costmap: True local_costmap_client: rosparameters: use_sim_time: True local_costmap_rclcpp_node: ros__parameters: use_sim_time: True

global costmap configurations

global_costmap: global_costmap: ros__parameters: footprint_padding: 0.05 update_frequency: 1.0 publish_frequency: 1.0 global_frame: odom robot_base_frame: base_link use_sim_time: True robot_radius: 0.5 # radius set and used, so no footprint points resolution: 0.05 transform_tolerance: 0.5 plugins: ["static_layer", "obstacle_layer", "inflation_layer"] obstacle_layer: plugin: "nav2_costmap_2d::ObstacleLayer" enabled: True observation_sources: scan footprint_clearing_enabled: true max_obstacle_height: 2.0 combination_method: 1 scan: topic: /scan obstacle_max_range: 5.0 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

    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.5
     cost_scaling_factor: 1.0
     inflate_unknown: false
     inflate_around_unknown: true
     always_send_full_costmap: True

global_costmap_client: rosparameters: use_sim_time: True global_costmap_rclcpp_node: ros__parameters: use_sim_time: True planner_server: rosparameters: planner_plugins: ["GridBased"] use_sim_time: True

GridBased:
  plugin: "nav2_smac_planner/SmacPlannerHybrid"
  downsample_costmap: false           # whether or not to downsample the map
  downsampling_factor: 1              # multiplier for the resolution of the costmap layer (e.g. 2 on a 5cm costmap would be 10cm)
  tolerance: 0.25                     # dist-to-goal heuristic cost (distance) for valid tolerance endpoints if exact goal cannot be found.
  allow_unknown: true                 # allow traveling in unknown space
  max_iterations: 1000000             # maximum total iterations to search for before failing (in case unreachable), set to -1 to disable
  max_on_approach_iterations: 1000    # Maximum number of iterations after within tolerances to continue to try to find exact solution
  max_planning_time: 5.0              # max time in s for planner to plan, smooth
  motion_model_for_search: "REEDS_SHEPP"    # Hybrid-A* Dubin, Redds-Shepp
  angle_quantization_bins: 72         # Number of angle bins for search
  analytic_expansion_ratio: 3.5       # The ratio to attempt analytic expansions during search for final approach.
  analytic_expansion_max_length: 3.0  # For Hybrid/Lattice nodes: The maximum length of the analytic expansion to be considered valid to prevent unsafe shortcutting
  minimum_turning_radius: 0.40        # minimum turning radius in m of path / vehicle
  reverse_penalty: 2.0                # Penalty to apply if motion is reversing, must be => 1
  change_penalty: 0.0                 # Penalty to apply if motion is changing directions (L to R), must be >= 0
  non_straight_penalty: 1.2           # Penalty to apply if motion is non-straight, must be => 1
  cost_penalty: 2.0                   # Penalty to apply to higher cost areas when adding into the obstacle map dynamic programming distance expansion heuristic. This drives the robot more towards the center of passages. A value between 1.3 - 3.5 is reasonable.
  retrospective_penalty: 0.015
  lookup_table_size: 20.0             # Size of the dubin/reeds-sheep distance window to cache, in meters.
  cache_obstacle_heuristic: false     # Cache the obstacle map dynamic programming distance expansion heuristic between subsiquent replannings of the same goal location. Dramatically speeds up replanning performance (40x) if costmap is largely static.
  smooth_path: True                   # If true, does a simple and quick smoothing post-processing to the path

  smoother:
    max_iterations: 1000
    w_smooth: 0.3
    w_data: 0.2
    tolerance: 1.0e-10
    do_refinement: true
    refinement_num: 2

planner_server_rclcpp_node: ros__parameters: use_sim_time: True map_server: ros__parameters: use_sim_time: True yaml_filename: "map.yaml"

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

behavior server configurations

behavior_server: ros__parameters: use_sim_time: True local_costmap_topic: local_costmap/costmap_raw local_footprint_topic: local_costmap/published_footprint global_costmap_topic: global_costmap/costmap_raw global_footprint_topic: global_costmap/published_footprint cycle_frequency: 10.0 behavior_plugins: ["spin", "backup", "wait"] spin: plugin: "nav2_behaviors/Spin" backup: plugin: "nav2_behaviors/BackUp"

wait:
  plugin: "nav2_behaviors/Wait"
#local_frame: odom
global_frame: odom
robot_base_frame: base_link
transform_timeout: 0.1
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`

Launch file

`import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node from nav2_common.launch import RewrittenYaml

def generate_launch_description():

Get the launch directory

bringup_dir = get_package_share_directory('nav2_bringup')
# nav2_params_path = os.path.join(
#     get_package_share_directory('pod2_navigation'),
#     'config/',
#     'nav2_params.yaml')

namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
autostart = LaunchConfiguration('autostart')
params_file = LaunchConfiguration('params_file')
default_nav_to_pose_bt_xml = LaunchConfiguration('default_nav_to_pose_bt_xml')
map_subscribe_transient_local = LaunchConfiguration('map_subscribe_transient_local')
pod2_param = get_package_share_directory('pod2_navigation')
lifecycle_nodes = ['controller_server',
                   'planner_server',
                   'behavior_server',
                   'bt_navigator']

# Map fully qualified names to relative ones so the node's namespace can be prepended.
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative
# https://github.com/ros/geometry2/issues/32
# https://github.com/ros/robot_state_publisher/pull/30
# TODO(orduno) Substitute with `PushNodeRemapping`
#              https://github.com/ros2/launch_ros/issues/56
remappings = [('/tf', 'tf'),
            ('/tf_static', 'tf_static')]

# Create our own temporary YAML files that include substitutions
param_substitutions = {
    'use_sim_time': use_sim_time,
    'autostart': autostart,
    'default_nav_to_pose_bt_xml': default_nav_to_pose_bt_xml,
    'map_subscribe_transient_local': map_subscribe_transient_local
    }

configured_params = RewrittenYaml(
        source_file=params_file,
        root_key=namespace,
        param_rewrites=param_substitutions,
        convert_types=True)

return LaunchDescription([
    # Set env var to print messages to stdout immediately
    SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'),

    DeclareLaunchArgument(
        'namespace', default_value='',
        description='Top-level namespace'),

    DeclareLaunchArgument(
        'use_sim_time', default_value='true',
        description='Use simulation (Gazebo) clock if true'),

    DeclareLaunchArgument(
        'autostart', default_value='true',
        description='Automatically startup the nav2 stack'),

    DeclareLaunchArgument(
        'params_file',
        default_value=os.path.join(pod2_param, 'config', 'nav2_params.yaml'),
        description='Full path to the ROS2 parameters file to use'),

    DeclareLaunchArgument(
        'default_nav_to_pose_bt_xml',
        default_value=os.path.join(bringup_dir, 'behavior_trees', 'default.xml'),
        description='Full path to the behavior tree xml file to use'),

    DeclareLaunchArgument(
        'map_subscribe_transient_local', default_value='true',
        description='Whether to set the map subscriber QoS to transient local'),

    Node(
        package='nav2_controller',
        executable='controller_server',
        #prefix=['xterm -e gdb -ex run --args'],
        output='screen',
        parameters=[configured_params],
        remappings=remappings
        ),

    Node(
        package='nav2_planner',
        executable='planner_server',
        name='planner_server',
        #prefix=['xterm -e gdb -ex run --args'],
        output='screen',
        parameters=[configured_params],
        remappings=remappings
        ),

    Node(
        package='nav2_behaviors',
        executable='behavior_server',
        name='behavior_server',
        #prefix=['xterm -e gdb -ex run --args'],
        output='screen',
        parameters=[configured_params],
        remappings=remappings
        ),

    Node(
        package='nav2_bt_navigator',
        executable='bt_navigator',
        name='bt_navigator',
        #prefix=['xterm -e gdb -ex run --args'],
        output='screen',
        parameters=[configured_params],
        remappings=remappings
        ),

    Node(
        package='nav2_lifecycle_manager',
        executable='lifecycle_manager',
        name='lifecycle_manager_navigation',
        #prefix=['xterm -e gdb -ex run --args'],
        output='screen',
        parameters=[{'use_sim_time': use_sim_time},
                    {'autostart': autostart},
                    {'node_names': lifecycle_nodes}]),

])`

Screenshot from 2023-08-07 17-47-55

Also, in rviz, localization shows inactive. But I launched Slam_toolbox prior to launching NAV2. I want to create map and localize simulatneously, that's why I have not provided pre-build map. Do I have to provide pre-built map for slam as well? I am bit new to this, any suggestions how to resolve this issue.

Rak-r commented 1 year ago

Also, I want to use slam toolbox for mapping and localization. I am not having a pre-built map. So using online async slam toolbox launch file. Setting he global and local frames in global and local costmap params should be according to this slam_toolbox setting? how to configure slam_toolbox to do both mapping and localization? without pre-built map? Althouugh I am not having any error from salm toolbox async node but I feel that it might be not rightly done, that's why. My slam_toolbox params:

`slam_toolbox: ros__parameters:

# Plugin params
solver_plugin: solver_plugins::CeresSolver
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
ceres_preconditioner: SCHUR_JACOBI
ceres_trust_strategy: LEVENBERG_MARQUARDT
ceres_dogleg_type: TRADITIONAL_DOGLEG
ceres_loss_function: None

# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: base_link
scan_topic: /scan
mode: localization #mapping  

# if you'd like to immediately start continuing a map at a given pose
# or at the dock, but they are mutually exclusive, if pose is given
# will use pose
#map_file_name: test_steve
#map_start_pose: [0.0, 0.0, 0.0]
#map_start_at_dock: true

debug_logging: false
throttle_scans: 1
transform_publish_period: 0.02 #if 0 never publishes odometry
map_update_interval: 5.0
resolution: 0.05
max_laser_range: 20.0 #for rastering images
minimum_time_interval: 0.5
transform_timeout: 1.0
tf_buffer_duration: 30.
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
enable_interactive_mode: true

# General Parameters
use_scan_matching: true
use_scan_barycenter: true
minimum_travel_distance: 0.5
minimum_travel_heading: 0.5
scan_buffer_size: 10
scan_buffer_maximum_scan_distance: 10.0
link_match_minimum_response_fine: 0.1  
link_scan_maximum_distance: 1.5
loop_search_maximum_distance: 3.0
do_loop_closing: true 
loop_match_minimum_chain_size: 10           
loop_match_maximum_variance_coarse: 3.0  
loop_match_minimum_response_coarse: 0.35    
loop_match_minimum_response_fine: 0.45

# Correlation Parameters - Correlation Parameters
correlation_search_space_dimension: 0.5
correlation_search_space_resolution: 0.01
correlation_search_space_smear_deviation: 0.1 

# Correlation Parameters - Loop Closure Parameters
loop_search_space_dimension: 8.0
loop_search_space_resolution: 0.05
loop_search_space_smear_deviation: 0.03

# Scan Matcher Parameters
distance_variance_penalty: 0.5      
angle_variance_penalty: 1.0    

fine_search_angle_offset: 0.00349     
coarse_search_angle_offset: 0.349   
coarse_angle_resolution: 0.0349        
minimum_angle_penalty: 0.9
minimum_distance_penalty: 0.5
use_response_expansion: true

`

SteveMacenski commented 1 year ago

What is your actual problem? The ticket never explains what your concern or issue is, just a set of (long) longs and configs with a title saying ‘its not working’. Please provide a detailed description of what’s not working and what you’ve tried.

SteveMacenski commented 1 year ago

how to configure slam_toolbox to do both mapping and localization? without pre-built map?

Read the docs and on the basics of SLAM. Respectfully, there is a litany of documentation on this that I shouldn’t need to repeat individually 🙂.

Rak-r commented 1 year ago

What is your actual problem? The ticket never explains what your concern or issue is, just a set of (long) longs and configs with a title saying ‘its not working’. Please provide a detailed description of what’s not working and what you’ve tried.

Apology for providing incomplete info. I changed the title as well. After launching the above launch file and hitting the 2DPoseEstimate in rviz its sets the estimate which I can see in terminal but not able to visualize and when I do Nav2Goal it throws the above provided error and robot do not move.

I looked at the topics and nodes using ros2 param get use_sim_time and it shows True (same with other nodes) However, the error seems that transforms are not getting published on using simulation time.

I tried to provided all error and info so that it might be easier to debug.

SteveMacenski commented 1 year ago

See our default launch files where sim time works fine as a launch configuration -- you might find your error by comparing them. Since our simulation launch files work properly to set sim time, its something to do with your config / launch files, not Nav2 related. As such with a user setup error, closing. Unfortunately, I don't have the cycles to personally debug every user's errors, but there are many clear examples in place of working systems you can base off of or reference.

SteveMacenski commented 1 year ago

I have closed a large volume of tickets from you with this exact same comment - please do take this advice. We're not here to fix all your configuration or misunderstanding issues. There is a wide body of documentation at navigation.ros.org and in the community available that you should look into first before filing here (let alone trying to fix an issue yourself, knowing that the default system is working fine).

Please do try to stop and think and spend some time to fix your own issue before filing a ticket of this type. Please don't abuse the issue tracker. If you have this many issues and need professional support, you're welcome to email us at info@opennav.org and we could discuss there. Though, most of your issues are really trivial solutions if you read the documentation and set things up // googled your issues.

Rak-r commented 1 year ago

See our default launch files where sim time works fine as a launch configuration -- you might find your error by comparing them. Since our simulation launch files work properly to set sim time, its something to do with your config / launch files, not Nav2 related. As such with a user setup error, closing. Unfortunately, I don't have the cycles to personally debug every user's errors, but there are many clear examples in place of working systems you can base off of or reference.

I have looked for similar errors and tried their solutions but still the issue persists. Infact, I tried the default nav2_bringup bringup.launch.py unfortunately it also outputd the same error as mine after Nav2goal button in rviz.

I have been googling these issues from past days and no clear solution found only after that I tried to ask here. But thanks for the advice.

Combinatrix commented 8 months ago

Hello

No clue if someone still cares.

Ran into the same issue. "requested time 1691424773.212782 but the latest data is at time 3617.600000" requested time is current time while latest data is sim_time. Solution: run rviz with "use_sim_time" set to true, not just your nodes...

Rak-r commented 8 months ago

I have closed a large volume of tickets from you with this exact same comment - please do take this advice. We're not here to fix all your configuration or misunderstanding issues. There is a wide body of documentation at navigation.ros.org and in the community available that you should look into first before filing here (let alone trying to fix an issue yourself, knowing that the default system is working fine).

Please do try to stop and think and spend some time to fix your own issue before filing a ticket of this type. Please don't abuse the issue tracker. If you have this many issues and need professional support, you're welcome to email us at info@opennav.org and we could discuss there. Though, most of your issues are really trivial solutions if you read the documentation and set things up // googled your issues.

Yes. Otherwise I just made gazebo to work on wall time. Better to have all physical and simulation robot to work on same time @Combinatrix

Anfil033RC commented 1 month ago

thanks @Combinatrix $ ros2 run rviz2 rviz2 --ros-args -p use_sim_time:=true instead of just $ rviz2 worked for me