Unable to receive values from the controller.
Hi, Thanks for the great code. I tested it out with given test scripts and both of them run fine. The Steering wheel moves properly. I am trying now to get values from the steering wheel. Specifically of the steering rotation. I would like to know the force being applied by the user (or the angle of the steering wheel). I have tried the state engine but no luck so far. Can't seem to get the states of the buttons as well. Would really appreciate if you could point me in the right direction. Thanks
Here is the code i have tried.
import sys
sys.path.append('../logidrivepy')
from logidrivepy import LogitechController
import time
controller = LogitechController()
controller.steering_initialize()
while True:
state_pointer = controller.LogiGetStateENGINES(0)
state = state_pointer.contents
# Retrieve force feedback values
force_x = state.lFX
force_y = state.lFY
force_z = state.lFZ
# Print or use the force feedback values
print(f"Force X: {force_x}")
print(f"Force Y: {force_y}")
print(f"Force Z: {force_z}")
controller.steering_shutdown()
Hi @MurtazaHassan01 @cengizozel , I'm using Logitech G923 (with Windows OS). Any idea if this package works with windows? Coz I've installed the package & when trying to run the scripts, My steering is not getting detected & when i run spin_wheel_test.py - it's just saying "passed" but steering isn't getting rotated.
Am I missing out anything, If yes please correct me
Hello @MurtazaHassan01
Unfortunately, I'm in a different country without my steering wheel and not able to do some tests or implement such functionality. My inspiration to make this repo came from my desire to control my steering wheel.
However, I was successfully able to get rotation values in the past using Pygame, which is a very popular Python module. I would suggest you to give that a try.
Hope that helps!
Hi @saicsk-deloitte
Yes, this package should work with Windows, and I'm currently gathering feedback to ensure its full functionality and to identify any additional dependencies that may be required.
- Is your Windows 32-bit or 64-bit?
- Do you have the Logitech's G Hub application installed? https://www.logitechg.com/en-us/innovation/g-hub.html
Hi @cengizozel ,Thanks for the reply.
- I have Windows with 64-bit & Logitech is G923
- Yeah, I have Ghub installed & that application is detecting my steering wheel perfectly. But when i run "run_controller_test.py" it's saying "Did not pass all test". -But when I run "spin_wheel_test.py" it's saying "Spin test passed" And in either of above cases, Nothing change in steering wheel.
Note: I've just used "pip install logidrivepy" , so are we supposed to do any other setup or anything with Ghub in background?
@saicsk-deloitte
No additional setup should be required after the package and G Hub. It might be worth mentioning that this package was tested on Python 3. Beyond this, I'm not entirely sure what might be causing the issue with your Logitech G923 not being detected correctly by the scripts.
If you discover any interesting insights or solutions, please feel free to share. Your experience might be valuable for others facing similar issues.
Just found a fix, seems like it was detecting a different USB Game Controller, in my case, a guitar hero controller which had a higher priority than my wheel, make sure that the only USB Game Controller connected is the steering wheel.
@MurtazaHassan01 maybe you have forgotten the logi_update method?
Logitech wheel SDK will initialize at whatever window you have focused, so if you switch focus to for example Pygame window it can no longer read input values. This might be the problem here. I've made a pull request with a function allowing to manually specify window handle. It would be nice if maintainer accepted it. sry for my english
Im working with a Microsoft Sidewinder Force Feedback. It does not want to connect. When I run "run_controller_test.py" it fails all the tests. However, a different laptop with different user does create a connection and is able to run different FFB commands to the joystick (the first few hours it did not work, but suddenly, it did. I would love to know what i might have accidentally changed).
I have multiple working demo's, for example the demo included in the Logitech SDK works fine. Pygame works fine for reading the joystick but I can't seem to connect to the joystick using this library.
Is there anything worth looking at?
UPDATE:
When I disabled and enabled the device in device manager my problems disappeared. It works fine now.
@TCoolwine Hey, I'm running into the same issue trying to read the data from the wheel. Could you elaborate more on what devices you disabled and help me through the process? I'm trying to disable "Logitech G Hub PRO Racing Wheel ....." and re-enable it and I still can't seem to read any axis data such as steer and pedals.