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

occupancy grid and pose

asked 2016-05-05 06:14:18 -0600

viorel gravatar image

updated 2016-05-05 06:15:40 -0600

Hi All,

i'm new to ROS so I am trying to understand how things works.

I have a gmapping process, with urg_node and laser_scan_matcher.

I am getting the occupancy grid via a C# subscriber on Windows, but i am unable to figure out how to get the pose and orientation, and translate that into the occupancy grid coordinates.

I have /pose_stamped which is published by the laser_scan_matcher, but can't figure out how to translate the position and orientation into grid coordinates.

In RViz i get the occupancy grid and pose just fine, but i need to be able to convert the pose and orientation so i can process the data in my program (basically i need to save the position and orientation correlated to the occupancy grid, every time i press a key on my keyboard) and show that on the screen.

here's the launch file i am using:

<?xml version="1.0"?>
  <node pkg="urg_node" type="urg_node" name="scan">
    <param name="ip_address" value=""/>
    <param name="frame_id" value="base_link"/>
    <param name="calibrate_time" type="bool" value="true"/>
    <param name="intensity" type="bool" value="false"/>
    <param name="min_ang" value="-2.35619443"/>
    <param name="max_ang" value="2.35619443"/>
    <remap from="scan" to="base_scan" />
  <node pkg="tf" type="static_transform_publisher" name="base_link_to_base_laser_link" args="0.0 0 0.0 0.0 0.0 0.0 /base_link /base_laser_link 100" />
  <node name="gmapping" pkg="gmapping" type="slam_gmapping" args="scan:=scan" output="screen">
    <param name="map_update_interval" value="0.5"/>
    <param name="maxUrange" value="16.0"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>
    <param name="linearUpdate" value="0.01"/>
    <param name="angularUpdate" value="0.01"/>
    <param name="temporalUpdate" value="-1.0"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="10"/>
    <param name="xmin" value="-10.0"/>
    <param name="ymin" value="-10.0"/>
    <param name="xmax" value="10.0"/>
    <param name="ymax" value="10.0"/>
    <param name="delta" value="0.01"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>

<node pkg="laser_scan_matcher" type="laser_scan_matcher_node" name="laser_scan_matcher_node" output="screen">
    <param name="fixed_frame" value = "odom"/>
        <param name="publish_tf" value="true"/>
        <param name="publish_odom" value="true"/>
    <param name="max_iterations" value="10"/>
    <param name="use_imu" value="false"/>
    <param name="use_odom" value="false"/>
    <param name="use_alpha_beta" value="false"/>
    <param name="publish_pose_stamped " value="true" />


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-05 07:24:17 -0600

If I understand your question right you need to localize the robot on the map and get those coordinates, is that right? If so, you need to use a localization node like AMCL.

edit flag offensive delete link more


But i already have topics for pose2D and pose_stamped, the latter is used by rviz and it's correct. What I'm doing now is to take X and Y from pose_stamped, multiply by map resolution from OccupancyGrid header but the grid coordinates aren't quite correct ... Why use an extra node ?

viorel gravatar image viorel  ( 2016-05-05 07:55:28 -0600 )edit

laser_scan_matcher gives you a pose relative to the starting position of the robot when the node was started. If you use that to give you an odometry message you can feed that into AMCL which will give you a pose in the map frame.

Icehawk101 gravatar image Icehawk101  ( 2016-05-05 08:18:18 -0600 )edit

It's what i need, the pose relative to the starting position, like the one i can see in Rviz already. I just can't figure out how to calculate that from pose_stamped or any other tf. Having AMCL rescanning the laser frames, will add a lot of overhead that's not needed.

viorel gravatar image viorel  ( 2016-05-05 08:24:18 -0600 )edit

Question Tools

1 follower


Asked: 2016-05-05 06:14:18 -0600

Seen: 1,015 times

Last updated: May 05 '16