Issues.00469 - lordmundi/wikidoctest GitHub Wiki
00469: add example for joystick control of camera
Summary: add example for joystick control of camera
Created: 2013–01–08 15:27
Status: Released
Category: Request
From: frankie
Version: 2.2
Released_In: 2.3
Description:
The joystick2 plugin interfaces with various USB joysticks to give an API to the various axes and buttons in tcl. The flycam plugin gives an interface to fly a camera around in a rate-proportional fashion using hardware hand-controllers or a node that specifies axes deflections.
This is a request for an example that shows how to put these together to fly a camera around using a standard USB joystick with multiple proportional control axes.
Comments
frankie January 08, 2013, at 04:39 PM: This has been added. To use, do the following:
-
If you don't already have a userdata directory you are using, copy the template directory ("userdata") to create a new one and set your "USERDATA" environment variable to point to it.
-
Copy the files into your userdata, like so:
cp configs/flycam2_joystick.cfg $USERDATA/configs cp configs/flycam2_joystick_nodes.cfg $USERDATA/configs cp gui/flycam2_joystick.tcl $USERDATA/gui
-
Edit your $USERDATA/user.cfg to include the two config files in the POSTLOAD block near the top:
DSP_CONFIG { POSTLOAD { "${USERDATA}/configs/user_models.cfg" "${USERDATA}/configs/flycam2_joystick_nodes.cfg" "${USERDATA}/configs/flycam2_joystick.cfg" } ...
-
Use the jstest utility on linux to test and make sure you can see events from the various buttons and axes on your joystick
-
Run EDGE using your userdata directory. You should be able to plugin the joystick after EDGE is running and see a printout in the console when it is detected. If you don't see that, you may need to edit your $USERDATA/configs/flycam_joystick.cfg and adjust the device_path command line option to the joystick2 plugin to specify what device your joystick is on. Full documentation of the joystick2 plugin is here
-
Right click and select "Assign Camera". Choose the camera "FLYCAM2". This is the camera that the script is set up to fly.
-
Button 8 (if you have one), is set up by default to cycle through 3 cameras. Try using it.
-
Button 5 (if you have one), is set up by default to switch to vernier rates while held and slow the camera down for better precision.
-
Button 9 (if you have one), is set up by default to reset the FLYCAM2 camera back to its original position in case it gets lost in the scene.
-
Once you have that camera assigned, axes motion should be moving the camera. If you have problems or need to customize, adjust the following files:
${USERDATA}/configs/flycam2_joystick_nodes.cfg : The nodes that are added to support the script. Here, we create the new camera node and add a node to hold the joystick deflections which feed the flycam plugin.
${USERDATA}/configs/flycam2_joystick.cfg : This file defaults the camera_data_overlay script to show the camera name in the lower left corner. It also sources the flycam2_joystick2.tcl script. Lastly, it has the main FLYCAM block at the bottom which is used to adjust all of the motion parameters for flycam, such as deadbands, coarse and vernier scales for both rotation and translation, which node to read for the axes deflections, and whether a particular axis should be reversed.
${USERDATA}/gui/flycam2_joystick.tcl : The top of this file can be customized to change:
- the camera list that gets cycled when a certain button is hit on the controller.
- the view name being used
- which node holds the axis deflections (must match the node specified in the FLYCAM block of flycam2_joystick.cfg)
- the actions for each button press and/or release
- the actions for each axis motion event
Associated Commits
| commit | dfd0e5d25fd7060c628a8fa10a92f4e933649357
link6 |
||
| Author: | Frank Graffagnino
|
| Date: | Tue Jan 8 16:41:13 2013 -0600
|
| Message: | [@Issue 00469: Added example for flying camera with flycam and joystick
Documentation on how to use is at: <Issues.00469> @] |
Affected Files:
configs/flycam2_joystick.cfg | 108 +++++++++++++++++++++++
configs/flycam2_joystick_nodes.cfg | 18 ++++
gui/flycam2_joystick.tcl | 171 +++++++++++++++++++++++++++++++++++++
3 files changed, 297 insertions(+)