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

ROS sensor messages from the same update have slightly different timestamps #6524

Open
lucasw opened this issue Mar 23, 2024 · 1 comment
Open

Comments

@lucasw
Copy link

lucasw commented Mar 23, 2024

Describe the Bug

Sensors all have slightly different timestamps even though their data is from the same sim update step. Perhaps this is desirable behavior, adds realistic noise to the system, so a fix could be made optional, though in my case I'm building an Odometry message out of gyro, gps, & inertial sensors so I'd like them to be exactly synchronized rather than approximately.

Using an approximate time sync message filter in ros is a workaround, but I'd rather synchronize right at the source.

Instead of assigning a new ros::Time::now() per sensor right before it publishes (https://github.com/cyberbotics/webots/blob/master/projects/default/controllers/ros/RosGyro.cpp#L40), set a single timestamp in the root sensor update method and pass it down to each sensor publish.

It looks easy enough so I'll do it myself in a few days, though it'll be a lot of 1-2 changes across many files to provide a stamp to every publish method.

Steps to Reproduce

Put multiple sensors on a vehicle and publish them to ros.

Expected behavior

Exact same timestamps from sensors with same update period.

Screenshots

None

System

  • Operating System: NA
  • Graphics Card: NA

Additional context

None

@omichel
Copy link
Member

omichel commented Mar 25, 2024

Yes, that seems to be a good default behavior. Please go ahead with the implementation and open a PR that we will review.

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

No branches or pull requests

2 participants