ROS Navigation stack setup ERROR: Costmap2DROS transform timeout.

Problem:

用move_base导航package测试一下,编译成功,
然后也配置了对应的6个参数文件:

  • costmap_common.yaml
  • costmap_exploration.yaml
  • costmap_global_laser.yaml
  • costmap_global_static.yaml
  • costmap_local.yaml
  • planner.yaml

以上这些参数文件可能跟move_base的版本有关系,我查解决方法的时候,发现有些人的配置文件只有5个,我这里有6个,所以具体还是要根据实际的版本做修改,但大致debug思路可以总结一下,循着正确的方向肯定能找到解决方法的。

配置完后,运行时报了下面这个错误:

ROS Navigation stack setup (Costmap2DROS transform timeout. Current time: 560.5860, global_pose stamp: 0.0000, tolerance: 0.3000)

Solution:

  1. makesure自己的tf_tree,这个很关键
    tf_tree

  2. 根据自己的tf_tree配置6个yaml文件,
    ① costmap_common.yaml

footprint: [[-0.297367, 0.113507], [0.046364, 0.420826], [0.251003, 0.193812], 
            [0.251003, -0.193812], [0.046364, -0.420826],[-0.297367, -0.113507]]
footprint_padding: 0.01

origin_x: -50 # mark #
origin_y: -50 # mark #
width: 100 # mark #
height: 100 # mark #

robot_base_frame: base_footprint # mark #
update_frequency: 4.0
publish_frequency: 3.0
transform_tolerance: 0.5

resolution: 0.05

obstacle_range: 5.5
raytrace_range: 6.0

#layer definitions
static:
    enabled:              true
    map_topic: "/projected_map"  # mark #
    subscribe_to_updates: true

obstacles_laser:
    observation_sources: laser
    laser: {data_type: LaserScan, clearing: true, marking: true, topic: scan, inf_is_valid: true}

inflation:
    inflation_radius: 1.0

② costmap_exploration.yaml

track_unknown_space: true
global_frame: map # mark
rolling_window: false

plugins: 
- {name: external,            type: "costmap_2d::StaticLayer"}
- {name: explore_boundary,    type: "frontier_exploration::BoundedExploreLayer"}
#Can disable sensor layer if gmapping is fast enough to update scans
- {name: obstacles_laser,     type: "costmap_2d::ObstacleLayer"}
- {name: inflation,           type: "costmap_2d::InflationLayer"}

explore_boundary:
  resize_to_boundary: false
  frontier_travel_point: middle
  #set to false for gmapping, true if re-exploring a known area
  explore_clear_space: false

③ costmap_global_laser.yaml

global_frame: map # mark
rolling_window: false
track_unknown_space: true

plugins:
  - {name: static,                  type: "costmap_2d::StaticLayer"}
  - {name: inflation,               type: "costmap_2d::InflationLayer"}

④ costmap_global_static.yaml

global_frame: map # mark
rolling_window: true
track_unknown_space: true

plugins:
  - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
  - {name: inflation,                 type: "costmap_2d::InflationLayer"}

⑤ costmap_local.yaml
特别注意个局部的costmap,这里的global_frame要写odom,不能也是map,不然就报timeout这个WARN

global_frame: odom # mark
rolling_window: true

plugins:
  - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
  - {name: inflation,                 type: "costmap_2d::InflationLayer"}

⑥ planner.yaml

controller_frequency: 5.0
recovery_behaviour_enabled: true

NavfnROS:
  allow_unknown: true # Specifies whether or not to allow navfn to create plans that traverse unknown space.
  default_tolerance: 0.1 # A tolerance on the goal point for the planner.

TrajectoryPlannerROS:
  # Robot Configuration Parameters
  acc_lim_x: 2.5
  acc_lim_theta:  3.2

  max_vel_x: 1.0
  min_vel_x: -1.0

  max_vel_theta: 1.0
  min_vel_theta: -1.0
  min_in_place_vel_theta: 0.2

  holonomic_robot: true
  escape_vel: -0.1

  # Goal Tolerance Parameters
  yaw_goal_tolerance: 0.1
  xy_goal_tolerance: 0.2
  latch_xy_goal_tolerance: false

  # Forward Simulation Parameters
  sim_time: 2.0
  sim_granularity: 0.02
  angular_sim_granularity: 0.02
  vx_samples: 6
  vtheta_samples: 20
  controller_frequency: 20.0

  # Trajectory scoring parameters
  meter_scoring: true # Whether the gdist_scale and pdist_scale parameters should assume that goal_distance and path_distance are expressed in units of meters or cells. Cells are assumed by default (false).
  occdist_scale:  0.1 #The weighting for how much the controller should attempt to avoid obstacles. default 0.01
  pdist_scale: 0.75  #     The weighting for how much the controller should stay close to the path it was given . default 0.6
  gdist_scale: 1.0 #     The weighting for how much the controller should attempt to reach its local goal, also controls speed  default 0.8

  heading_lookahead: 0.325  #How far to look ahead in meters when scoring different in-place-rotation trajectories
  heading_scoring: false  #Whether to score based on the robot's heading to the path or its distance from the path. default false
  heading_scoring_timestep: 0.8   #How far to look ahead in time in seconds along the simulated trajectory when using heading scoring (double, default: 0.8)
  dwa: true #Whether to use the Dynamic Window Approach (DWA)_ or whether to use Trajectory Rollout
  simple_attractor: false
  publish_cost_grid_pc: true  

  # Oscillation Prevention Parameters
  oscillation_reset_dist: 0.25 #How far the robot must travel in meters before oscillation flags are reset (double, default: 0.05)
  escape_reset_dist: 0.1
  escape_reset_theta: 0.1

