OptiTrack Point Cloud End of trail navigation bar

Table of Contents

OptiTrack Trackables

Gives the 6-DOF position of trackable objects tracked by the OptiTrack camera system.

Library

QUARC Targets/Devices/Third-Party/NaturalPoint/OptiTrack

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Devices/Third-Party/NaturalPoint/OptiTrack')

Description

OptiTrack Trackables

The OptiTrack Trackables block uses the OptiTrack Motive API to read the 6 degree-of-freedom (6-DOF) position and orientation of trackable objects (also called rigid body objects) defined through the OptiTrack Motive software (formerly OptiTrack Tracking Tools).

Helpful Hints

If you are unable to start the Motive software after running a model with the this block, type clear mex in the MATLAB console to release the Motive software and retry.

Installation Requirements

OptiTrack Motive Installation

Install In order to use the OptiTrack Trackables block on 64-bit platforms, the OptiTrack Motive version 1.10.0 Final x64 software or later must be installed (version 1.10.0, 2.0.1, 2.1.1, 2.1.2, 2.2.0 have been tested to work). In order to use the OptiTrack Trackables block on 32-bit platforms, the OptiTrack Motive version 1.9.0 Final x86 software to 1.10.0 Final x86 must be installed The software is not included with QUARC and may be provided with the camera system or downloaded from the OptiTrack website.

Warning Make sure you install the recommended and supported version of Motive as other versions may not utilize the same axis conventions.

System Path Configuration

Install The OptiTrack directories must be added to the system Path environment variable. For example, if the Motive is installed under C:\Program Files\OptiTrack, the following paths should be added to the system's Path environment variable: C:\Program Files\OptiTrack\Motive\lib, and C:\Program Files\OptiTrack\Motive. Note that the computer will have to be rebooted after adding the directories to the Path environment variable before this block can be used.

System Environment Variable

Install The following environment variable must be created and set with the value as indicated:

Variable name Variable value
QT_QPA_PLATFORM_PLUGIN_PATH %NPTRACKINGTOOLS_LIB%\..\plugins\platforms\

Note that the computer will have to be rebooted after adding the environment variable before this block can be used.

QUARC Model URI Configuration

Install On some systems, it is possible that the OptiTrack Motive API may take longer to load and initialize. When this happens, it would trigger a timeout error message from Simulink. When using the shared memory (shmem) protocol for the model URI, it is recommended that a timeout option be specified in the MEX-file arguments (under Model Configuration Parameters) to increase the timeout threshold value (default value is 5 seconds) to avoid triggering the timeout error. The MEX-file arguments can be accessed through Simulation->Model Configuration Parameters->Code Generation->Interface. The following shows an example MEX-file arguments string setting the timeout threshold value to 10 seconds for the model URI: '-w -d %d -uri %u', 'shmem://%m:1?timeout=10'

Camera Set-Up and Calibration

Install The OptiTrack Motive software is used for calibrating the cameras, defining the workspace coordinate frame, and defining trackables. Once calibrated, a calibration file (.cal) must be saved to the computer and referenced in this block's parameters. Refer to the Motive user manual for instructions on setting up the camera system and calibrating the cameras.

Input Ports

This block has no input ports.

Output Ports

xyz

A vector containing 3*n elements, where n is the number of trackables specified in the block parameters. Each group of 3 elements represents the xyz coordinates of a trackable object; e.g., the output vector [x_1, y_1, z_1, x_2, y_2, z_2] contains the xyz coordinates (x_1, y_1, z_1) and (x_2, y_2, z_2) for objects 1 and 2, respectively. If a trackable object is not detected in the current frame its xyz marker position holds its previous value.

q

A quaternion (orientation) vector containing 4*n elements, where n is the number of trackable IDs specified in the block parameters. Each group of 4 elements represents the quaternion (qx, qy, qz, qw) of an object's orientation; e.g., the output vector [qx_1, qy_1, qz_1, qw_1, qx_2, qy_2, qz_2, qw_2] contains the quaternions defined by (qx_1, qy_1, qz_1, qw_1) and (qx_2, qy_2, qz_2, qw_2) for the first two objects, respectively. If a trackable object is not detected in the current frame its orientation q holds its previous value.

rot

A rotation vector containing 3*n elements, where n is the number of trackable IDs specified in the block parameters. Each group of 3 elements represents relative rotations about the (X, Y, Z) axes, respectively, in radians. The (X, Y, Z) axes are defined in the Motive software. If a trackable object is not detected in the current frame its rotation holds its previous value. The OptiTrack rotation convention follows right-hand rule, relative rotations about the (X, Y, Z) axes in that order.

is_tracking

A boolean vector indicating the detection status of each trackable object. The vector contains n boolean elements, where n is the number of trackables specified in the block parameters. If element i (i = 1, .., n) is 0 (false) then the trackable i is not detected in the current frame and its position and orientation are not guaranteed to be valid. If element i is 1 (true) then the trackable i is detected in the current frame and its position and orientation are valid.

Parameters and Dialog Box

OptiTrack Trackables

Calibration file

The file path to the calibration file generated from the OptiTrack Motive software (see the Motive user manual for instructions on setting up the OptiTrack system and calibration). The browse button (...) can be used to navigate and select the calibration file.

User Profile or Trackables definition file

The file path to the Motive user profile file (.xml or .motive) or trackables definition file (.tra) generated from the OptiTrack Motive software (see the Motive user manual for instructions on defining assets or trackable objects). The user profile or trackables definition file contains the definition for one or more trackable objects and is used to identify each object uniquely using the OptiTrack system. The browse button (...) can be used to navigate and select the user profile or trackables definition file.

Trackable IDs

A vector of integer ID values that selects the trackable objects to be tracked. Valid ID values range from 1 to 1024, and are setup through the OptiTrack Motive software. The order in which the trackable object IDs are specified in this vector is the order that the xyz position and orientation elements will appear in the output vectors xyz, q and rot.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered or Enabled Subsystem, or in a referenced model.

To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

No

No

QUARC Linux QBot Platform Target

No

No

QUARC Linux QCar 2 Target

No

No

QUARC Linux QDrone 2 Target

No

No

QUARC Linux Raspberry Pi 3 Target

No

No

QUARC Linux Raspberry Pi 4 Target

No

No

QUARC Linux RT ARMv7 Target

No

No

QUARC Linux x64 Target

No

No

QUARC Linux DuoVero Target

No

No

QUARC Linux DuoVero 2016 Target

No

No

QUARC Linux Verdex Target

No

No

QUARC QNX x86 Target

No

No

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

No

No

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

No

No

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar