Get time stamp from ros msg
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
aaaaaaaaaaaa
=============== 14818000000
=============== 1652627473203
aaaaaaaaaaaa
=============== 14985000000
=============== 1652627473759
aaaaaaaaaaaa
=============== 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?