Skip to content

Commit

Permalink
Merge pull request #5 from ami-iit/joypad
Browse files Browse the repository at this point in the history
Enable the remapping of joypad values if present
  • Loading branch information
S-Dafarra authored Apr 30, 2024
2 parents 52bff58 + af10579 commit 6a1d611
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 74 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ jobs:
strategy:
matrix:
build_type: [Release]
os: [ubuntu-latest, windows-2019]
os: [ubuntu-latest, windows-2019, macos-14, macos-12]
imgui: [mamba, vendored]
fail-fast: false

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
if: matrix.os != 'macos-14'
with:
miniforge-variant: Mambaforge
miniforge-version: latest

- uses: conda-incubator/setup-miniconda@v3
if: matrix.os == 'macos-14'
with:
installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh

- name: Dependencies
shell: bash -l {0}
run: |
Expand All @@ -50,8 +56,8 @@ jobs:
# See https://github.com/robotology/robotology-superbuild/pull/1606
mamba install expat freeglut libselinux-cos7-x86_64 xorg-libxau libxcb xorg-libxdamage xorg-libxext xorg-libxfixes xorg-libxxf86vm xorg-libxrandr mesa-libgl-cos7-x86_64 mesa-libgl-devel-cos7-x86_64
- name: Configure [Linux]
if: contains(matrix.os, 'ubuntu')
- name: Configure [Linux, macOS]
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
shell: bash -l {0}
run: |
mkdir -p build
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# yarp-device-keyboard-joypad
Repository containing the implementation of a yarp device to use a keyboard as a joypad.
Repository containing the implementation of a yarp device to emulate a joypad using the keyboard, the touchscreen and/or an actual joypad.

## Example usage
By running the following command,
```
yarpdev --device keyboardJoypad --name /keyboard --buttons "(none, test, c:prova, c:prova, v, b, test, c:prova, 8, g-h:Multi)" --axes "(ws, ad, ad, none, -left_right, up_down)"
```
a GUI will be opened with a similar layout:

https://github.com/ami-iit/yarp-device-keyboard-joypad/assets/18591940/7717159e-8eef-4a5b-9273-814fa55f5560



## Dependencies
- [``YARP``](https://github.com/robotology/yarp) (>= 3.4.0)
Expand Down Expand Up @@ -30,8 +41,13 @@ The device can be configured using the following parameters. They are all option
- ``axes``: definition of the list of axes. The allowed values are "ws", "ad", "up_down" and "left_right". It is possible to select the default sign for an axis prepending a "+" or a "-" to the axis name. For example, "+ws" will set the "ws" axis with the default sign, while "-ws" will set the "ws" axis with the inverted sign. It is also possible to repeat some axis, and use "none" or "" to have dummy axes with always zero value. The order matters. (default: ("ad", "ws", "left_right", "up_down"))
- ``wasd_label``: label for the "WASD" widget (default: "WASD")
- ``arrows_label``: label for the "Arrows" widget (default: "Arrows")
- ``buttons``: definition of the list of buttons. The allowed values are all the letters from A to Z, all the numbers from 0 to 9, "SPACE", "ENTER", "ESCAPE", "BACKSPACE", "DELETE", "LEFT", "RIGHT", "UP", "DOWN". It is possible to repeat some button. It is possible to specify an alias after a ":". For example "A:Some Text" will create a button with the label "Some Text" that can be activated by pressing "A". It is possible to use "none" or "" to indicate a dummy button always zero. It is possible to spcify multiple keys using the "-" delimiter. For example, "A-B:Some Text" creates a button named "Some Text" that can be activated pressing either A or B. It is possible to repeat buttons. The order matters. (default: ())

- ``buttons``: definition of the list of buttons. The allowed values are all the letters from A to Z, all the numbers from 0 to 9, "SPACE", "ENTER", "ESCAPE", "BACKSPACE", "DELETE", "LEFT", "RIGHT", "UP", "DOWN". With "J" followed by a number it is possible to map a joypad button, when connected. It is possible to repeat some button. It is possible to specify an alias after a ":". For example "A:Some Text" will create a button with the label "Some Text" that can be activated by pressing "A". It is possible to use "none" or "" to indicate a dummy button always zero. It is possible to specify multiple keys using the "-" delimiter. For example, "A-B-J5:Some Text" creates a button named "Some Text" that can be activated pressing either A, or B, or the joypad button with index 5. It is possible to repeat buttons. The order matters. (default: ())
- ``joypad_indices``: definition of the joypads to consider in case multiple joypads are connected. The value can be a single integer or a list of integers. The indices are 0-based. In case a joypad is not found, it is ignored. The axis and buttons values are stack together in the order provided. (default: 0)
- ``joypad_deadzone``: deadzone for the joypad axes (default: 0.1)
- ``ad_joypad_axis_index``: index of the axis for the "ad" axis in the joypad (default: 0)
- ``ws_joypad_axis_index``: index of the axis for the "ws" axis in the joypad (default: 1)
- ``left_right_joypad_axis_index``: index of the axis for the "left_right" axis in the joypad (default: 2)
- ``up_down_joypad_axis_index``: index of the axis for the "up_down" axis in the joypad (default: 3)

## Maintainers
* Stefano Dafarra ([@S-Dafarra](https://github.com/S-Dafarra))
Loading

0 comments on commit 6a1d611

Please sign in to comment.