OptiTrack tracking setup¶
Pose tracking with OptiTrack and NaviNIBS¶
Installation¶
Motive installation¶
Motive is the OptiTrack software for camera calibration and tracking.
- Download from here.
NaviNIBS has been tested with Motive version 3.0.3
Plus Toolkit installation¶
The Plus Toolkit provides tools for communication with tool tracking hardware (e.g. NDI and OptiTrack cameras).
- Download from here.
If using Motive version >= 3.0, make sure to download Plus Toolkit version >= 2.9.0 for some specific fixes related to OptiTrack systems.
If using Motive version 2.0.*, download Plus Toolkit 2.8.* (tested to not be compatible with 2.9.*).
Configuration¶
Motive configuration¶
Open Motive
Perform camera calibration
Export calibration (File -> Export calibration…) to a file called
OptiTrackCalibration.cal
(or update file contents below to match your chosen.cal
filename).- Create Assets (Motive’s term for what are called tool trackers in NaviNIBS).
If you don’t have predefined information about the location of markers on a tracker, you can create a rigid body asset by selecting a cloud of markers and clicking
Create Rigid Body
. However, the orientation of the rigid body sent to NaviNIBS relative to individual markers will then be arbitrary.If you have an NDI .rom file, you can use the
GenerateMotiveToolFiles.py
script to extract marker coordinates from the .rom and format these coordinates in a format suitable for import into Motive.Give each active asset a unique name. Note that IGTLink (used between PlusServer and NaviNIBS) has a limit of 20 characters for the name of a transform, including the “ToTracker” suffix, so choose a short name. This name should match the TrackerKey that you define later in your NaviNIBS tool specification.
In most situations, you’ll want to go into the Properties for the newly created asset and change “Minimum Markers to Boot” to 3, so that camera tracking can resume immediately as soon as just 3 markers on the tracker are visible after an occlusion.
Enable streaming from Motive (Edit -> Settings -> Streaming -> NatNet -> Enable).
Export Motive profile (File -> Export profile…) to a file called
OptiTrackProfile.motive
(or update file contents below to match your chosen.motive
filename).
Plus Server device set specification¶
Plus Server will act as a bridge between Motive and NaviNIBS. A Device set
xml file is required to specify the devices for which Plus Server will relay pose information.
Example Plus Device sets
<PlusConfiguration version="2.7">
<DataCollection StartupDelaySec="1.0">
<DeviceSet
Name="PlusServer: OptiTrack (Profile only)"
Description="Broadcasting tracking data through OpenIGTLink."
/>
<Device
Id="TrackerDevice"
Type="OptiTrack"
ToolReferenceFrame="Tracker"
Profile="OptiTrackProfile.motive"
Calibration="OptiTrackCalibration.cal"
AttachToRunningMotive="TRUE"
MotiveDataDescriptionsUpdateTimeSec="1.0" >
<DataSources>
<DataSource Type="Tool" Id="Pointer" />
<DataSource Type="Tool" Id="Subject" />
<DataSource Type="Tool" Id="CB60" />
<DataSource Type="Tool" Id="Calibration" />
</DataSources>
<OutputChannels>
<OutputChannel Id="TrackerStream">
<DataSource Type="Tool" Id="Pointer" />
<DataSource Type="Tool" Id="Subject" />
<DataSource Type="Tool" Id="CB60" />
<DataSource Type="Tool" Id="Calibration" />
</OutputChannel>
</OutputChannels>
</Device>
</DataCollection>
<PlusOpenIGTLinkServer
MaxNumberOfIgtlMessagesToSend="1"
MaxTimeSpentWithProcessingMs="50"
ListeningPort="18944"
SendValidTransformsOnly="FALSE"
OutputChannelId="TrackerStream" >
<DefaultClientInfo>
<MessageTypes>
<Message Type="TRANSFORM" />
</MessageTypes>
<TransformNames>
<Transform Name="PointerToTracker" />
<Transform Name="SubjectToTracker" />
<Transform Name="CB60ToTracker" />
<Transform Name="CalibrationToTracker" />
</TransformNames>
</DefaultClientInfo>
</PlusOpenIGTLinkServer>
</PlusConfiguration>
<PlusConfiguration version="2.7">
<DataCollection StartupDelaySec="1.0">
<DeviceSet
Name="PlusServer: OptiTrack Cobot (Profile only)"
Description="Broadcasting tracking data through OpenIGTLink."
/>
<Device
Id="TrackerDevice"
Type="OptiTrack"
ToolReferenceFrame="Tracker"
Profile="OptiTrackProfile_Cobot.motive"
Calibration="OptiTrackCalibration.cal"
AttachToRunningMotive="TRUE"
MotiveDataDescriptionsUpdateTimeSec="1.0" >
<DataSources>
<DataSource Type="Tool" Id="Pointer" />
<DataSource Type="Tool" Id="Subject" />
<DataSource Type="Tool" Id="CobotLeft" />
<DataSource Type="Tool" Id="CobotRight" />
<DataSource Type="Tool" Id="B65APRO" />
<DataSource Type="Tool" Id="CB60" />
<DataSource Type="Tool" Id="Calibration" />
</DataSources>
<OutputChannels>
<OutputChannel Id="TrackerStream">
<DataSource Type="Tool" Id="Pointer" />
<DataSource Type="Tool" Id="Subject" />
<DataSource Type="Tool" Id="CobotLeft" />
<DataSource Type="Tool" Id="CobotRight" />
<DataSource Type="Tool" Id="B65APRO" />
<DataSource Type="Tool" Id="CB60" />
<DataSource Type="Tool" Id="Calibration" />
</OutputChannel>
</OutputChannels>
</Device>
</DataCollection>
<PlusOpenIGTLinkServer
MaxNumberOfIgtlMessagesToSend="1"
MaxTimeSpentWithProcessingMs="50"
ListeningPort="18944"
SendValidTransformsOnly="FALSE"
OutputChannelId="TrackerStream" >
<DefaultClientInfo>
<MessageTypes>
<Message Type="TRANSFORM" />
</MessageTypes>
<TransformNames>
<Transform Name="PointerToTracker" />
<Transform Name="SubjectToTracker" />
<Transform Name="CobotLeftToTracker" />
<Transform Name="CobotRightToTracker" />
<Transform Name="B65APROToTracker" />
<Transform Name="CB60ToTracker" />
<Transform Name="CalibrationToTracker" />
</TransformNames>
</DefaultClientInfo>
</PlusOpenIGTLinkServer>
</PlusConfiguration>
See the Plus Toolkit OptiTrack documentation for more information.
Create your Plus device set file.
Open Plus Server Launcher
Change the “Device set configuration directory” to the directory containing your device set file.
You should see your device set populate as one of the items in the “Device set:” dropdown. Select it.
Click “Launch server”
Confirm that tracking data is broadcasting.
Define tools in NaviNIBS, with
trackerKey
matching the name of each asset in Motive.(After defining suitable tools in NaviNIBS) launch CameraPanel in NaviNIBS to try viewing the tracked tools.
Usage¶
Launch Motive. Your previous settings should be loaded automatically, connections to cameras should be established.
Launch Plus Server Launcher. Your previous device set should be selected automatically. Click “Launch server” to start streaming tracker poses.
Launch NaviNIBS. Behind the scenes, the NaviNIBS tool positions server should launch automatically, making streamed tool positions available throughout NaviNIBS.
Check tool visibility in NaviNIBS (e.g. in the
Camera
panel).