Hi,
I am currently attempting to synchronize the notion of the clock between multiple clients connected through the Panda distributed object model.
The short version of my question is this: how is the Uncertainty value of a ClockDelta object supposed to be set? It is initialized to None and never changes from there; following through the code, I can find no path that will cause it to be set to anything else. As such the ClockDelta object never… does anything, because its uncertainty is infinite.
The long version of my question follows (to get some background of what I am trying to do):
My first step, before trying to implement something with ClockDelta, was to develop a rudimentary system by creating my own distributed object, an instance of which would live on each client, which sends a “ping” and “ping reply” message (with a timestamp in each direction) in order to calculate approximate network latency and clock delta. I have this completed, and it works, although it is of course not terribly accurate due to the fact that it only takes one sample.
The ClockDelta class shipped with Panda, however, appears to be a considerably more robust version of the same concept. I’ve been studying it and trying to determine how it is meant to be used, and although I understand it for the most part, I haven’t been able to get it to work. I note that the DistributedSmoothNode class makes use of the ClockDelta object and I have been studying that as well, which has helped, but I feel I am still missing a piece of the puzzle.
Without going into too many details of my implementation, I have attached a timestamp value to each distributed message passed between my clients. I have started out by borrowing most of the code from the setComponentTLive method of DistributedSmoothNode in order to, presumably, initiate a resync when the remote timestamp appears to have drifted too far from our local clock.
The problem I am encountering is related to the fact that all of the ClockDelta synchronization methods expect an Uncertainty value to be passed along. My understanding is that, essentially, you pass the uncertainty value along with the timestamps etc. from one client to another and this is then used as part of the sychronization calculations. However, the ClockDelta class initialized uncertainty to “None” (which is essentially Infinity) and an unknown uncertainty can’t be used for synchronization. In fact the setComponentTLive method that I am using as a model specifically checks for an unknown uncertainty, and does absolutely nothing if it finds it.
Tracing through the code though, I can’t conceive of anything I can do to get the uncertainty value “primed”. The only method I see that sets uncertainty is newDelta, and the only methods I can see that invoke newDelta already expect to know what the uncertainty is. Unless I am missing something, the only way to prime it would be for me to just outright set it manually, though I have no idea what I’d set it to.
Hopefully this makes sense and someone can point me in the right direction. To me, ClockDelta certainly seems like the right tool for the task, if I can make it work. Any help is appreciated!
- lem