ZED in ROS output time stamp

I am Using the zed camera in ros system.
I am using:
rospy.Subscriber(’/zedm/zed_node/left/image_rect_color’, Image, rgb_callback)
rospy.Subscriber(’/zedm/zed_node/point_cloud/cloud_registered’, PointCloud2, points_callback)

They helped me get the image data and pointcloud data.

I have two questions. Can this code ensure that the image corresponds to the point cloud data?
And how do I get the time stamp of the image captured by the camera?

Hi @kankanzheli,
I believe this parameter should help to synchronize.
And point cloud data msg type is sensor_msgs/PointCloud2 and it contains a header which can help you to get the time stamp. And same goes with the image data type,

Can you provide some examples of code that uses these parameters?

@kankanzheli it’s the same as getting the image data.
Here you can find an example to create a subscriber:
http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber(python)#rospy_tutorials.2FTutorials.2FWritingPublisherSubscriber.Writing_the_Subscriber_Node

The timestamp is in the data.header.stamp field.

I don’t think you understand my problem. I have been able to accept RGB data and point cloud data. What I need is to ensure that the two data are synchronized.

How to ensure that the two data are synchronized?

And how to get the time stamp of the data obtained by the camera? Do you have relevant codes?

I can’t understand your problem. If you are retrieving RGB and point cloud data then you also have the timestamp information in field header.stamp of both the topics.

To verify that they are synchronized you must subscribe to both in the same node and then compare the header.stamp fields.

Otherwise, you can use the synchronization filter, as explained here:

We did something similar for RGB and Depth Map, but in C++:

Thanks for your answer.
The main structure of my code is as follows

def rgb_callback(data)
timestampName1 = data.header.stamp

def points_callback(data)
timestampName2 = data.header.stamp

def main():
rospy.init_node(‘gazebo_demo_py’, anonymous=True)
rospy.Subscriber(’/zedm/zed_node/left/image_rect_color’, Image, rgb_callback)
rospy.Subscriber(’/zedm/zed_node/point_cloud/cloud_registered’, PointCloud2, points_callback)

I conducted two experiments respectively. The first time is to obtain the relevant data of Kinect camera in gazebo. Result shows timestampname1 = timestampname2

But in another way, let me first:

roslaunch zed_ wrapper zedm. launch svo_ file:=…/ 2.svo

Then run this part of the code. At this time, timestampname1 is not equal to timestampname2
Here is the example:

========== 1650472832997097715 (timestampname1)

=============== 1650472832953676823 (timestampname2)

========== 1650472833251986330 (timestampname1)

=============== 1650472833200474628 (timestampname2)

========== 1650472833496519406 (timestampname1)

=============== 1650472833433901254 (timestampname2)

========== 1650472833730822341 (timestampname1)

=============== 1650472833667355684 (timestampname2)

Besides, we use
roslaunch zed_wrapper zedm.launch
to open zed-mini with ros. Can you make the camera run at the specified resolution?(1280,720)

Just to confirm I think you understand the format of the timestamp you get from the header message. The time you get is epoch time which is in a sec and nano sec.
The first 10 digits give to time in sec 1650472832(sec).997097715(nsec) and the remaining nano sec. If you check the first 10 digits they are the same for both timestamps which means they are synced.
There will be a small-time difference between 2 messages in nano sec but I don’t think it should affect you in any way for your application.

I combine 2D image detection results with 3D information. Find the location information of the object. The output result without ROS is different from that with ROS. This makes my follow-up work unable to be carried out effectively.

In addition, the timestamps I obtained by using “timestampname = round (time. time() * 1000)” and “data. header. stamp” are different. The first one to get the timestamp based on the computer time. The second time stamp seems to be based on the time when the camera starts in the ROS. So how can I get the timestamp of “time. time() * 1000” type through “data. header. stamp”?

@kankanzheli maybe that you find more information about using the timestamp to match your requirements in a ROS forum:
http://answers.ros.org/

In fact, I’ve been asking for a long time. But no one has answered this question. That’s why I’m asking questions here.

Hi.
I’m facing a similar problem.
If I get the stamp from the header of IMU topics, the timestamp refers to the epoch at which the .svo was recorded while if i get the stamp from the header of Images topics, the timestamp refers to the epoch at which the frame is grabbed (now).
Is it not possible to have the timestamp of the images at the same time of the IMU?

This seems to be a bug. Can you open a bug issue on Github in order to track it?