ROS Bridge Joystick
From wikidb
References
Javascript Test Page
The following script was placed in /home/eepp/public_html. It is derived from the w3 site listed above.
The significant addition is:
function runAnimation() { //console.log('runAnimation called'); window.requestAnimationFrame(runAnimation); var gamepads = navigator.getGamepads(); for (var i = 0; i < gamepads.length; ++i) { var pad = gamepads[i]; // console.log('id', pad.id); // console.log('index', pad.index); console.log('button 1', pad.buttons[0]); console.log('axes', pad.axes[0], pad.axes[1], pad.axes[2], pad.axes[3]); } } window.requestAnimationFrame(runAnimation);
Compatibility
Tested on these browsers
- Mozilla Firefox 44.0.2 on Ubuntu 14.04
- Chrome version 48.0.2564.116 on OS X
- NOT Safari version 9.9.3 on OS X
Hardware
- Logitech Dual Action gamepad G-UF13A
Run
In first terminal.
roscore
In second terminal.
rosrun phidgets motor_control_hc
In third terminal.
roslaunch rosbridge_server rosbridge_websocket.launch
In browser
localhost/~eepp/js_test.html
Gamepad Atributes
- Axes 0
- x axes for Left joystick
- Left action is 0.0 to -1.0
- Right action is 0.0 to 1.0
- x axes for Left joystick
- Axes 1
- y axes for Left joystick
- Up action is 0.0 to -1.0
- Down action is 0.0 to 1.0
- y axes for Left joystick