RobotStudio event

Milliseconds in Timestamp for External Synchronization

I am trying to time synchronize measurements from external sensors to a continuous readout of my TCP position.
Is there a way I can get CTime() to return milliseconds as well as seconds?

Currently I have a semistatic task with a loop that when activated grabs an initial timestamp and then starts a clock variable which is read on every loop iteration. However, I don't know where within the second of that first timestamp the time was when the clock variable started. Leaving me with a +/- 500 millisecond uncertainty in my alignment of TCP position and my external data.

Any help or alternate suggestions would be appreciated.

Comments

  • As far as I know, the CTime() has no way of returning milliseconds.
    We had a similar issue where we would stream data (among others also the TCP position) from a background task to a PC and we wanted to include a timestamp. Our approach was to use relative timestamps on the side of our robot by only adding the current readout of the clock variable to each datapoint, not the absolute time. We would then keep track of the absolute time only on our PC by adding the clock data received from the robot to the local clock time on the PC at the point where the first data package was received.