This program converts game controller data into OSC.
Dependencies are part of the repository as gitsubmodules:
Clone this repository (including the submodules) using git clone --recurse-submodules https://github.com/Puara/puara-controller.git
To compile puara-controller, navigate to the cloned folder and execute:
mkdir build && cd build
cmake ..
make
This will create a puara-controller
executable in the build folder.
To execute, navigate to the build
folder and execute ./puara_controller
Options:
- -h, --help Show help message
- -c, --config Provide a JSON config file
Alternatively, you can run make install
to install Puara Controller system-wide.
The standard UDP port to send OSC messages is 9001. Puara Controller also receives messages through port 9000. Both ports, along with other options, can be changed through the JSON config file.
- Values can be either 0 or 1, except for triggerleft and triggerright that output integer values between 0 and 32768
- Timestamps are integer values in milliseconds
- X and Y are integer values between -32768 and 32768
- X, Y, and Z are float values between -40 and 40
namespace | values |
---|---|
/puaracontroller/rumble | iiff (controllerID, time, low_freq, hi_freq) |
The JSON config file can also set custom OSC addresses. This is useful when a specific message needs to send data to another application that doesn't have flexibility in defining namespaces and message ranges.
The config.json file is set up to send all available game controller data. At this moment it is mandatory to load the file to run the program (using the -c
option).
OBS: The range parameter only modifies values and axes (X, Y, and Z). It does not range timestamps or event durations.
You can also add strings and hardcoded OSC arguments. Some examples are available in the config.json file.
Note that you may need to add udev rules to allow accessing motion and force feedback on the controllers. You can add these rules manually in your /usr/lib/udev/rules.d/
folder.
One example of such rules for the DualShock3 controller:
# DualShock 4 over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="05c4", MODE="0660", TAG+="uaccess"
# DualShock 4 wireless adapter over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ba0", MODE="0660", TAG+="uaccess"
# DualShock 4 Slim over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="09cc", MODE="0660", TAG+="uaccess"
# DualShock 4 over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:05C4*", MODE="0660", TAG+="uaccess"
# DualShock 4 Slim over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:09CC*", MODE="0660", TAG+="uaccess"