DWAPlannerROS:
  # Robot configuration parameters  
  acc_lim_x: 2.5
  acc_lim_y: 2.0
  acc_lim_th: 3.2

  max_vel_x: 0.5
  min_vel_x: -0.5
  max_vel_y: 0.5
  min_vel_y: -0.5

  max_trans_vel: 0.5
  min_trans_vel: 0.1
  max_rot_vel: 1.0
  min_rot_vel: 0.5

  # Goal Tolerance Parameters
  yaw_goal_tolerance: 0.1
  xy_goal_tolerance: 0.2
  latch_xy_goal_tolerance: false

  # # Forward Simulation Parameters
  # sim_time: 2.0
  # sim_granularity: 0.02
  # vx_samples: 6
  # vy_samples: 0
  # vtheta_samples: 20
  # penalize_negative_x: true

  # # Trajectory scoring parameters
  # path_distance_bias: 32.0 # The weighting for how much the controller should stay close to the path it was given
  # goal_distance_bias: 24.0 # The weighting for how much the controller should attempt to reach its local goal, also controls speed
  # occdist_scale: 0.01 # The weighting for how much the controller should attempt to avoid obstacles
  # forward_point_distance: 0.325 # The distance from the center point of the robot to place an additional scoring point, in meters
  # stop_time_buffer: 0.2  # The amount of time that the robot must stThe absolute value of the veolicty at which to start scaling the robot's footprint, in m/sop before a collision in order for a trajectory to be considered valid in seconds
  # scaling_speed: 0.25 # The absolute value of the veolicty at which to start scaling the robot's footprint, in m/s
  # max_scaling_factor: 0.2 # The maximum factor to scale the robot's footprint by

  # # Oscillation Prevention Parameters
  # oscillation_reset_dist: 0.25 #How far the robot must travel in meters before oscillation flags are reset (double, default: 0.05)

具体都要根据自己的tf tree来进行配置,注意区别好map和odom就解决问题了
从TF tree中可以看出,odom和小车底座base_footprint之间还有一个base坐标系,这个是调用gazebo中的cmd_vel产生的

    <gazebo> 
        <plugin name="onmi_controller" filename="libgazebo_ros_planar_move.so">
        <robotNamespace>/mobile_manipulator</robotNamespace>
		<commandTopic>/cmd_vel</commandTopic>
		<odometryTopic>base</odometryTopic>
		<odometryRate>50</odometryRate>
		<odometryFrame>base</odometryFrame>
		<robotBaseFrame>base_footprint</robotBaseFrame>
        <publishTf>true</publishTf>
        <publishWheelTF>true</publishWheelTF>
        <publishWheelJointState>true</publishWheelJointState>
        </plugin>	     

        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotNamespace>/mobile_manipulator</robotNamespace>
        <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
        <legacyModeNS>true</legacyModeNS>
    </plugin>
    </gazebo>

我也想去掉这部分,但是要调用cmd_vel就得调用libgazebo_ros_planar_move.so这个库,不知道还有没有其他方法可以调出/cmd_vel,如果有的话,希望各位告知一下,虽然感觉最后结果差不多,这里也是指定父系坐标和子坐标系,可以把base直接换成odom,这样就比较理想的tf tree,world->map->odom->base_footprint
但是这时也会出问题,move_base出现最初那个报错,也是我一直困惑的问题,不知道为什么会这样子。所以加多一个base坐标系就可以正常使用了。
如果有更好的方法,希望各位路过的大神告诉,感激!
分享使我们更强大!

Reference

  1. ROS Navigation stack setup (Costmap2DROS transform timeout. Current time: 560.5860, global_pose stamp: 0.0000, tolerance: 0.3000):
    https://answers.ros.org/question/320336/costmap2dros-transform-timeout/
  2. ROS Navigation stack setup (Costmap2DROS transform timeout. Current time: 560.5860, global_pose stamp: 0.0000, tolerance: 0.3000):
    https://www.reddit.com/r/ROS/comments/duw4ea/ros_navigation_stack_setup_costmap2dros_transform/
  3. costmap2dros transform timeout:
    https://answers.ros.org/question/320336/costmap2dros-transform-timeout/
  4. Navigation源码阅读之costmap_2d:
    https://blog.csdn.net/weixin_42048023/article/details/83992863
  5. ROS导航——配置机器人的导航功能(move_base包):
    https://blog.csdn.net/weixin_37661634/article/details/81169741
  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值