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

Robot estimated pose

asked 2014-01-02 19:53:12 -0500

FuerteNewbie gravatar image

updated 2014-01-05 18:58:13 -0500

tfoote gravatar image

Hi guys,

Usually if we were to set the estimated pose of robot we will just reposition it in rviz by simply clicking to relocate it to our desire position. What if I wanted to reposition it programatically? (Not a fixed one.) Or it can be done in terminal? Because somehow I cant relocate myself in the rviz after I put everything together into my robot. Previously it is able to relocate with only one laser.

Thank you so much.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
2

answered 2014-01-02 21:26:59 -0500

rviz is just providing a GUI for publishing a geometry_msgs/PoseWithCovarianceStamped to the (per default) "/initialpose" topic. You can just as well publish to that using your own code, rqt_publisher or rostopic pub from the command line. If you run rviz and use "2D Pose Estimate" while doing a "rostopic echo /initialpose", you should get something like the following:

kohlbrecher@sk-i7:~$ rostopic echo /initialpose
    header: 
      seq: 0
      stamp: 
        secs: 0
        nsecs: 0
      frame_id: world
    pose: 
      pose: 
        position: 
          x: -0.00588150462136
          y: 0.947909832001
          z: 0.0
        orientation: 
          x: 0.0
          y: 0.0
          z: -0.707230093335
          w: 0.70698344753
      covariance: [0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06853891945200942]
    ---

Just use whatever tool suits you best to create such a message and publish to "/intialpose" (provided you didn´t remap/change that topic) and your AMCL node should react accordingly.

edit flag offensive delete link more

Comments

But the argument will be like ' header.seq header.stamp header.frame_id position.x position.y position.z orientation.x orientation.y orientation.z orientation.w covariance' right? Anyway I've tried '1 0 map 9.0 -2.0 0.0 0.0 0.0 0.707 0.707 0.25' it says -2 has no such option. I guess my argument wasn't wrong.

FuerteNewbie gravatar image FuerteNewbie  ( 2014-01-05 15:48:24 -0500 )edit

You need to quote the string such that bash does not interpret the negative sign.

tfoote gravatar image tfoote  ( 2014-01-05 18:59:48 -0500 )edit

"1 0 map 9.0 -2.0 0.0 0.0 0.0 0.707 0.707 0.25" ERROR: Not enough arguments: * Given: ['1 0 map 9.0 -2.0 0.0 0.0 0.0 0.707 0.707 0.25'] * Expected: ['header', 'pose']

FuerteNewbie gravatar image FuerteNewbie  ( 2014-01-05 19:59:48 -0500 )edit

Hey there. I know this is not related to the question but could you attach the subscriber you use to get values? I am not able to create one due to multiple errors that I can't really pinpoint. Thanks

Sahas00 gravatar image Sahas00  ( 2019-09-02 16:06:26 -0500 )edit
1

answered 2020-03-12 07:26:32 -0500

bharatdixit16701 gravatar image

updated 2020-03-12 18:07:04 -0500

jayess gravatar image

that's work for me, hope it helps you also

{ header: { frame_id: "/map" }, pose: {pose: {position: {x: 0 , y: 0 , z: 0 } , orientation: {x: 0 , y:0 , z:0 ,w:0} } } }
edit flag offensive delete link more
0

answered 2014-01-02 21:29:00 -0500

updated 2014-01-02 21:29:49 -0500

What you can do is publish a PoseWithCovarianceStamped message on the initialpose topic. You should also change the message frame id to the one expected, usually "/map"

EDIT: Already answered, sorry for double answer

edit flag offensive delete link more

Comments

And how can you get a robot posewithCovarianceStamped from gmapping, which gives you only different tfs and odom.

roberto3 gravatar image roberto3  ( 2018-02-20 03:13:23 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-01-02 19:53:12 -0500

Seen: 3,774 times

Last updated: Mar 12 '20