Projet C IG (1A)

IHM (2A)


VR/AR/Post-WIMP (3A)


Projet image (2A)


HCI (MoSIG 2)


Test Logiciel


Projects Docs

Receiving Optitrack data in C/C++

This page documents a library developed in the HCI research group here in Grenoble. Other libraries can be found on the web to receive Optitrack data, such as NatNetLinux.

A Minimal and Self-Contained (sc) Example

Available in a public git repository.

 Begin Packet
 -------
 Message ID : 7
 Byte count : 297
 Frame # : 174229
 Marker Set Count : 2
 Model Name: Rigid Body 1
 Marker Count : 3
	 Marker 0 : [x=0.10,y=-0.20,z=-0.14]
	 Marker 1 : [x=0.06,y=-0.11,z=-0.01]
	 Marker 2 : [x=0.04,y=-0.06,z=0.06]
 Model Name: all
 Marker Count : 3
	 Marker 0 : [x=0.10,y=-0.20,z=-0.14]
	 Marker 1 : [x=0.06,y=-0.11,z=-0.01]
	 Marker 2 : [x=0.04,y=-0.06,z=0.06]
 Unidentified Marker Count : 0
 Rigid Body Count : 1
 ID : 1
 pos: [0.07,-0.12,-0.03]
 ori: [0.00,-0.01,-0.01,1.00]
 Mean marker error: 0.00

More complex examples

Getting the libraries and sample code

Execute the following command in the directory where you want to work:

  svn co https://brouet.imag.fr/SVN/gilpw/

Compiling the "optitrack_minimal" example

From where you executed the "svn co" command (see above), go to the optitrack_minimal directory, create a new directory for building, go there, execute cmake to create the makefile and make to build the program:

 cd gilpw/examples/optitrack_minimal
 mkdir build
 cd build
 cmake ..
 make

Run the program

 ./optitrack_minimal

If all goes well, you should see something like:

 % ./optitrack_minimal
 Starting minimal optitrack example.
 0 markers, 0 rigid bodies.
 0 markers, 0 rigid bodies.
 3 markers, 0 rigid bodies.
 3 markers, 0 rigid bodies.

 (...)

 3 markers, 0 rigid bodies.
 3 markers, 0 rigid bodies.
 ^C3 markers, 0 rigid bodies.
 Finishing minimal optitrack example.
 % 

Compiling the "optitrack_osg" example

This example requires a working distribution of Open Scene Graph.

The example displays a 3D scene with a 3-arrow representation of the world reference, and real-time representation of markers (yellow spheres) and rigid bodies (a number, the rigid body identifier).

Go to the optitrack_osg directory, create a new directory for building, go there, execute cmake to create the makefile and make to build the program:

 cd gilpw/examples/optitrack_osg
 mkdir build
 cd build
 cmake ..
 make

Run the program

 ./optitrack_osg

If all goes well, you should see something like the image below (use the mouse and mouse wheel to navigate the 3D scene).

Edit - History - Upload - Print - Recent Changes - Search
Page last modified on November 24, 2023, at 10:00 AM