ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

robot loaded in different positions in Gazebo and Rviz

asked 2021-04-08 14:11:12 -0500

Eman.m gravatar image

updated 2021-04-14 18:46:23 -0500

jayess gravatar image

Hi I loaded an image for Willow Garage in Rviz, and a world for Willow Garage in Gazebo. My rosbot2 is loaded in the default position which is the origin. However, my rosbot2 was loaded in different positions in map and world. Here is rosbot2 in Rviz(inside the red circle): image description

Here is rosbot2 in Gazebo(inside the red circle): image description

Here are my files: willow_garage_map.yaml

image: willow_garage_map.pgm
# a 584 X 526 map @ 0.100 m/cell
resolution: 0.1
origin: [-18, -15, 0.0]
occupied_thresh: 0.65
free_thresh: 0.196
negate: 0

move_my_rosbot.launch

<launch>
    <arg name="use_rosbot" default="false"/>
    <arg name="use_gazebo" default="true"/>
    <param if="$(arg use_gazebo)" name="use_sim_time" value="true"/>
    <include file="$(find rosbot_description)/launch/rosbot_rviz.launch"/>
    <arg name="map_file" default="$(find rosbot_navigation)/maps/willow_garage_map.yaml"/>
    <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
    <node unless="$(arg use_rosbot)" pkg="tf" type="static_transform_publisher" name="map_odom_tf" args="0 0 0 0 0 0 map odom 100" /> 

    <node pkg="move_base" type="move_base" name="move_base" output="screen">
        <param name="base_global_planner" value="navfn/NavfnROS"/>
        <param name="base_local_planner" value="base_local_planner/TrajectoryPlannerROS"/>
        <param name="controller_frequency" value="10.0"/>
        <rosparam file="$(find rosbot_navigation)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
        <rosparam file="$(find rosbot_navigation)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find rosbot_navigation)/config/local_costmap_params.yaml" command="load" />
        <rosparam file="$(find rosbot_navigation)/config/global_costmap_params.yaml" command="load" />
        <rosparam file="$(find rosbot_navigation)/config/trajectory_planner.yaml" command="load" />
    </node>
</launch>

costmap_common_params.yaml

obstacle_range: 6.0
raytrace_range: 8.5
footprint: [[0.12, 0.14], [0.12, -0.14], [-0.12, -0.14], [-0.12, 0.14]]
map_topic: /map
subscribe_to_updates: true
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: laser, data_type: LaserScan, topic: scan, marking: true, clearing: true}
global_frame: map 
robot_base_frame: base_link 
always_send_full_costmap: true

global_costmap_params.yaml

global_costmap:
  global_frame: map
  update_frequency: 0.5 
  publish_frequency: 1.5
  transform_tolerance: 1.0 
  width: 16
  height: 16
  origin_x: -8
  origin_y: -8
  static_map: true 
  rolling_window: true 
  inflation_radius: 0.0 
  cost_scaling_factor: 10.0 
  resolution: 0.01

local_costmap_params.yaml

local_costmap:
  global_frame: map 
  update_frequency: 2.5 
  publish_frequency: 2.5 
  transform_tolerance: 1.0  
  static_map: false 
  rolling_window: true
  width: 3 
  height: 3
  origin_x: -1.5
  origin_y: -1.5
  resolution: 0.01
  inflation_radius: 0.0 
  cost_scaling_factor: 10.0

trajectory_planner.yaml

TrajectoryPlannerROS:
 max_vel_x: 0.5 
 min_vel_x: 0.1 
 max_vel_theta: 2.5
 min_vel_theta: -2.5
 min_in_place_vel_theta: 0.5
 acc_lim_theta: 1.0
 acc_lim_x: 1.5
 acc_lim_Y: 1.5
 holonomic_robot: false
 meter_scoring: true 
 xy_goal_tolerance: 0.5 
 yaw_goal_tolerance: 0.5 

 vx_samples: 6 
 vtheta_samples: 20
 controller_frequency: 0.5 


 occdist_scale:  0.01
 pdist_scale: 0.4
 gdist_scale: 0.2
 dwa: true

These are map and world files:https://www.mediafire.com/folder/q5xt...


Update:

Thanks So Young for your help.

I have tried using different pgm file, and it is better than the pgm above. Using the new pgm, the difference in rosbot2 position at Gazebo and Rviz (world and .pgm map) is not a big difference. However, it still not the same exact position. Should I use ACML ... (more)

edit retag flag offensive close merge delete

Comments

By "using different pgm" , do you mean you changed the origin in your map.yaml file? I'm not quite familiar with Gazebo, but when I try to locate my robot on the Rviz (to real robot's position), I use 2D pose estimate (on the Rviz top tool bar with green arrow) to click on the approximate position on the map and then use AMCL to locate the robot (usually by rotating in position, the AMCL will be able to locate the robot). And yes, if you want to use AMCL, you should have tf that connects 'map to odom' and 'odom to robot"

So Young gravatar image So Young  ( 2021-04-15 02:50:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-04-08 20:32:28 -0500

So Young gravatar image

If you just want to change the robot's starting position (after you load the map), just change the origin in willow_garage_map.yaml, maybe to 0.0,0.0,0.0 .But you should keep in mind this position is based on the map frame. However, If you want to properly locate the robot, you should use '2D pose estimate' in rviz first, and then using AMCL, localize the robot (by rotating in position).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-04-08 14:11:12 -0500

Seen: 417 times

Last updated: Apr 14 '21