UDP capture broadcast/trigger
Vicon Tracker supports a simple UDP protocol to broadcast when capture has started. Tracker can also receive these messages, which can be used to trigger a capture remotely.
For information on how to set up remote triggering in Tracker, see Recording live trials, and in particular, Step 6.
Example notifications
Start notification
The following example shows a Start notification. Note that the broadcast must fit into one UDP packet.
The indents in the following example are for clarity: the actual packet is not indented. White space between tokens is removed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureStart> <Name VALUE="dance"/> <Notes VALUE="The pets ants crime deer jump. "/> <Description VALUE="The crowd pencil pets alert fold deer. With welcome practice representative complete great? Or jolly tiny memorise thread. However wool insect pipe! "/> <DatabasePath VALUE="D:/Jeremy/Susan/Captures/Take"/> <Delay VALUE="33"/> <PacketID VALUE="33360"/> </CaptureStart>
Where:
Name
|
The name of the trial, which is used as the filename for the capture files, for example <Name>.x2d . |
Notes
|
Any notes provided |
Description
|
Any description provided. Avoid very long description strings as the broadcast must fit into one UDP packet. If it does not, the broadcast is not sent. |
DatabasePath
|
The target path for the capture files. |
Delay
|
The number of milliseconds that the broadcast is made before the capture starts. This delay enables clients to do any preparation required to respond. |
PacketID
|
A number that individually identifies the packet. It is incremented for each packet generated. Use it to discard duplicate packets that are delivered by UDP. (This can happen if there are multiple paths between the broadcasting and listening machines.) |
Stop notification
The following example shows a Stop notification. It is a notification that capturing has stopped.
Note that writing the file to disk may not be complete. Wait for the corresponding Complete notification before trying to open the file.
Possible values for the result are:
- SUCCESS - Everything was ok.
- FAIL - Everything was not ok. Perhaps the disk ran out of room, or the system was unplugged. You may get a truncated file.
- CANCEL - The user stopped the capture process. There will not be a Complete notification.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureStop RESULT="SUCCESS"> <Name VALUE="dance"/> <DatabasePath VALUE="D:/Jeremy/Susan/Captures/Take"/> <Delay VALUE="33"/> <PacketID VALUE="33361"/> </CaptureStop>
Complete notification
The following example shows a Complete notification. It indicates that the captured file is ready at the path specified. Note that:
- When capture is complete, buffers have yet to be flushed to disk.
- If the file is on a remote drive, it may be captured locally and then copied to the final location. This may take some time.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureComplete> <Name VALUE="dance"/> <DatabasePath VALUE="D:/Jeremy/Susan/Captures/Take"/> <PacketID VALUE="33362"/> </CaptureComplete>
Timecode Start notification
The following example shows a Timecode Start notification. It is generated when the system is armed. Note that:
- Capture starts when the system receives the timecode specified.
- Additional notifications may be generated if the start timecode is updated after the system is armed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureStart> <TimeCode VALUE="0 38 10 17 0 0 0 4"/> <Name VALUE="slip"/> <Notes VALUE="The last ants great blade jump. "/> <Description VALUE="The truthful pencil pets ants crime deer. With geese trail representative complete crowd? Or jolly toothbrush slip thread. However worried insect nest! "/> <DatabasePath VALUE="D:/Captures/Take/DayOne/Final"/> <PacketID VALUE="33364"/> </CaptureStart>
Where:
TimeCode
is represented as a sequence of integers delimited with spaces.
- Hours
- Minutes
- Seconds
- Frames
- Sub-Frame (Always zero)
- Field
- 0 - Even Field
- 1 - Odd Field
- Standard
- 0 - PAL
- 1 - NTSC
- 2 - NTSC Drop
- 3 - Film at 24fps
- 4 - NTSC Film
- 5 - 30Hz exactly
- Sub-Frames Per Frame (the multiple of the timecode rate that the system is running at)
Timecode Stop notification
The following example shows a Timecode Stop notification. Note that additional notifications may be generated if the Timecode Stop is updated after the system is armed or possibly even capturing.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureStop> <TimeCode VALUE="0 46 27 15 0 0 0 4"/> <Name VALUE="slip"/> <DatabasePath VALUE="D:/Captures/Take/DayOne/Final"/> <PacketID VALUE="33365"/> </CaptureStop>
The values for TimeCode
are as listed in Timecode start notification.
Duration Stop notification
The packet is generated when the system is armed, or immediately prior to the capture being started.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <CaptureStop> <Duration FRAMES="12867" PERIOD="32865" TICKS="5553087"/> <Name VALUE="memorise"/> <DatabasePath VALUE="D:/Take/DayOne/Final/Susan"/> <PacketID VALUE="33367"/> </CaptureStop>
Where:
Duration
is the number of frames that will be captured.
The packet may contain extra information describing the frame rate:
PERIOD
is the number of clock ticks between each frameTICKS
is the number of ticks in each second
The frames per second of the system can be calculated as TICKS/PERIOD
. This representation of the frame rate avoids rounding errors for rates such as NTSC, which cannot be stored in a double without a loss of precision.
<Duration FRAMES="12867" PERIOD="653254" TICKS="135000000" />
Supplied example code
The examples are provided in C++ and require the boost library for communications.
- CaptureBroadcastMonitor shows how to monitor for and decode the capture notifications described above.
- RemoteStartStop shows how to package and send the packets to trigger capture start and stop.