Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change .pcap to the .bag #8

Open
yxxxxx38324 opened this issue Mar 25, 2019 · 19 comments
Open

how to change .pcap to the .bag #8

yxxxxx38324 opened this issue Mar 25, 2019 · 19 comments

Comments

@yxxxxx38324
Copy link

I use the pandar 40 to record the data,but I can't figure out how to get the the .bag format

@trickyMan
Copy link
Contributor

rosbag record?

@TheGreatGalaxy
Copy link

I also have the same problem. I have to record data in windowsOS. Now I record my data in .pcap, but I have to analyze the record data in ROS in Ubuntu 16.04. How should i to do ? anyone konws ? Thanks!

@trickyMan
Copy link
Contributor

@dahewujiang You can play pcap using HesaiLidar-ros , and then , using rosbag record the topic to a rosbag.

@TheGreatGalaxy
Copy link

I have tried this. But when playing the record .bag file, it seems not realtime. The playback rate is not constant. How to fix this problem?

@trickyMan
Copy link
Contributor

https://github.com/HesaiTechnology/HesaiLidarSDK/blob/d9d5b9a94b74e2c4925311b487cc260d3ceebb3e/include/hesaiLidarSDK_IN.h#L55

try to decrease the interval time of reading packets to increase the framerate.

@TheGreatGalaxy
Copy link

Sorry. I am not understand you well. What do you mean that "try to decrease the interval time of reading packets to increase the framerate."? Which parameters should I modify? Do you think that the unconscious playback rate is caused by playback ? But I think it caused by record. Because I play the .bag file which recording directly in ROS is right.

@trickyMan
Copy link
Contributor

https://github.com/HesaiTechnology/HesaiLidarSDK/blob/d9d5b9a94b74e2c4925311b487cc260d3ceebb3e/include/hesaiLidarSDK_IN.h#L55

// 10000 us  = 100 ms = 0.1s per packet
#define HesaiLidarSDK_PCAP_TIME_INTERVAL (100000 / 3000)

The pcap reading task will delay a time between 2 packets, You can set this interval in source code. By default , there are 3000 packets in 100ms in Signle Return mode for Pandar40 , so the interval will be 100000us / 3000.

If the return mode is Dual Return , there will be 6000 packets.

@ADoranth
Copy link

Hello,I did it like what you said, but it still didn't work, the bag data always faster than pcap data.

@ADoranth
Copy link

@trickyMan we tried many times with different values (100000/3000), sometimes the bag played very fast, sometimes very slow, the speed of played bag file didn't steady. I thought that it doesn't steady when we replay the pcap file ,so it doesn't steady when we record it. Can you help us to solve the problem as soon as possible,please. Thanks very much~

@trickyMan
Copy link
Contributor

try (100000/180)? 180 means 180 packets per cycle. or (100000/300).

@ADoranth
Copy link

@trickyMan Thanks a lot, I tried, these two pair value(100000/180)and(100000/300)seems much slower than pcap data, so I changed to (100000/420),it seems much better,does these values all right?

@trickyMan
Copy link
Contributor

That’s ok.

@ADoranth
Copy link

All right,thanks, but now we can't promise that the bag data and the pcap data can absolutely synchronize, how can we make the beginning and the end of both pcap and the bag data are the same, is there are some codes I can write to come true these?

@trickyMan
Copy link
Contributor

Oh, yeah, Every packet in pcap file has it's own timestamp, You can control the delay time using the exact timestamp gap between 2 packets.

@ADoranth
Copy link

Oh, I got that , but i am thinking about how should I get these timestamp gap?

@trickyMan
Copy link
Contributor

refer to the docs of libpcap?

@ADoranth
Copy link

@trickyMan Yeah, you said that every packet in pcap file has it's own timestamp, I can control the delay time using the exact timestamp gap between 2 packets, so I want to know that is there any codes I can use directly to get the exact timestamp gap between 2 packets and control the delay time?

@trickyMan
Copy link
Contributor

trickyMan commented May 27, 2019

@ADoranth

Here is the sample code

The timestamps are stored in the header of the pcap packet.

@ADoranth
Copy link

@trickyMan
All right ,thank you very much , I will try ,but I think it will costs much time~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants