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

Request: ability to publish pointcloud2 messages with (epoch-based) Timestamps #1

Closed
eric-schleicher opened this issue Jun 29, 2018 · 13 comments

Comments

@eric-schleicher
Copy link

eric-schleicher commented Jun 29, 2018

I was able to get ouster OS-1 setup and running quickly. We were able to setup the launch files, start the node and view in RVIZ using fixed frame [os1] in less than 15 minutes Nice!

I've moved on to integrate with the rest of my ROS system, but running into a small issue with TF and timestamps. I've rigidly mounted the OS1 and have a static transforms configured (which works as expected), however cannot visualize the PointCloud2s in my TF tree in RVIZ because the pointcloud2 timestamps are "too old"

image

Poking through the code, it appears that the ROS node publishes PointCloud2 messages with stamp values that are handed over from the driver as sequence (ns) value (based the start of the device or node?), rather than a more traditional ROS epoch-based timestamp.

It looks like there are two places a change could be made, but i thought i would ask here, since i expect other people will want to visualize ouster data in TF Trees where the time bases are (traditional) epoch based timestamps. I'm also much more adept at python, and would likely screw it up in c++.

@eric-schleicher eric-schleicher changed the title Request: ability to publish pointcloud2 messages with (epoch-based) Ttimestamps Request: ability to publish pointcloud2 messages with (epoch-based) Timestamps Jun 30, 2018
@eric-schleicher
Copy link
Author

For others: The solution for this is to use ptp4l and properly setup time synchronization on the ROS network. the user manual covers configuring the unit with plaintext tcp commands. so that it will look for PTP master from which to syncnronize it's time basis.

@jepierre
Copy link

can you provide more details on how to do this?

@oscarmendezm
Copy link

I'd like to know as well, I've been trying since yesterday with no success.

@jepierre
Copy link

I used the example code provided here: https://github.com/ouster-lidar/ouster_example/blob/master/ouster_ros/src/os1_ros.cpp and set msg.header.stamp = ros::Time:now() instead of msg.header.stamp.fromNSec(timestamp.count());

@oscarmendezm
Copy link

Hi Jepierre, thanks for contributing to the discussion. I thought about doing that myself, and it would certainly fix things in the short term. However, that makes the message have timestamp of when it was parsed by ROS, not when it was captured. If you are trying to combine this with other sensors and/or odometry it will probably cause issues.

@jepierre
Copy link

jepierre commented Aug 17, 2018

@oscarmendezm it was a quick fix for me because in order to create PTP master on my computer, my NIC has to support hw or software timestamping. Which it doesn't.

I think the steps to @eric-schleicher solutions are:

  • send tcp commands to ouster lidar, if on linux do this:
    $ nc <lidar_ip_address> 7501
    set_timestamp_mode TIME_FROM_PTP_1588
    reinitialize
  • set up master PTP
    $ ptp4l -i <your_NIC> -m

You can check if your NIC support timestamping:
$ ethtool -T <your_NIC>

Unfortunately that didn't work for me since I don't have PTP enabled NIC. you can learn more about PTP here: https://docs.fedoraproject.org/en-US/Fedora/22/html/System_Administrators_Guide/sec-Starting_ptp4l.html

@oscarmendezm
Copy link

oscarmendezm commented Aug 22, 2018

Thanks for the instructions jepierre. I tried all of that, but I couldn't get the timestamps to come from the pc. My NIC supports SW timestamps, and as far as I can tell that should be enough?

@B0gdar
Copy link

B0gdar commented Aug 28, 2018

Software sync works, but you should analyze if for your application is precise enough.

@ZacharyTaylor
Copy link

Hi all, I just got this running. I modified our fork of the ros driver to always start in ptp mode and reject measurements until a sync has occured ethz-asl#1

@bochen87
Copy link

@ZacharyTaylor thanks, that seems to work well!

@eric-schleicher
Copy link
Author

eric-schleicher commented Nov 28, 2018

I think the steps to @eric-schleicher solutions are:

  • send tcp commands to ouster lidar, if on linux do this:
    $ nc <lidar_ip_address> 7501
    set_timestamp_mode TIME_FROM_PTP_1588
    reinitialize
  • set up master PTP
    $ ptp4l -i <your_NIC> -m

You can check if your NIC support timestamping:
$ ethtool -T <your_NIC>

Unfortunately that didn't work for me since I don't have PTP enabled NIC. you can learn more about PTP here: https://docs.fedoraproject.org/en-US/Fedora/22/html/System_Administrators_Guide/sec-Starting_ptp4l.html

everyone should note that if you adapter doesn't support hardware timestamping, you can run with software timestamping.

for example ptp4l -i eth0 -m -S where 'S' is for software timestamping.

@atleaa
Copy link

atleaa commented Apr 8, 2019

When giving the command "set_timestamp_mode TIME_FROM_PTP_1588" I get "error: Command not recognized."
It may appear that this was removed in v1.11.0?

Edit: Never mind, it was documented in the manual. If you find this, the new syntax is:
set_config_param timestamp_mode TIME_FROM_PTP_1588

@benripka
Copy link

Hi there,
I've run into this issue as well but noticed that I AM able to visualize the point clouds in RViz when I use my base_link, or any other link related to my ouster_sensor link by a static transform, as the fixed frame. It's only when I try to visualize it with the Odom frame that the timing appears to be an issue and block visualization.

I'm new to ROS and was wondering if anyone could explain why this is?

Thanks

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

8 participants