ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Orienting the robot properly.

I'm trying to position my robot in a particular way after it reaches a particular checkpoint.

locations['A'] = Pose(Point(6.72, 5.91, 0.000), Quaternion(0.000, 0.000, 0.223, 0.975))
locations['B'] = Pose(Point(0.0646, -3, 0.000), Quaternion(0.000, 0.000, -0.670, 0.743))
locations['C'] = Pose(Point(6.11, -4.95, 0.000), Quaternion(0.000, 0.000, 0.733, 0.680))


Here in the above code I use the quaternion values to set the pose (orientiation).

I want to know how I can check the quaternions in real time when the robot is moving. I can rostopic echo /odom and see the x,y,z as well as x,y,z,w (which i guess are the quaterinion values). Is there any other way to fetching quaternion values ?

Secondly,

if I rotate the robot to a position, check the quaternion (x,y,z,w) values, move it around and later come to the same position , the quaternion values are chaning every time. I'm not sure if this is a valid behaviour because as I know, if quaternion is a representation of rotation (or pose), then if the robot is in the same pose after moving around, it shouldn't change isn't it?

My goal is to use the locations part of code attached above to orient the robot according to my requirement. Can this be done in any othe approach or is there any way I can get proper quaternion valuies?

Thanks.

edit retag close merge delete

Sort by » oldest newest most voted

I can rostopic echo /odom and see the x,y,z as well as x,y,z,w (which i guess are the quaterinion values). Is there any other way to fetching quaternion values ?

yes: lookup the transform between base_link of your robot and the odom or map frame.

if I rotate the robot to a position, check the quaternion (x,y,z,w) values, move it around and later come to the same position , the quaternion values are chaning every time. I'm not sure if this is a valid behaviour because as I know, if quaternion is a representation of rotation (or pose), then if the robot is in the same pose after moving around, it shouldn't change isn't it?

If you're just looking at /odom this can probably be explained by realising that most wheeled robots rely heavily on encoder ticks to calculate their odometry. Displacement (both pure translation as well as rotation) would then be the result of integration.

You probably know that due to wheel slip and other factors wheel-based odometry is far from ideal, so cumulative errors could lead to what you are seeing (ie: returning to "the same" position doesn't result in seeing the same odometry values).

To improve this situation, you may want to use a sensor fusion package like robot_localization. That takes in raw odometry measurements and transforms them into a better state estimate for your robot.

Note: this will most likely still not result in seeing the exact same values, but, properly tuned, should result in better estimates.

more

Thank you @gvdhoorn. Yeah, I agree with your above statement. I guessed somehow wheel slip factor would add to what I was seeing. So, what you're saying is I get the quaternion values from a proper package such as robot_localization, then feeding the same to my code would likely help in the orientin the robot, isnt't it?

( 2019-06-26 04:50:50 -0500 )edit

It will probably improve the situation, yes, but it will probably never become perfect. For that, you'd need an external, absolute reference that is not based on integration (but that is just my own understanding: I'm not a navigation expert).

( 2019-06-26 04:53:19 -0500 )edit

Alright. Thanks a lot for your insight.
On the contrary, is there any way in which i can easily orient the robot in a partocular position (through code) other then the method (quaternion) i'm following ?

(Kindly don't treat this as a seperate question).

( 2019-06-26 05:12:17 -0500 )edit

What's so special about the "quaternion"? It's just a particular representation of an orientation.

Off the top of my head you have two options:

1. a body-local referenced orientation
2. an external reference for your orientation

option 2 would require some external reference. Perhaps a marker. Option 1 depends on things like odometry and state estimation.

Kindly don't treat this as a seperate question

it is a separate / follow-up question though.

( 2019-06-26 05:14:19 -0500 )edit

Alright. Thanks a lot for helping out!

( 2019-06-26 23:43:06 -0500 )edit