-
-
Notifications
You must be signed in to change notification settings - Fork 467
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
Add new time sync mode SyncFrame #1698
Add new time sync mode SyncFrame #1698
Conversation
Hello @rhaschke, I was thinking about to use the There is a TF tree I can't currently think of a way to solve this here in |
Could you please provide python code to mimic your real-world scenario?
I would prefer to find a solution that processes TFs in a separate thread. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
... to sync TF lookups to current rendering frame
fcf7113
to
ac6ad2b
Compare
Thanks for providing the example code. I think I found a good solution now using an adaptable |
I had not time to test your latest commits yet. But I can tell you where I use SyncApprox in order to understand it better. SyncApprox can be useful to delay the Transforms with ros::Time(). The latency is obtained from the message delay of the selected display. I sometimes use it in the following scenario: I have a PointCloud2 with 10Hz and a CNN which takes quite some time to process the cloud. In order to visualize them in a synchronized way in Rviz, I have a node which subscribes to both and republishes both (on a different topic) as soon the detection arrived. This works well. However, things using ros::Time() like RobotDisplay or Grid, are not at the right position in Rviz w.r.t. the point cloud due to its large latency: SyncApprox helps to delay the TFs with stamp ros::Time() similar to the messages of the selected display: pc-2022-01-26_18.41.33.mp4Note how the car jumps to the center of the lidar rings when enabled. SyncExact does not help here, because the TFs are published in a much higher frequency than the message and they are usually not in sync with the selected message. |
I'm not sure, I understood your scenario. Let me try to summarize with my own words:
Is there some documentation on the syncing behavior that I missed? |
current_delta_ should denote the currently measured time offset sync_delta_ should denote the offset used to compute sync_time_
6fe9120
to
e03a00b
Compare
@AndreasR30, did you have time to test this PR? Please also comment on #1698 (comment). Thanks. |
Yes
Yes
No, the synchronizer is a separate node, which subscribes to original PC2 from the sensor and to Markers of CNN node. No TFs are republished! It republishes both, Markers and PC2 on a different topic when both are available (e.g. prefixed with Now the only problem left, is when the
Yes, but republisher is a separate node, the sync node.
No I found this feature to be useful by coincidence.
I will try to make one or a synthetic example in Python. But it could could take some days, because I'm busy. |
Here is an synthetic example showing when SyncApprox can be useful. It simulates a PC2 with latency of 200ms. Furthermore it simulates the RobotModelDisplay with a Marker. With synchronization off, the robot won't be in the center of the rings. With synchronization approx, the robot will be in the center of the lidar rings. Caution: There is a bug! For sync approx the |
Your latest commits seem to work good with the Python script from my previous comment. Aproximate Synchronization works well and the bug mentioned before seems to be eliminated. However, with the first Python script posted in this PR (unfortunately the "Copy Link" feature does not work so I can't link it) I still see the race conditions (even after few seconds) with Synchronization set to |
Thanks for providing the script (#1698 (comment)). I only found time to shortly look into this today. I noticed the following problems:
Thus, I still don't see a need for the |
I cannot confirm this statement. The |
You are right: While |
For me the PR looks good. The earlier synthetic example of this PR works (unfortunately I can't link it). However, it takes up to 10 seconds until it works properly. As long there is a TF with a larger delay incoming compared to |
In SyncFrame mode, we use ros::Time::now() for syncing, which is typically more recent than any TF stamp available, causing extrapolationn exceptions. To avoid that, we date back sync_time_ by a small amount sync_delta_, that is determined from observed lookup time differences.
There is no need to explicitly call _getLatestCommonTime(). First, this only succeeds if both frames have exactly the same time stamp. Second, lookupTransform() will throw an extrapolation exception anyway, if the lookup fails because the requested timestamp is too new.
- New mode SyncFrame, syncing TF lookups within a visualization frame - Remove experimental status of time syncing - Simplify and document code
... to keep existing config files valid
- New mode SyncFrame, syncing TF lookups within a visualization frame - Remove experimental status of time syncing - Simplify and document code
... to sync TF lookups within the current rendering frame.
Fixes #1693. @AndreasR30, please review.
@dgossow, You implemented the experimental
TimePanel
functionality 9 years ago. Unfortunately, there are no PR or code comments for the changeset 8c4cccf and I had a hard time guessing the intended functionality.I understood that
SyncExact
andSyncApprox
are intended to sync against a time signal provided by a specific sourceDisplay
. For example, all displays deriving fromPointCloudCommon
callemitTimeSignal()
and thus allow this functionality. However, I didn't get the intention of theSyncApprox
mode. TF lookups perform an approximate lookup anyway, aren't they? So what's the role ofSyncApprox
?As this mode essentially doesn't work (throwing lookup errors on the console), I'm tempted to remove it completely.
screen-recording.mp4