Reading from a Mouse / Keyboard / XBox Controller / Space Navigator
For each input device there is a special block in the control system which handles the specific device, see Available Blocks.
Reading from a Mouse
In the EEROS library you will find a directory with examples. For this example see MouseTest.cpp.
Open a shell in the build directory of your EEROS library and run
$ sudo ./examples/block/mouseTest
This examples reads four axis of a mouse together with three buttons and outputs the results periodically. Further, the safety system checks for the middle button to be pressed. This causes a level change. As soon as the button is released the safety system changes back to the first level.
In order to read from the proper mouse events you can install and run the evtest
program.
$ sudo apt-get install evtest $ sudo evtest
This programm will list all connected devices together with the associated event number. Please adapt the program accordingly.
Reading from a Keyboard
In the EEROS library you will find a directory with examples. For this example see KeyboardTest.cpp.
Open a shell in the build directory of your EEROS library and run
$ sudo ./examples/block/keyboardTest
Study the code of the example together with the code of the KeyboardInput
block.
Reading from a XBox Controller
In the EEROS library you will find a directory with examples. For this example see XBoxTest.cpp.
Open a shell in the build directory of your EEROS library and run
$ sudo ./examples/block/xBoxTest
This examples reads and outputs periodically all 8 buttons and 8 axis of a XBox controller. Further, the safety system checks for the button 'X' to be pressed. This causes a level change. As soon as the button is released the safety system changes back to the first level.
If you connect several such controller you have to check in /dev/input/
for the controller of your choice and adapt the program accordingly.
Reading from a Space Navigator
In the EEROS library you will find a directory with examples. For this example see SpaceNavigatorTest.cpp.
Open a shell in the build directory of your EEROS library and run
$ sudo ./examples/block/spaceNavigatorTest
This examples reads and outputs periodically the 3 position and 3 rotation axis together with the state of the 2 buttons of a space navigator mouse. Further, the safety system checks for the left button to be pressed. This causes a level change. As soon as the button is released the safety system changes back to the first level.