ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

tf2 conversion (bullet to geometry_msgs)

asked 2016-03-18 06:20:34 -0500

alextoind gravatar image

updated 2016-03-19 06:18:45 -0500

I wish to convert from Gazebo math::Pose type to one of the geometry_msgs ROS messages.

I can convert from math::Pose to btTransform using BulletTypes.hh.

I have tried with tf2::convert() method following the tutorial, but it fails:

btTransform bt_T = physics::BulletTypes::ConvertPose(model_->GetLink("link")->GetWorldPose());
tf2::Stamped<btTransform> bt_T_stamped(bt_T, ros::Time::now(), "world");
geometry_msgs::TransformStamped T;
tf2::convert(bt_T_stamped, T);

I can obviously do this by hand, but is it there a way to use the tf2::convert() method properly?

EDIT: you can find the error log in this Gist.

edit retag flag offensive close merge delete


Why doesn't it work? What error message do you get?

ahendrix gravatar image ahendrix  ( 2016-03-18 22:31:47 -0500 )edit

@ahendrix I have added the error log.

alextoind gravatar image alextoind  ( 2016-03-19 06:19:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-20 01:47:46 -0500

ahendrix gravatar image

updated 2016-03-21 04:35:07 -0500

From your error message, it looks like the compiler can't find an implementation of the conversion from btTransform to a message.

Are you including the tf2_bullet header that provides this conversion function? Try adding:

#include "tf2_bullet/tf2_bullet.h"


It looks like the conversion from a bullet transform to a TF2 transform hasn't been written yet; it isn't listed in the tf2_bullet header

Similar to the existing functions, you could try writing the conversion yourself; it would probably look something like:

namespace tf2 {

geometry_msgs::TransformStamped toMsg(const tf2::Stamped<btTransform>& in)
  geometry_msgs::TransformStamped msg;
  // TODO: actual conversion here
  return msg;

} // namespace tf2
edit flag offensive delete link more


@ahendrix I am really sorry that I had forgot to uncomment that include when I was creating the gist... Unfortunately that header is already included in my code, but it still does not compile. I have updated the gist with the correct error log. Thank you for your patience.

alextoind gravatar image alextoind  ( 2016-03-21 04:11:25 -0500 )edit

Thank you very much @ahendrix! In your opinion, should I create a pull request in if everything works fine?

alextoind gravatar image alextoind  ( 2016-03-21 05:07:12 -0500 )edit

Yes; if you come up with a conversion you like, you should submit it as a pull request.

ahendrix gravatar image ahendrix  ( 2016-03-21 12:27:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-03-18 06:20:34 -0500

Seen: 532 times

Last updated: Mar 21 '16