Joystick as tracking device?

Home Forums AR Sandbox Forum Joystick as tracking device?

This topic contains 6 replies, has 3 voices, and was last updated by  bottobot 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #115639

    tuchwando
    Participant

    Hi All,

    Is it possible to use a joystick (eg. the ones that come with the controller indicated in USB Button Solution thread) as a tracking device instead of the mouse? How does one set this up through the Vrui config file?

    Similar question – what is the correct configuration to get a bluetooth controller (eg. this one: Kycola Xbox 360 controller with wireless receiver)? Following the instruction for the USB button solution doesn’t work – Vrui doesn’t find this controller.

    Any help would be much appreciated!

    Patrick

    #115647

    Oliver Kreylos
    Keymaster

    Re: controller That doesn’t seem to be a Bluetooth controller, but a regular wireless one with a custom dongle. Those show up as USB devices. Setting those up usually involves a bit of detective work. You need to check that the controller is recognized at the USB level. Plug it in and check the output of lsusb for something that looks like the controller, then note down its vendor and product IDs.

    Second, you need to open access to the device for non-admin users. This is done via scripts in /etc/udev/rules.d . There should already be a 69-Vrui-devices.rules in there, open it in a text editor (via sudo). Then insert a line like this:

    ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c625", TAG+="uaccess"

    but replace the vendor and product IDs with your device’s. Then unplug the wireless dongle and plug it back in.

    Then create a patch configuration file like “Controller.cfg” with contents similar to the following:

    section Vrui
    	
    	section Desktop
    		inputDeviceAdapterNames += (HIDAdapter)
    		
    		section HIDAdapter
    			inputDeviceAdapterType HID
    			inputDeviceNames (SteelSeriesStratusXL)
    			
    			section SteelSeriesStratusXL
    				name SteelSeriesStratusXL
    				deviceVendorProductId 0111:1419
    				trackingDeviceName Mouse
    				trackingDeviceType Ray
    				axis0Settings (-2047, 0, 0,  2047)
    				axis1Settings ( 2047, 0, 0, -2047)
    				axis2Settings (-2047, 0, 0,  2047)
    				axis3Settings ( 2047, 0, 0, -2047)
    				axis4Settings (-4095, 0, 0,  4095)
    				axis5Settings (-4095, 0, 0,  4095)
    				buttonNames (Back, Home, A, B, X, Y, L1, R1, Forward, LStick, RStick)
    				valuatorNames (LStickX, LStickY, RStickX, RStickY, R2, L2, DPadX, DPadY)
    			endsection
    		endsection
    	endsection
    	
    endsection

    adapting settings to your controller. You can store the configuration file in /usr/local/etc/Vrui-4.5. Then load it via the command line:

    ./bin/SARndbox ... -mergeConfig Controller

    and you should be able to bind tools to the controller’s buttons.

    #115650

    tuchwando
    Participant

    Thanks Oliver for the prompt reply! Will give it a try when I get a chance.

    I’d like to make “local tools” like the local water tool available via an arcade style joystick (attached to the USB encoder described in your Button solution post) or a wireless controller. These tools use the tracking device position (currently the mouse) – is it possible in Vrui to assign a 2-axis joystick like those present on a gamepad/controller to control the mouse pointer? In principle I could keep track of the position and manage movement manually by reading from valuators/buttons, but I wanted to see if you’ve already got a solution for this kind of thing.

    #115654

    Oliver Kreylos
    Keymaster

    Yes, there is a built-in way. You should have a SpaceTraveler.cfg configuration file in /usr/local/etc/Vrui-4.5. It maps several levels of functionality to a six-axis spaceball device. The relevant bit is the SixAxisTransformTool definition. This tool class creates a virtual input device (a cursor) that can be moved by pushing three analog axes. You can bind that tool to three axes on your controller (you’d only be using two of those in the end), and a set of buttons to trigger actions at the cursor’s current position.

    #115681

    tuchwando
    Participant

    Hi Oliver,

    I ended up getting a SteelSeriesStratusXL, and it works using the config file you provided. I was also able to get the SixAxisTransformTool working, including setting bindings in the SARndbox config file so that they’re available when the program is run. I can move the little cone around, and add water locally at its position. Success! I found that I needed to change “ForwardedDevice0, Valuator0,…” from the SpaceTraveler example to be the name of the device itself. Could you confirm whether I have used this tool correctly in the my SARndbox config file below?

    
    section Vrui
        section Desktop
    
    	inputDeviceAdapterNames += (HIDAdapter)
    		
    	section HIDAdapter
    	        inputDeviceAdapterType HID
    		inputDeviceNames (SteelSeriesStratusXL)
    			
    		section SteelSeriesStratusXL
    			name SteelSeriesStratusXL
    			deviceVendorProductId 0111:1419
    			trackingDeviceName Mouse
    			trackingDeviceType Ray
    			axis0Settings (-2047, 0, 0,  2047)
    			axis1Settings ( 2047, 0, 0, -2047)
    			axis2Settings (-2047, 0, 0,  2047)
    			axis3Settings ( 2047, 0, 0, -2047)
    			axis4Settings (-4095, 0, 0,  4095)
    			axis5Settings (-4095, 0, 0,  4095)
    			buttonNames (Back, Home, A, B, X, Y, L1, R1, Forward, LStick, RStick)
    			valuatorNames (LStickX, LStickY, RStickX, RStickY, R2, L2, DPadX, DPadY)
    		endsection
    	endsection 
    
            section Tools
    
                section DefaultTools
    
    		section SteelSeriesStratusXLtool
                            toolClass SixAxisTransformTool
    			bindings ((SteelSeriesStratusXL,Home,A,B,X,Y), \
    			          (SteelSeriesStratusXL, LStickX, L2, LStickY, RStickX, RStickY, R2))
    		endsection
    
                    section LocalWaterTool
                        toolClass LocalWaterTool
                        bindings ((SteelSeriesStratusXL, A,B))
                    endsection
    
    		endsection
    	   endsection
         endsection
    endsection
    

    As for the other controller, I keep getting the exception “InputDeviceAdapterHID::InputDeviceAdapterHID: No match for vendorId:productId” – I can see the vendor/id using lsusb (045e:0291), and I also see it appear in /dev/input/by-id with both event-joystick and joystick entries. Any other trick I might try?

    Thanks again for your help – and thanks for this wonderful Sandbox project!

    Patrick

    #115690

    bottobot
    Participant

    I’m bumping this post for visibility.

    Hey Oliver basically we can’t map new usb devices like Xbox controllers because Vrui doesn’t identify them. It’s so frustrating! Just keep getting the error ““InputDeviceAdapterHID::InputDeviceAdapterHID: No match for vendorId:productId” even after adding it to the rules and trying to merge the cfg file. It’s like the program just won’t see it. Mint sees it, I can play games on my Steam account with it, but Vrui won’t recognize it.

    Any help would be greatly apreciated.

    The Steel Series gamepad works if we copy everything you’ve done exactly but it’s really buggy when trying to use it wireless.

    • This reply was modified 5 months ago by  bottobot.
    #115698

    bottobot
    Participant

    Solved this problem by finding the correct VendorProductId. Originally used lsusb, but it was only listing the USB wireless dongle.

    so using evtest and looking at the top of the readout it gives, we found

    Input device ID: bus 0x3 vendor 0x45e product 0x2a1 version 0x107

    aha! change it to: 045e:02a1

    just one character off!

    Now its mapable.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Comments are closed.