ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS timestamps

asked 2012-06-28 01:24:17 -0600

Hansg91 gravatar image


I am using 2 machines for our robot and in order to properly use the tf package, we have to synchronize the clocks between them, because ROS uses the systems time for adding timestamps. If the two machines are not synced, then the timestamps won't match up, which will result in errors.

This got me thinking though, why doesn't ROS use the start of roscore as time = 0 and create stamps based on that time. Both systems would use the same roscore, so the same starting time. It would seem to make more sense than syncing the clocks of the machines.

Best regards, Hans

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-06-28 01:38:16 -0600

Theoretical this is a good idea but only theoretical.

The first problem here would be how to act if the Master is not reachable for sometime.

The second problem how to compensated latency's in a network.

And last but not least how to handle the all the time request in terms of CPU and bandwidth load.

So as you can see, using a well known technology is introducing less problems. Of course your basic idea is right and will work on a single system robot. It just will not scale well until the new solution takes care about a load of small thinks. By side of this the current idea of starting not from zero allows you to know at which date and time your data was recorded. This is important for scientific work as well as for debugging.

What really would be create is to have a install package or tool from ros which would make the synchronisation easier. May someone takes some time and includes a roschrony or so ;-) .

For those who need help to install a time server take a look here.

edit flag offensive delete link more

answered 2013-10-25 22:40:39 -0600

You can alternatively use the ApproximateTime synchronization policy.

message_filters::Subscriber<nav_msgs::Path> traj_lane_sub(n, "traj_lane", 10);
message_filters::Subscriber<geometry_msgs::PoseStamped> pose_sub(n, "pose", 100);

typedef sync_policies::ApproximateTime<nav_msgs::Path, geometry_msgs::PoseStamped> MySyncPolicy;
Synchronizer<MySyncPolicy> sync(MySyncPolicy(100), traj_lane_sub, pose_sub);

sync.registerCallback(boost::bind(&plan, _1, _2));
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-06-28 01:24:17 -0600

Seen: 1,864 times

Last updated: Oct 25 '13