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

Get time stamp from ros msg

asked 2022-05-15 10:30:50 -0600

kankanzheli gravatar image

updated 2022-07-10 12:10:41 -0600

lucasw gravatar image

hello everyone. I have a problem. I experimented with robot work in gazebo virtual environment. I want to map the state of the manipulator to the obtained point cloud data (the point cloud used in the image detection process). My idea is to use time stamps to correspond to these data.

The time stamp acquisition code used for the status of the manipulator is as follows:

timestampName = round(time.time()*1000)

The code for obtaining the accurate time stamp of the point cloud through search is as follows:

timestampN2 = ptcloud_data.header.stamp

But the results obtained are very different. Here are some examples printed out.

=============== 14751000000
=============== 1652627473018
=============== 14818000000
=============== 1652627473203
=============== 14985000000
=============== 1652627473759
=============== 15018000000
=============== 1652627473948

I understand that the reason for this is that the two sources of information are different. The first comes from the time source of gazebo. The second comes from the computer's time source. What should I do? Can the time information of the point cloud be converted into the time information corresponding to the computer time?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-05-15 15:09:27 -0600

ljaniec gravatar image

I will first describe what I understood - please correct me if I am wrong.

You have a controlled manipulator (so you have a source for its state) and a RGB-D camera info (so a second source of messages). You want to store pairs of (a manipulator state, a cloud point message).

I think you can maybe use message_filters package to do this task:

Without using computer time, but with a timestamp in the header of the last manipulator pose, synchronized with point cloud data.


If it's not the case:

Maybe you can use other source of time for the manipulator? Please check these:

edit flag offensive delete link more

Question Tools



Asked: 2022-05-15 10:30:50 -0600

Seen: 1,011 times

Last updated: May 15 '22