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

Robot position at Velocity zero to some reference object

asked 2012-09-06 16:50:59 -0500

Astronaut gravatar image

Hello

I would like to ask for a bit help. I would like to know my position and distance to some labelled object in the map( my object is a just a single line segment) when the robot has a velocity zero ( so when he stopped for a while close to that reference object). So my robot (assume is a rectangle) is moving around the map environment and in after a while (like after one minutes) he stopped for a couple of seconds close to some object( a bed , which I assume is a line). So I just want to know the robot minimum distance to that reference line segment and its position (angle and other parameters) to that line. Any help?

edit retag flag offensive close merge delete

Comments

Is the question on how to detect the velocity 0 or how to compute the transform between the object and the robot? Or both?

dejanpan gravatar image dejanpan  ( 2012-09-07 06:48:54 -0500 )edit

On both. But more important is how to detect the velocity 0. Any help?

Astronaut gravatar image Astronaut  ( 2012-09-07 21:37:21 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-09-07 07:17:57 -0500

kszonek gravatar image

First you need to detect an object you are interested in - I assume you have already done this. Next step would be to publish tf transform for this particular object (line), you can find this tutorial useful:

http://www.ros.org/wiki/tf/Tutorials/Adding%20a%20frame%20%28C%2B%2B%29

Carrot example is really cool :) Of course you should publish tf /object with base /laser (or whatever, according to you detection method). In the part of the code that needs an input about object position place tf listener for transform from /object to /base_link, like in this tutorial:

http://www.ros.org/wiki/tf/Tutorials/Writing%20a%20tf%20listener%20%28C%2B%2B%29

Remember to setup your robot with tfs (in this case you are going to need /base_link and /laser frames).

edit flag offensive delete link more

Comments

Yes , thanks. But how about the velocity 0? but how to detect the velocity 0?

Astronaut gravatar image Astronaut  ( 2012-09-07 21:39:16 -0500 )edit
2

answered 2012-09-07 05:41:06 -0500

joq gravatar image

updated 2012-09-08 09:22:02 -0500

I am not sure exactly what you are asking, but basically you need to transform between the robot's pose and the object in the map.

Read up on coordinate frames for mobile platforms. Probably that will help you understand the issues better.

EDIT: the /odom topic typically provides an estimate of the robot's current position, orientation and velocity, see: nav_msgs/Odometry.

The forward velocity in that message is twist.twist.linear.x. It is a floating point number, so you should test for absolute value less than some small epsilon rather than exact equality to zero. If your robot is capable of moving sideways or turning in place, you should also test twist.twist.linear.y and twist.twist.angular.z (yaw rate).

edit flag offensive delete link more

Comments

Ok. I know about that. but how to detect the velocity 0?

Astronaut gravatar image Astronaut  ( 2012-09-07 21:38:29 -0500 )edit
1

I believe @joq gave you the answer. If you were to subscribe to some topic that contained a nav_msgs/Odometry message for your robot, the subscriber could just look at the twist.twist.linear.x field and see if it is small (say less than 0.01). If so, assume robot's velocity is zero.

jarvisschultz gravatar image jarvisschultz  ( 2012-09-08 10:35:52 -0500 )edit

But im using amcl for localisation. So im not doing navigation, just localisation and analysing. So also need to know the distance to that reference object( line) when the velocity of the robot is zero(or very very small value). So I think best way is to use geometry_msgs and not nav_msgs.True?

Astronaut gravatar image Astronaut  ( 2012-09-10 15:13:36 -0500 )edit

Can you explain a bit with the C++ code how to use nav_msgs/Odometry or geometry_msgs to look at twist.twist.linear.x???

Astronaut gravatar image Astronaut  ( 2012-09-10 16:47:48 -0500 )edit
1

Question Tools

Stats

Asked: 2012-09-06 16:50:59 -0500

Seen: 837 times

Last updated: Sep 08 '12