Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

OpenGrip-FFB

Game force-feedback → ODrive direct-drive motor, with a PySide6 GUI. Cross-platform: Windows (vJoy) and Linux (uinput/evdev), one codebase.

OpenGrip-FFB bridges a game's force-feedback (FFB) to an ODrive-powered direct-drive wheel. It reads FFB effects the game sends, mixes them into a torque command, drives the motor, and reports the wheel's true position back to the game.

Demo

https://github.com/LucasCoraca/OpenGrip-FFB/raw/main/docs/demo.mp4

Video not playing? Download/view it here.

How it works

game ──FFB──▶  VJoyFfbMonitor ──torque──▶ ODriveController ──▶ motor
   ▲                (capture+mix)              (control loop)
   └──────────── wheel position ◀── encoder ──────┘

The platform-specific parts are isolated in ffb_platform.py, which picks the backend at runtime:

Concern Windows Linux
FFB capture (VJoyFfbMonitor) vJoy callback (vjoy_ffb_monitor.py) uinput EV_FF (uinput_device.py)
Axis output vJoyInterface.dll uinput ABS_X (same virtual device)
Console hotkeys msvcrt termios

Everything else — the ODrive controller, the CLI, and the PySide6 GUI — is shared and platform-independent.

Layout

File Role
ffb_platform.py OS detection + backend factories (monitor, axis-out, hotkeys)
ffb_odrive_controller.py Async ODrive control loop + position output
ffb_sniffer.py Headless CLI entry point
ffb_gui.py PySide6 desktop app
vjoy_ffb_monitor.py Windows FFB capture (vJoy)
uinput_device.py Linux FFB capture + virtual joystick (uinput)
install-udev.sh, 60-opengrip.rules Linux device-permission setup

Install

pip install -r requirements.txt
  • Windows: install the vJoy driver (create device ID 1). vJoyInterface.dll is bundled. ODrive over USB.
  • Linux: grant device access once — sudo bash install-udev.sh (gives access to /dev/uinput and /dev/input/event*). ODrive over USB.

Run

python3 ffb_gui.py        # GUI (both platforms)
python3 ffb_sniffer.py --lock-to-lock-deg 900 --ffb-max-nm 3.0   # headless

CLI hotkeys (in the console): C recenter, Z clear center, I invert torque polarity. Tune per-effect strength with --strength Constant=0.8 Spring=1.2 All=1.0 and flip direction with --invert Constant Spring (same effect names on both platforms).

Force feedback (Linux details)

uinput_device.py creates a virtual device advertising EV_FF. When a game uploads effects, the kernel forwards the upload/erase/play handshake to a background reader thread, which turns them into torque via get_current_torque(pos_turns) (constant, ramp, periodic, spring, damper, friction, inertia, rumble, gain, autocenter).

Two hard-won Linux gotchas, baked into the code:

  1. The game and this engine must be separate processes — the kernel won't service a uinput FF request in-process (it times out). Real games always are.
  2. python-evdev 1.9.1's UInput.begin_upload() is buggy, so we issue the UI_BEGIN/END_FF_UPLOAD/ERASE ioctls directly with fcntl.

Status

  • ✅ Windows path (vJoy + ODrive + GUI) — original, working.
  • ✅ Linux path (uinput/evdev FFB + ODrive + GUI) — verified end-to-end through the real kernel and validated on real hardware.
  • ✅ Single codebase with runtime OS detection.

If a game's force polarity feels reversed on your setup, use the I hotkey or --invert to flip it.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages