Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to implement force feedback? #99

Open
David1r20 opened this issue May 3, 2022 · 15 comments
Open

Is it possible to implement force feedback? #99

David1r20 opened this issue May 3, 2022 · 15 comments

Comments

@David1r20
Copy link

Is there a possibility to get ffb?

@lemmingDev
Copy link
Owner

Hi

Was asked a couple of years ago

#12

Out of my area of expertise

If someone wants to take a crack at it and create a pull request, it would be greatly appreciated.

@Narsku
Copy link

Narsku commented May 22, 2022

Sorry for my poor english. with ffb do you mean a simple vibrator motor?, i found an app for android that test the gamepad and the vibration, can you catch this command and implement it to the library? or this is the complicated part?

@lemmingDev
Copy link
Owner

Sorry.
I have no idea how to get it working...

@LeeNX
Copy link

LeeNX commented May 23, 2022

Force feedback or haptic is possible, but not yet quite standard, at least not in my very basic research.

There are a few options:

  1. make your own interface for your project ie: BLE serial - https://www.hackster.io/chuartdo/ble-haptic-dual-joystick-controller-31c2c2
  2. emulate one of the other vendors haptic system XBox/PSX controller (not sure the legal status) -
  3. setup the correct HID and output fields with callbacks, like CapsLock LED - https://github.com/tloimu/adapt-ffb-joy/tree/wiki
  4. Possible part of 3 - Extend support for FFB in SDL2 - https://github.com/libsdl-org/SDL/tree/main/src/joystick/hidapi

3 and 4 are something in my spare time I am trying to understand and added, but it's slow going and just a little over my current skill level.

Hope this might help somebody else just start their progress.

@Narsku
Copy link

Narsku commented May 23, 2022

Ok!, I'm gonna try to work on it

@lemmingDev
Copy link
Owner

That would be great.
Let me know if you make any progress

@kotobuki
Copy link

Let me jump into this issue because I'm also interested in it.

@Narsku
#99 (comment)

i found an app for android that test the gamepad and the vibration, can you catch this command and implement it to the library? or this is the complicated part?

Which app did you try? I also want to try the app.

@lemmingDev
Copy link
Owner

Seems some of the info needed is here
https://www.usb.org/sites/default/files/pid1_01_0.pdf

@lemmingDev
Copy link
Owner

And here's an Arduino Leonado joystick library with force feedback
https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary

@LeeNX
Copy link

LeeNX commented Nov 19, 2022

I have been reading through the ArduinoJoystickWithFFBLibrary repo and came across YukMingLaw/ArduinoJoystickWithFFBLibrary#30 (comment) where extending the HID PID seems to get FFB working in Linux, so I was thinking of extending ESP32-BLE-Gamepad PID to include the changes for test - https://github.com/YukMingLaw/ArduinoJoystickWithFFBLibrary/blob/master/src/FFBDescriptor.h

but after about a 1/3 of the way through, worried about any typos or other problems, hoping there might be a quicker or even better way to do this, for just a test? @lemmingDev you have an idea? Need to take into account, Report IDs (not got to the point to test yet)- Was thinking about just making a Report IDs and offset from the init base.

My fork and branch in it's current state - https://github.com/LeeNX/ESP32-BLE-Gamepad/commits/leet-ffb-pid

Also thinking, if we going to use this code, we should possible ask or inform https://github.com/YukMingLaw that we doing this? Just good citizenship ... I will reach out, if nobody else beats me too it.

@MatthewReed303
Copy link

Hi @LeeNX

Have you had any luck getting the FFB to work? I was looking at using ESP32-S2 and convert the ArduinoJoystickWithFFBLibrary to work with the esp32, but if this works that's even better.

Thanks

@LeeNX
Copy link

LeeNX commented Dec 2, 2022

@MatthewReed303 still in progress, have not made much headway since my last post. Not much feedback either, so I am not sure if anybody else would find this useful. I am still keen and interested and will come back to this. Just need to find the time and motivation. Have some free time coming up in two weeks, so I think I will be able to get to at least testing PID with OSX and Linux (Raspberry Pi) with SDL 2/3.

Been hacking at a simple console testing program, to test some of my ideas. Was very interested in seeing very much different feature reporting back on Linux vs OSX. On Linux, if I set SDL hint that my BLE devices is PS4 controller, not much changes, but on OSX, when hinted as PS4 controller, the serial number from BLE is reported back differently. SDL feature (bug) that I was not expecting. I don't even remember why I did think of even trying this.

I hope there is more interest, which would be motivating for me.

@tapir
Copy link

tapir commented Dec 24, 2022

Does this library have a callback for messages received from the PC? I'm trying to do some latency measurements and my idea was to send FFB messages to the controller and respond back with a button press thus having the full round-trip latency.

@gagagu
Copy link

gagagu commented Jul 11, 2023

I'm using the [Fino](https://github.com/jmriego/Fino] library which based on the YukMingLaw to create an Arduino FFB Yoke for FlightSim.
I'm thinking about to make a new design of the yoke to make it smaller and may be use an ESP32 processor to bring my project to a next level (Bluetooth, faster, wifi).

Is there any progress of implementation of FFB?
You would make may people very happy for implement, especially the Flightsim and RacinSim Guys!

@lemmingDev
Copy link
Owner

Xinput fork of library here that does rumble
https://github.com/Mystfit/ESP32-BLE-CompositeHID

No progress on force feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants