Device::SpaceNavigator - Read data from 3Dconnexion SpaceNavigator
use Device::SpaceNavigator; my $nav = Device::SpaceNavigator->new(); while ($nav->update()) { printf "Pitch:%i / Roll:%i / Yaw:%i X:%i / Y:%i / Z:%i Left button:%s Right button:%s\n", $nav->pitch(), $nav->roll(), $nav->yaw(), $nav->x(), $nav->y(), $nav->z(), $nav->left_button ? 'Pressed' : 'Released', $nav->right_button ? 'Pressed' : 'Released'; }
This module gives you a interface to read values from a connected 3Dconnexion SpaceNavigator. This awsome device has 6 axes; x, y, z, pitch, roll and yaw. In addition, it has two buttons.
Creates a new object for reading events from the device. Takes no arguments. Returns a new object.
Opens a new socket to the device.
$device The path to the device. Default: /dev/input/by-id/usb-3Dconnexion_SpaceNavigator-event-if00
$device
Closes the socket.
Reads and parse event from device. $nav->update() will call open if the socket for some reason is closed.
$nav->update()
$timeout Number of secounds $nav->update() should wait for a event from the device before returning.
$timeout
Returns the value for the X axe. (3Dconnexion calls this for "Pan left/right")
Returns the value for the Y axe (Zoom).
Returns the value for the Z axe (Pan up/down).
Returns the value for the pitch (Tilt).
Returns the value for the roll.
Returns the value for yaw (spin).
Returns the state of the left button.
Returns the state of the right button.
Kay Bærulfsen, <kaysb@cpan.org>
'SpaceNavigator' is a trademark of 3Dconnexion.
Copyright (C) 2010 by Kay Bærulfsen, <kaysb@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Device::SpaceNavigator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::SpaceNavigator
CPAN shell
perl -MCPAN -e shell install Device::SpaceNavigator
For more information on module installation, please visit the detailed CPAN module installation guide.