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

lookupTransform - builtin_interfaces/Time to tf2::TimePoint?

asked 2018-12-04 14:03:53 -0500

lucasw gravatar image

I'd like to use the header stamp in a call to lookupTransform and assume that a conversion would happen automatically, but I'm getting no matching function call build errors. Is there a header to include that will handle this, or is it not implemented yet and I have to convert it manually?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-12-04 18:52:08 -0500

lucasw gravatar image

The manual conversion:

builtin_interfaces::msg::Time time_stamp = msg->header.stamp;
tf2::TimePoint time_point = tf2::TimePoint(
    std::chrono::seconds(time_stamp.sec) +
geometry_msgs::msg::TransformStamped tf = buffer_.lookupTransform(
    frame1, frame2, time_point)
edit flag offensive delete link more

answered 2019-12-18 10:53:51 -0500

ahcorde gravatar image

You can use these functions form tf2_ros/buffer_interface.h:

  • TimePoint to builtin_interfaces::msg::Time

    inline builtin_interfaces::msg::Time toMsg(const tf2::TimePoint & t)

  • builtin_interfaces::msg::Time to TimePoint

    inline const tf2::TimePoint& fromMsg(const builtin_interfaces::msg::Time & time_msg)

edit flag offensive delete link more

Question Tools



Asked: 2018-12-04 14:03:53 -0500

Seen: 1,921 times

Last updated: Dec 04 '18