Using the OptiTrack camera over the network

In order to use the OptiTrack camera you need to connect it to a PC running Windows XP. It is recommended to run Windows in a virtual machine on the Mac that will use the data. This minimizes the network delay and creates a more stable connection.
On the windows machine you need to install the DataStreamRelayServer. A working image is on oliver in: Public->Software->Motion Tracking Disk Images. You might need to ask your supervisor to get it.

  1. Install Visual Studio
  2. Install Bonjour
  3. Install the OptiTrack SDK (found on oliver: Public->Software->Device Dependent Software->OptiTrack)
  4. Get the current version of the DataStreamRelayServer from git:
git clone ssh://oliver.informatik.rwth-aachen.de/Public/Software/i10%20Software/Vicon/VICONDataStream/Emitter
cd Emitter
git branch --track OptiTrack origin/OptiTrack
git checkout OptiTrack




To start the stream simply start the RelayServer. OptiTrack - StartScreen.png




On the Mac Side you need the ViconDataStreamFramework. Include it to your project (Important: the project is not allowed to use ARC since it has to run on 32bit which doesn't support ARC)

  1. Drag the framework into the 'Linked Frameworks&Binaries Section'
  2. Set the Target to 32bit (Target - Build Settings) OptiTrack - Set to 32bit.jpg
  3. Add a 'Copy Files' Build Phase, set the destination to 'Frameworks' and add the framework OptiTrack - Include Framework.jpg
  4. Change the implementation of the window property (add the IBOutlet as an ivar and change 'synthesize window=_window' to 'synthesize window')



Now you can access the stream using the following code in your project. These methods were created for the Vicon system but they also work for OptiTrack.

// Include Framework
#import <ViconDataStreamFramework/ViconDataStreamFramework.h>	
// Setup:
vicon = [[VDSVicon alloc] initWithBonjour];
vicon.delegate = self;
		
// Delegate method:
-(void)viconIsReady:(VDSVicon*)theVicon;
{
   [theVicon startStream:kVDSUnlabeledMarkerStreamType withTarget:self andSelector:@selector(viconDidReceiveFrame:markers:)];
}

// Data processing method:
-(void)viconDidReceiveFrame:(NSNumber *)theFrame markers:(NSDictionary *)theMarkers;
{
   NSLog(@"%@: %@", theFrame, theMarkers);
   // theMarkers is a dictionary of markers. The keys are a unique name like, “<unlabeled> 1”. The values are arrays of x, y, z.

}


// Stop:
[vicon stopStream:kVDSUnlabeledMarkerStreamType];

When the connection is established you can adjust the exposure, threshold and intensity of the camera on the windows machine.

  • To control the exposure: hold 'e' and use the up/down arrow keys
  • To control the intensity: hold 'i' and use the up/down arrow keys
  • To control the threshold: hold 't' and use the up/down arrow keys

OptiTrack - ScreenWithImage.png

OptiTrack - ScreenWithImageBad.png

Attachments:
File Description File size Downloads Last modified
ViconDataStreamFramework.framework 0.11.zip ViconDataStreamFramework v0.11 131 kB 784 2012-03-29 09:26