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

How do you use the navsat_transform set_datum service?

asked 2016-06-23 19:24:18 -0600

M@t gravatar image

I'm trying to use navsat_transform and I'm having difficulty with the global frame origin not matching the latitude and longitude I'm setting it to in the launch file. For more on that particular problem, see here.

So I want to use the navsat_transform set_datum service to manually set the origin, as described in the GPS Integration tutorial. However the link to the robot_localization/SetDatum service message is broken (try it here) and I can't find anything about it in the source API.

I've tried:

rosservice call /set_datum <tab>

Like a conventional set_pose service, but that doesn't work. Does anyone know how to use the set_datum service correctly? Or otherwise manually change it after launch?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-06-24 02:00:21 -0600

asimay_y gravatar image

just

rosservice call /datum <tab>

is ok.

edit flag offensive delete link more
2

answered 2016-06-26 19:58:31 -0600

M@t gravatar image

updated 2016-07-15 23:03:14 -0600

asimat_y's answer is correct, but I'll restate the problem and solution in greater detail to better document the problem.

Problem

The pose and origin of /map frame (as created by navsat_transform) is not where you want or expect it to be. E.g:

map_and_odom

This is the robot just after boot. The frame in the top-left is /map which should be right under the robot because the robot is currently sitting on the lattitude/longitude the /map origin should be fixed to.

Cause

The pose and origin of /map can be set using the 'datum' ros parameter in a launch file for navsat_transform. However, for reasons I don't quite understand, if you run this launch file on your robot when the robot boots (and sometimes when you run the launch file after boot-up as well) the origin and orientation may not be correct.

There may be other reason for changing the pose e.g. you want to reset it in the field.

Solution

The set_datum service can be used to manually reset the orientation and origin of /map. To do this open a terminal (making sure your ROS environment variables are configured!) and type:

rosservice call /datum <tab>

You should then see something like this:

user@robot_ip_address:~$ rosservice call /datum "geo_pose:
position:
    latitude: 0.0           
    longitude: 0.0          
    altitude: 0.0
orientation:
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0"

Fill out all the relevant parameters and then press enter to set the new origin and orientation. Remember that for the orientation you must have w = 1.0 at a minimum! (x,y,z,w = 0 will result in a NAN error). Verify that this worked by checking your frames again, e.g.

map

Now /map is correctly set to the latitude/longitude that the robot is currently sitting on.

You can also call the set_datum service from a file and change it that way. This is preferable if you want to reset the datum regularly. To do this in a python script, use the following code:

from geographic_msgs.msg import GeoPose
from robot_localization.srv import *

rospy.wait_for_service('datum')
try:
    geo_pose = rospy.ServiceProxy('datum', SetDatum)
    response = geo_pose(newMapPose)
except rospy.ServiceException, e:
    rospy.loginfo ("Service call failed: %s"%e)

Where newMapPose is a GeoPose message containing the coordinates you want to reset your frame origin to.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-06-23 19:24:18 -0600

Seen: 1,987 times

Last updated: Jul 15 '16