Vizard 7 » Tutorials & Examples » Hardware » Real-time tracking data » Tutorial: Displaying tracking data
7.6

Tutorial: Displaying tracking data

To print out the data every half second we need to setup a continuous timer that will expire every half second.

def printSensorData():
    print(sensor.getPosition()  )

vizact.ontimer(0.5,printSensorData)

This creates the timer and registers the function that will be called when it expires. Inside the callback function we simply print out the sensor position using sensor.getPosition().

 

For orientation tracking sensors, you will need to use sensor.getEuler(), sensor.getAxisAngle(), or sensor.getQuat(), depending on which rotation format you prefer.

 

If you run the script and your sensor is working, you should see a list of numbers being printed out every half second in the output window.

Accessing a sensor device

Displaying tracking data