SDL2/Win32: ForceFeedback SDL_POLAR not working on Steering Wheel

Hi,
I’ve been working on the bleeding edge of force feedback and have found
something perculiar on Windows SDL2.

Using PySDL2 and a ‘testhaptic.py’ script (*) I have noticed that the
effects don’t work if they are specified with a POLAR direction and
’output’ on a 1-axis gaming steering wheel (ie. Logitech Driving Force
Pro).

They DO work if they are spec’ed as CARTESIAN, OR the output device is
2-axis joystick (ie. Logitech Wingman force 3D).

I am relative sure that the problem is not with PySDL2 or the script as
both of these work OK on Linux. I am using the pre-built library (from
http://libsdl.org), unfortunately I am unable to setup a build enviroment
for Win32.

On Linux if a POLAR force is not aligned with the wheel’s axis (ie 90’)
then it is proportionally reduced in strength. On Windows I am seeing NO
force, whatever the POLAR direction is set to.

Is anybody able to confirm this behaviour, or suggest any other testing I
can do on Windows (without having to compile anything).

Cheers,
Simon

Using PySDL2 and a ‘testhaptic.py’ script (*) I have noticed that the
effects don’t work if they are specified with a POLAR direction and
’output’ on a 1-axis gaming steering wheel (ie. Logitech Driving Force
Pro).

I managed to dig a little deeper on this, with the attached
’polar_test.py’ script I saw that the root of the problem is that
’HapticNewEffect’ is returning an error with POLAR on Windows (but not on
Linux).–
c:\cygwin\home\swood\contrust_test>"c:\Program Files\Python27\python.exe"
polar_
test.py
Trying to find haptic device
Found 0 : Logitech Driving Force Pro USB
Number of Axes 1
loading effect 0 POLAR direction 0
HapticNewEffect -1 Haptic error Unable to create effect

So the problem is with the effect as it’s passed to DirectX:
http://hg.libsdl.org/SDL/file/9159d5c47819/src/haptic/windows/SDL_syshaptic.c#l1466

Line 1466: “Unable to create effect”

The next question is whether this is because DirectX does not allow POLAR
on 1 axis, or if the call to ‘SDL_SYS_ToDIEFFECT’ (a few lines above) is
creating a corrupted effect…

http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.idirectinputdevice8.idirectinputdevice8.createeffect(v=vs.85).aspx

Any one got suggestions on how to proceed?
Cheers,
Simon.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: polar_test.py
Type: text/x-python
Size: 4141 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140602/e3fcc940/attachment-0001.py
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: polar_test.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140602/e3fcc940/attachment-0001.txt

Using PySDL2 and a ‘testhaptic.py’ script (*) I have noticed that the
effects don’t work if they are specified with a POLAR direction and
’output’ on a 1-axis gaming steering wheel (ie. Logitech Driving Force
Pro).

So the problem is with the effect as it’s passed to DirectX:
http://hg.libsdl.org/SDL/file/9159d5c47819/src/haptic/windows/SDL_syshaptic.c#l1466

The next question is whether this is because DirectX does not allow POLAR
on 1 axis, or if the call to ‘SDL_SYS_ToDIEFFECT’ (a few lines above) is
creating a corrupted effect…

After reading around on this I have come to the conclusion that 1-Axis
devices can not accept POLAR effects under DirectX.

No ‘firm’ statement/definitions but a couple of inferences:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee417536(v=vs.85).aspx--
Single-Axis Effects

Setting up the direction for a single-axis effect is easy because there is
nothing to specify. Put the DIEFF_CARTESIAN flag in the dwFlags member of
the DIEFFECT structure and set rglDirection to point to a single LONG
containing the value 0.

And ‘Fedit’ (the .ffe file editor) will automatically convert a 1-axis
polar effect to cartesian before playing it back.

I can work around this ‘feature’ in my code, the only real problem is that
it would probably mean that the directional properties of a 2D effect
could get ‘lost’ when played back on a 1-axis device.

Simon.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: polar_1axis.ffe
Type: application/octet-stream
Size: 228 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140603/f4da7da9/attachment.obj

Hmm, so would it be best to fix this in the SDL/Win32 haptic
translation layer, i.e. convert the polar to a 1-axis cartesian
effect?

EliasOn Tue, Jun 3, 2014 at 8:00 PM, wrote:

Using PySDL2 and a ‘testhaptic.py’ script (*) I have noticed that the
effects don’t work if they are specified with a POLAR direction and
’output’ on a 1-axis gaming steering wheel (ie. Logitech Driving Force
Pro).

So the problem is with the effect as it’s passed to DirectX:
http://hg.libsdl.org/SDL/file/9159d5c47819/src/haptic/windows/SDL_syshaptic.c#l1466

The next question is whether this is because DirectX does not allow POLAR
on 1 axis, or if the call to ‘SDL_SYS_ToDIEFFECT’ (a few lines above) is
creating a corrupted effect…

After reading around on this I have come to the conclusion that 1-Axis
devices can not accept POLAR effects under DirectX.

No ‘firm’ statement/definitions but a couple of inferences:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee417536(v=vs.85).aspx

Single-Axis Effects

Setting up the direction for a single-axis effect is easy because there is
nothing to specify. Put the DIEFF_CARTESIAN flag in the dwFlags member of
the DIEFFECT structure and set rglDirection to point to a single LONG
containing the value 0.

And ‘Fedit’ (the .ffe file editor) will automatically convert a 1-axis
polar effect to cartesian before playing it back.

I can work around this ‘feature’ in my code, the only real problem is that
it would probably mean that the directional properties of a 2D effect
could get ‘lost’ when played back on a 1-axis device.

Simon.