Start of trail End of trail navigation bar

Table of Contents

VRPN Client

VRPN clients to interface with VRPN servers to get VRPN enabled devices information.

Library

QUARC Targets/Devices/Third-Party/VRPN

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/VRPN')

Description

VRPN Client

The VRPN Client block acts as a client in a Virtual Reality Peripheral Network (VRPN). Currently it only supports the tracker device type. Popular tracker systems, e.g. Optitrack, Vicon, Phase Space, all have support for VRPN.

The VRPN Client block outputs the positions, velocity, and acceleration of the trackers (if the trackers provide all of them). It also produces an output that indicates when a new measurement has been received for that tracker, since the block does not wait for the measurement to be received from VRPN server.

By default, the block outputs Quaternion in Hamilton convention (qw, qx, qy, qz), which is consistent with the QUARC Quaternion blocks and MATLAB. This is different than the VRPN standard of using JPL convention (qx, qy, qz, qw). The parameter Quaternion in JPL convention can be used to change the Quaternion outputs to JPL convention.

Input Ports

This block has no input ports.

Output Ports

Trackers Pos

A matrix containing 3 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents the xyz coordinates of a tracker sensor; e.g., the output matrix [x_1, x_2; y_1, y_2; z_1, z_2] contains the xyz coordinates (x_1, y_1, z_1) and (x_2, y_2, z_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its position holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the tracker reports this information.

Trackers Quat

A matrix containing 4 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents the orientation (qw, qx, qy, qz) of a tracker sensor in quaternion format; e.g., the output matrix [qw_1, qw_2; qx_1, qx_2; qy_1, qy_2; qz_1, qz_2] contains the orientations defined by (qw_1, qx_1, qy_1, qz_1) and (qw_2, qx_2, qy_2, qz_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its orientation holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Vel

A matrix containing 3 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents the xyz velocities of a tracker sensor; e.g., the output matrix [vx_1, vx_2; vy_1, vy_2; vz_1, vz_2] contains the xyz velocities (vx_1, vy_1, vz_1) and (vx_2, vy_2, vz_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its velocity holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Quat Vel

A matrix containing 4 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents angular velocities (qvw, qvx, qvy, qvz) of a tracker sensor in quaternion format; e.g., the output matrix [qvw_1, qvw_2; qvx_1, qvx_2; qvy_1, qvy_2; qvz_1, qvz_2] contains the angular velocities defined by (qvw_1, qvx_1, qvy_1, qvz_1) and (qvw_2, qvx_2, qvy_2, qvz_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its angular velocity holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Quat Vel DT

A vector containing n elements, where n is the number of tracker sensors specified in the block parameters. Each element represents the angular velocity delta time of the tracker sensor; e.g., the output vector [qvdt_1, qvdt_2] contains the angular velocities delta time defined by qvdt_1 and qvdt_2 for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its angular velocity delta time holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Acc

A matrix containing 3 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents the xyz accelerations of a tracker sensor; e.g., the output matrix [ax_1, ax_2; ay_1, ay_2; az_1, az_2] contains the xyz accelerations (ax_1, ay_1, az_1) and (ax_2, ay_2, az_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its acceleration holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Quat Acc

A matrix containing 4 x n elements, where n is the number of tracker sensors specified in the block parameters. Each column of the matrix represents angular acclerations (qaw, qax, qay, qaz) of a tracker sensor in quaternion format; e.g., the output matrix [qaw_1, qaw_2; qax_1, qax_2; qay_1, qay_2; qaz_1, qaz_2] contains the angular accelerations defined by (qaw_1, qax_1, qay_1, qaz_1) and (qaw_2, qax_2, qay_2, qaz_2) for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its angular acceleration holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers Quat Acc DT

A vector containing n elements, where n is the number of tracker sensors specified in the block parameters. Each element represents the angular acceleration delta time of the tracker sensor; e.g., the output vector [qadt_1, qadt_2] contains the angular accelerations delta time defined by qadt_1 and qadt_2 for tracker sensors 1 and 2, respectively. If no new tracker sensor data is received in the current frame, its angular acceleration delta time holds its previous value, and the Trackers New output would be false (0).

This would only have valid data if the trackers report this information.

Trackers New

A vector containing n elements, where n is the number of tracker sensors specified in the block parameters. Each element indicates whether the data for that tracker sensor is new. Since the block does not wait for the trackers data to be reported (since those data are often slow compared to typical controller sample rates), this output may be used to determine when new tracker data has been received. If the tracker data is not new, the other outputs will hold their prior values.

Data Type Support

This block supports outputs of type double, except for Trackers New which is boolean.

Parameters and Dialog Box

VRPN Client

VRPN server

The VRPN server parameter is used to specify the hostname and port number of the VRPN server that this block is communicated with. You can specify either a hostname or the IP address of the VRPN server. Default port number for VRPN server is 3883, but you can change it to other values if the VRPN server uses a different one.

List of trackers

This list specifies the trackers that the VRPN Client block will try to read from the VRPN server. Each row represents one tracker. Each column is explained below:

Column title

Description

Tracker device

A string that represents the name of the tracker as defined by the VRPN server. Depending on the VRPN server, the tracker names are defined in different ways. Consult the VRPN server documentation for how the trackers are defined.

For example, the VRPN example server on VRPN GitHub repository uses a vrpn.cfg configuration file to define VRPN devices. The tracker names are defined as the first argument for the device (e.g. for vrpn_Tracker_NULL tracker type, the device name is Tracker0)

For Optitrack Motive software, it has VRPN server built-in. The tracker names are defined by the rigid body names.

For PhaseSpace system, the trackers need to be defined in their Master Client software's OWL Trackers (refer to PhaseSpace documentation about how to define trackers from markers), and take note of the trackers' ID. In the vrpn server's vrpn.cfg file, in the vrpn_Tracker_PhaseSpace section, it is suggested to use the same tracker name as defined in the Master Client software. Then in the owl section, set the sensor line with parameters like sensor=SENSOR_NUMBER type=rigid tracker=TRACKER_ID, where SENSOR_NUMBER should be a number starting from 0, and TRACKER_ID is the ID as specified in the Master Client software for the particular tracker.

Number of sensors

A scalar that represents the number of sensors that this tracker has. For some trackers, there can be multiple sensors on the tracker.

For example, the VRPN example server on VRPN GitHub repository uses a vrpn.cfg configuration file to define VRPN devices. The number of sensors for the tracker are defined as the second argument for the device (e.g. for vrpn_Tracker_NULL tracker type, the number of sensors for Tracker0 is 2)

On the other hand, for Optitrack Motive software each rigid body only has one sensor.

Sensors to read

A vector of sensor index (0-based) to read from the tracker. If there is one sensor for the tracker, then the index must be 0. For trackers that have multiple sensors, set this to [0:num_sensors-1] if you want to read all the sensors. You can also specify only the particular tracker sensor to read, e.g. [0 2], if you only want the first and last sensor for a tracker that has 3 sensors.

Note that the dimension of the block's outputs depends on number of sensors (not the number of trackers). e.g. if Number of sensors is 3, and the Sensors to read is [0:2] (i.e. read all the sensors of this tracker), then e.g. the Trackers Quat output port would have a dimension of 4 x 3, because the number of columns represent the number of sensors, which is 3, and the number of rows represent the quaternion has 4 elements for each sensor.

The order of the output ports columns (i.e the sensor order) depends on the order of this list. The + and - button can be used to add or remove trackers from the list, respectively. The ^ and v button can be used to move a selected tracker up and down the list, respectively.

Quaternion in JPL convention (tunable offline)

Indicates whether the Trackers quaternion outputs are in JPL convention. If not set, the quaternion outputs are in Hamilton convention.

Sample time (second)

The sampling period (in seconds) at which the sensor data are output from the VRPN Client 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.

The default sample time is set to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model. Hence, the default sample time is a discrete sample time with the same sampling time as the fixed step size of the model.

Active during normal simulation (tunable offline)

Indicates whether this block should communicate during normal simulation.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

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

Yes

Yes

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

 

navigation bar