Timestamp Synchronization

Frequent questions asked online, offline, in forums are answered here
Post Reply
cjh
Posts: 5
Joined: Wed Aug 10, 2022 11:49 am

Timestamp Synchronization

Post by cjh »

I am trying to write a Python script that captures images from a camera and tags them with the position they were taken from a pair of Super Beacon hedges connected via USB running in an NIA configuration. As the camera frame rate is significantly higher than the position update rate, my approach is to maintain a buffer of images while waiting for a position update, then retrieve the image from the buffer whose timestamp most closely matches that of the position update.

However, I am having two problems:

Firstly, only every 2nd position update actually seems to return an updated position - the dashboard says the rate is 8Hz, and hedge.positionUpdated is being set to True about 8 times each second, however only half of these updates actually return new data. If I use the following code to check for updates, I only get about 4 updates per second:

Code: Select all

while True:
   hpos = hedge.position()
   if hpos[5] > lastpos[5]:
      break
Secondly, I don't understand the timestamp contained in hedge.position()[5]. My camera provides a timestamp with each image in seconds since the epoch, synchronised with the host machine. How do I interpret the timestamp from the beacon and is there a way to synchronise it with my camera timestamps? What event do these timestamps actually relate to, assuming there is some latency between distances being measured and position being updated?

smoker77
Posts: 392
Joined: Sat Feb 06, 2016 3:03 pm

Re: Timestamp Synchronization

Post by smoker77 »

Hello,

1. As you use NIA, one mobile beacon is updated per time, so update rate is divided by number of mobile beacons.
To increase update rate per mobile beacon, tou can try IA or MF NIA.
Please rread this document for details:
https://marvelmind.com/pics/architectur ... arison.pdf

2. In software versions before v7.200 each mobile beacon streamed its own timestamp, not sychronized with anybody.
Starting from v7.200 timestamps of all mobile beacons are syncronized with the modem and with the computer (if the modem is connected to dashboard software).
The timestamp means number of milliseconds since the epoch (64 bit integer), so it should be synchronized with your camera if it uses same clock as PC with the dashboard (just divide the timestamp by 1000 to get seconds instead milliseconds).
This 'Realtime timestamp' option is enabled by default. It can be disabled for compatibility with older software, see the attached screenshot.
The timestamp is related to a moment of ultrasond emission of the mobile beacon (in NIA). Data is transmitted with some latency, value of this latency in milliseconds is also transmitted.
See section 2.1.1.3 of the interfaces document for more details:
https://marvelmind.com/pics/marvelmind_interfaces.pdf
Attachments
изображение_2022-10-01_001206351.png
изображение_2022-10-01_001206351.png (49.97 KiB) Viewed 15045 times

cjh
Posts: 5
Joined: Wed Aug 10, 2022 11:49 am

Re: Timestamp Synchronization

Post by cjh »

Thanks for the information.

To use MF NIA do I need to purchase an additional license? In NIA, how is the center location of paired beacons computed if their individual positions are updated asynchronously - would the reported position from beacon 1 be the average of its current position and that of beacon 2 at the previous timestep?

I have enabled real-time timestamps in the dashboard and that works, however it seems the modem needs to remain connected to a machine with the dashboard open. I use the dashboard on a separate PC with the beacons connected to the onboard computer of a robot, and I am concerned the clocks of both machines may not be perfectly synchronized meaning the timestamps will not match. The robot has no screen attached, so I'm not sure I could run the dashboard on there. Is there some other way I could enable real time timestamps with the modem connected to the robot?

User avatar
admin
Site Admin
Posts: 400
Joined: Tue Jan 26, 2016 6:06 pm
Contact:

Re: Timestamp Synchronization

Post by admin »

- Yes, MF NIA is a powerful feature and it is licensed: https://marvelmind.com/product/mmsw0004/

- That is exactly the disadvantage of NIA in the Paired Beacons configuration because their location is calculated asynchronously. For many applications, particularly, relatively slow ones, that is OK. But the faster moving objects, it is could be a limitation and MF NIA is recommended.

My colleague will comment on the center calculations as it is done now, if there. Maybe, it is left to calculate on your side. I remember we had several options.

- The modem must always be powered, when the system is up and running because the modem is the heart of the system
The Dashboard generates the log. So, both must be up and running.
If you wish, you can use API and receive the stream and arrange your own log in our own system. Then, you don't need the Dashboard for that. The Dashboard may be closed in this case.

- About the timestamp, I will also my colleague to comment. It is one of the latest features enabled. It allows the timing to be synchronized between all elements: your computer, the modem, and the beacon. So, effectively, we are recording the absolute time not in some arbitrary clocks, but in the clocks of your computer. In the same way, your robots or other computers may be linked with the clocks of your master-clock computer.

This functionality shall be already available.

smoker77
Posts: 392
Joined: Sat Feb 06, 2016 3:03 pm

Re: Timestamp Synchronization

Post by smoker77 »

Hello,

In NIA, when one mobile beacon in the pair is updating location, the location of second mobile beacon (and the center of the pair) is also updated internally using extrapolation of previous location, known distance between mobile beacons in the pair and orientation angle calculated by IMU and ultrasound.
By default both mobile beacons stream location of the center of the pair and orientation angle, so you can know updated location of the center after updating of every mobile beacon in the pair, and (if needed) you can calculate locations of the mobile beacon - you have all information for this: location of the center, orientation angle and predefined distance between mobile beacons.

Currently there is no way to sync modem with the PC time without dashboard. Maybe we will add this function to API in future software updates.
You can try synchronize clocks of your dashboard PC and robot PC with the internet. I think clocks will be very closely synchronized.

RobinDurgan
Posts: 4
Joined: Wed Nov 23, 2022 9:22 am

Re: Timestamp Synchronization

Post by RobinDurgan »

Is the purchase of an additional license required in order to utilize MF NIA? In the context of NIA, the determination of the central location of paired beacons is of interest when their respective positions are updated asynchronously. In this scenario, it is worth considering whether the reported position from beacon 1 would be calculated as the average between its present position and the position of beacon 2 at the prior timestep.

Post Reply