Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Talk about anything concerning the source code.
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

Hi all,

I am new to this, but keen to learn and currently working my way through the source, and was wondering if I could get a little bit of guidance from anyone more familiar with the code base.

I'd like to start playing around with a way to optionally dampen the forces as they approach the centre point, to see if it can reduce overcorrection oscillations with a DD wheel, and so far it seems that https://github.com/matlo/GIMX/blob/58d2 ... eaks.c#L22 would be a suitable place to do it. The bit I'm unsure of at present is how to get the position of the axis from within that function.

Am I looking in the right place?

Cheers,
Scott
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

Digging a bit more... and using this thread to make some notes

Think I can copy the way the joystick_corrections_list defines the axis e.g. <event type="axis" id="2"/>, then pick that up with ProcessEventElement and pass it through to cfg_set_ffb_tweaks as entry.event.id
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

Ok, making some good progress with this. I ended up making two changes to check the approach works:

First I exposed the address of the axis variable:

Code: Select all

void cfg_set_ffb_tweaks(const s_config_entry * entry)
{
  // determine the axis for the tweaks
  s_mapper* mapper = joystick_axes[entry->device.id][entry->controller_id][entry->profile_id].mappers;
  int axis = mapper->axis_props.axis;
  int *axis_address = &adapter_get(entry->controller_id)->axis[axis];
  ginfo("setting ffb_tweaks for controller_id: %d, device_id: %d, profile_id: %d, axis: %d, axis_address: %p\n",
    entry->controller_id, entry->device.id, entry->profile_id, axis, axis_address);
  ffb_tweaks[entry->controller_id][entry->profile_id].axis_address = axis_address;
This then allows access to it during the haptic_tweak_apply:

Code: Select all

case E_DATA_TYPE_CONSTANT:
    // get the axis value
    if(tweaks->axis_address) {
        int axis_value = *(tweaks->axis_address);
        int constant_level = data->constant.level;
       
        // calculate the gain
        if(abs(axis_value) < 300) {
            int gain = abs(axis_value) / 3;
            APPLY_GAIN(data->constant.level, gain, -SHRT_MAX, SHRT_MAX);
        }
        ginfo("haptic_tweak_apply: axis address: %p, axis value: %d, constant_level: %d, tweaked_constant_level\n", (void *)tweaks->axis_address, axis_value, constant_level, data->constant.level);
It's a proper hack-job at the moment, but it's totally removed the oscillations I was getting with my Simagic Alpha mini. I'll have a stab at making it configurable so the gain and axis range can be set.

If there is any other interest in this, I'll raise a PR for it in github.
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

After a bit more testing, I have found there are still some instances where it can start to oscillate, but it's usually after an aggressive move and then releasing the wheel. Still a significant improvement in usability

I added a bit of code to read the values from the config profile too https://github.com/GeekyDeaks/GIMX/tree/g29-correction
User avatar
GoDlike
Posts: 1318
Joined: Thu Apr 28, 2016 12:47 pm
Location: Poland

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GoDlike »

Thanks for your contribution. I wish I could help you but I don't even own a wheel.
My hardware: PS3 Slim CFW 4.80 | PS4 Pro 500 Million LE | PS5 | Xbox Series X
Steam: Godlike_RU | PSN: GoDlike_RU | XBL: GoDlike
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

Hey, no worries. You guys have been helping people hook up dodgy bits of gear to their console for ages! I'm more looking for guidance anyway, e.g. take a look at how X was done here... as learning new stuff is all part of the fun :D

After quite a bit of testing, I can see some flaws in my approach, mostly due to what I think is trying to apply the profile for a slowly responding wheel (G29) to a quickly responding wheel (DD). This hack does me for now and means I'll be able to enjoy GT7 without breaking my thumbs. Longer term I am going to see if I play GT7 enough to warrant putting in the time to work on a new device profile as I think one of my friends might get a Sony approved DD that we could use to capture the USB traffic.

With that in mind, I'll probably not raise a PR as I think the amount of people that might want to try this out is likely to be low anyway and I also don't think you really want my dodgy code polluting your code base!
isamu
Posts: 86
Joined: Tue Dec 10, 2013 11:19 pm

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by isamu »

Hi GeekyDeaks. Just wanted to let you know I for one, am reading this thread and your progress with excitement and anticipation. I too, own a DD wheel...a Leo Bodnar Sim Steering 26NM version, and yes you are correct, there is too much oscillation happening around the center. I think it may be due to the way Polyphony coded their FFB in conjunction with what they thought would make for a good driving experience with the Logitech G29 wheel, and decided to make the forces a bit strong towards the center to compensate for the G29's lack of strong torque response(I mean, it *IS* an old gear driven type wheel afterall).

I strongly encourage you to keep digging into the code and continue seeing what you can do you eliminate this problem for us DD wheel users. I'm confident there are more of us out there than you may think :) You have our full support brother...keep at it! 8-)
GeekyDeaks
Posts: 46
Joined: Wed Feb 16, 2022 9:44 am

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by GeekyDeaks »

isamu wrote: Sat Mar 05, 2022 8:06 am I strongly encourage you to keep digging into the code and continue seeing what you can do you eliminate this problem for us DD wheel users.
Hiya! Not sure if you spotted the other thread where we have been discussing this? https://gimx.fr/forum/viewtopic.php?p=21145#p21145

The version linked to on the above post seems to be working fairly well for some people so far
isamu
Posts: 86
Joined: Tue Dec 10, 2013 11:19 pm

Re: Direct Drive friendly haptics using G29 profile (aka how to match haptic sink to axis)

Post by isamu »

Awesome. Thanks for letting me know :)
Post Reply