USB buttons: rotate secondary view

Home Forums AR Sandbox Forum USB buttons: rotate secondary view

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #117818
    tomchadwin
    Participant

    Hello all

    We’ve got the USB controller set up with buttons to flood/drain, etc. Our button kit came with a joystick which operates the same microswitches as the buttons. We’d like to assign joystick-left and -right to rotate our secondary view (ie what mouse click and drag left/right does by default). I can’t figure out how to achieve this, though, as all rotate actions seem to require analogue input of some kind.

    Can anyone help?

    Thanks

    Tom

    #117902
    Oliver Kreylos
    Keymaster

    That can be done, but it’s a bit complex. There is a tool class in Vrui that converts a pair of buttons into an analog axis (“Transformer” => “Button -> Valuator” in the tool menu, or “ButtonToValuatorTool” in configuration files. So you can create two analog axes out of the joystick’s four buttons.

    The navigation tool class you want to use is SixAxisNavigationTool which requires seven analog axes (translation along three axes, rotation around three axes, uniform scaling).

    You still need to create five analog axes out of thin air, and the best way is to use a set of radio buttons to replicate your two joystick axes into 8 total axes, two of which will be active at any given time. This is done by class MultiShiftButtonTool. In short:

    Step 1: Create two analog axes out of two joystick buttons each.

    Step 2: Create a multi-shift tool with four planes, using four arbitrary buttons as switch buttons and the two created analog axes as replicated features.

    Step 3: Create a six-axis navigation tool and bind it to 7 of the 8 created analog axes.

    Step 4 (optional): Put a cap (NopTool) on the eighth axis to avoid annoying tool menu pop-ups.

    Here’s a template tool binding section:

    section DefaultTools
      section JoystickXAxis
        toolClass ButtonToValuatorTool
        bindings ((Device, PositiveXButton, NegativeXButton)) # Change device and button names as needed
      endsection
    
      section JoystickYAxis
        toolClass ButtonToValuatorTool
        bindings ((Device, PositiveYButton, NegativeYButton)) # Change device and button names as needed
      endsection
    
      section AxisReplicator
        toolClass MultiShiftButtonTool
        bindings ((Device, Plane1Button, Plane2Button, Plane3Button, Plane4Button), \ # Change these names as needed
                  (JoystickXAxis, Valuator0), (JoystickYAxis, Valuator0))
        numPlanes 4
        resetFeatures true
      endsection
    
      section JoystickNavigation
        toolClass SixAxisNavigationTool
        bindings ((AxisReplicator, Valuator0, Valuator1, Valuator2, Valuator3, Valuator4, Valuator5, Valuator6))
      endsection
    
      section JoystickCap
        toolClass NopTool
        bindings ((AxisReplicator, Valuator7))
      endsection
    endsection
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed.