Vizard 7 » Reference » Input Devices » Sensor basics

Sensor Basics

Sensors are plug-ins that interface between Vizard and hardware. Sensors make the functions and data provided by the hardware manufacturers' APIs available to Vizard. One of Vizard's strengths is the variety of hardware connections it supports as standard features. You will want to work directly with sensor objects if you need access to the raw sensor data (e.g., you are performing a special function with the data or perhaps saving the data to disk).


To access a sensor's data:

  1. Include "viz.add(sensorPlugin)" in your script.
  2. Replace sensorPlugin with the sensor filename.
  3. Use one of the <sensor>.get methods to access the sensor's data.


myTracker = viz.add('sensor.dls')   # Connect to a sensor
print(myTracker.getPosition() )# Print sensor position
print(myTracker.getEuler() )# Print sensor euler rotation
data = myTracker.getData()  # Access the raw data from the sensor
print(data  )# Print the array of data

Most sensors represent a 3DOF or 6DOF device. In this case you should use the following methods to get position/rotation data from the sensor.

Sensor method



Get the [x,y,z] position.


Get the [yaw,pitch,roll] euler rotation.


Get the [x,y,z,deg] axis-angle rotation.


Get the [x,y,z,w] quaternion rotation.


Get the 4x4 transform matrix.

The flag parameter is optional. Some sensors provide multiple position/rotations values, in which case the flag parameter specifies which value to retrieve.


There are special sensors which don't contain any position/rotation data (e.g. 5DT, Cyberglove), or regular sensors which contain extra information. In these cases you can use the following method to retrieve the raw data:

Sensor method



Returns a list of floating point values. The size of the list depends on the sensor.

You can also retrieve the name of a sensor using the following method:

Sensor method



Returns the name of the sensor.

Extension sensors

Extension sensors are a newer form of sensors that support more advanced behaviors. The interface for extension sensors is similar to regular sensors. Extension sensors can also support button data, which can be accessed through the following methods:

Sensor method



Get the state of the buttons as a bit flag.


Get the number of buttons on sensor.


Returns whether the specified button is currently down.

Extension sensors can also trigger the following button related events:

Sensor event



Called when a sensor button is pressed.


Called when a sensor button is released.

See also

In this section:

Input devices introduction

Native device support