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

Is it possible to convert geometry_msgs PoseStamped to nav_msgs Odometry?

asked 2019-08-19 09:47:49 -0500

parzival gravatar image

updated 2019-08-19 15:25:06 -0500

I am trying to build a differential drive robot similar to a turtlebot, but I only have RPLidar as the sensor. I would like to use its data from /scan to publish messages of type nav_msgs/Odometry.

I tried using laser_scan_matcher but it only give Pose2D, which isn't sufficient as I need Twist information for Odometry msgs as well.

I even tried using the rf2o_laser_odometry, but I'm unable to get it working.

I tried hector_mapping, but it publishes geometry_msgs/PoseStamped and PoseWithCovariance.

Can someone guide me with the process of converting this datav from this message type to Odometry type which is compulsory for move_base?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-20 00:39:55 -0500

PapaG gravatar image

updated 2019-08-20 20:52:34 -0500

Is this a duplicate question? Please do not flood the forums with duplicates.

If not, you could estimate your velocity by deriving your position with respect to time. Estimate pose from velocity

x += v_x * dt
y += v_y * dt
theta += v_theta * dt

and so therefore your velocity in the odom frame can be estimated as

v_x = delta_x / dt
v_y = delta_y / dt
v_theta = delta_theta /dt

Given this you can extrapolate a robot frame velocity of

v.x = v_x/cos(theta)
omega = v_theta (due to the nature of differential drive kinematics).

Also keep in mind that due to kinematic constraints

v.y=0
edit flag offensive delete link more

Comments

No it is not a duplicate. The robot setup is same but they are fundamentally two different problems

parzival gravatar image parzival  ( 2019-08-20 03:43:45 -0500 )edit

Is this still relevant? In the linked question which is newer you say you can already derive an odometery msg. If you are still looking for an answer perhaps consider deriving the velocity from the distance travlled? You’re generating pose estimates and as so can calculate your change in location over time and thus, your velocity?

PapaG gravatar image PapaG  ( 2019-08-20 03:54:13 -0500 )edit

Yes. That sounds like a good option. Thanks! I'm currently using headers from /scan and pose2D from laser_scan_matcher to derive velocity and send Odometry messages. I think laser_scan_matcher would be a much lighter package then hector for my use case. What do you think?

parzival gravatar image parzival  ( 2019-08-20 08:41:08 -0500 )edit

I would suggest experimentation, every robot is different. Please see my updated answer for a mathematical derivation. Perhaps consider selecting it as an answer if you're happy with the help.

PapaG gravatar image PapaG  ( 2019-08-20 20:44:55 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2019-08-19 09:47:49 -0500

Seen: 2,540 times

Last updated: Aug 20 '19