• Welcome to PiBoSo Official Forum. Please login or sign up.
October 01, 2020, 03:29:47 AM


GP Bikes beta18c available! :)

Gamepad with Real FFB

Started by maggikk22, February 26, 2020, 09:53:55 AM

Previous topic - Next topic


This is V2: more compact and more ergonomic. I still use Lego gears, racks and axles.



Can you give me your thoughts about the following?

If I can extract the FFB output  instead of the steering angle, and I send it to the servo, I may be able to use Direct Steering (DSA/DS2) with the gamepad.

Of course, I will have to replace the springs by stronger ones.
(I will also have to find a solution for rider tracking, as automatic rider lean will be disabled with direct steer, but that's another story...)

I tried to look for the FFB in the UDP message, I found the steering torque.
I'm no sure this is the real FFB output.
Even if it is, the value is very unstable in every
riding situation (when going straight, turning, braking,...).
I did not find anything else.

My questions are:
1. Is the FFB really sent via UDP like other data?
2. Why is the "steer torque" value so weird?

Hopefully I don't force a new debate about realistic controllers and comparison with real life...


I don't have the answer to any of that, but I use direct steering with my FFB (USB, "normal" FFB) rig and that signal could explain the extreme chattering I get when going straight, braking and turning. Strangely enough, sometimes the chatter goes away when leaned over at a specific angle...
I had to try..


Out of curiousity I constructed a rather simplified steer potentiometer/feedback servo rig and found exactly the same issues. Quite a nice feedback effect but the steer torque glitches to very high magnitudes and ruins the overall feedback effect. The magnitude seem unbelievable high if it really is in Nm as you would expect it to wrench the bars from the riders hands and its odd that it does not manifest as pulses in magnitude on the steer angle parameter.
Looked through the list of parameters available and I cannot see anything else that would be particularly useful so I suspect that force feedback is just formulated from the steering angle + some function of steer torque.
I have not tried any filtering of the signal but I guess it might be worth plotting the data available from the UDP tacho app to see if we have a good enough sample rate for a filter to work on.
Inspired work you are doing with getting something that can actually be applied to a standard controller.


Does this happen also with "normal steering"?
I had to try..


yes, I found that the steertorque value is unstable in both cases: standard gamepad with normal steering mode, or racing wheel with FFB and Direct steer mode.


March 11, 2020, 10:29:08 AM #21 Last Edit: March 11, 2020, 10:42:55 AM by Chris_Beeves
Quote from: maggikk22 on March 11, 2020, 10:01:02 AMyes, I found that the steertorque value is unstable in both cases: standard gamepad with normal steering mode, or racing wheel with FFB and Direct steer mode.

Yes, but what I meant is;
Does it affect the ffb when using normal steering in the same way it does the direct steering ffb, or are the two different equations?

Could the new P/D-settings for direct steer in the bike config help remedy the problem in that case?
I had to try..


hard to say...
I would say they are different equations, because FFB output is very different if you choose direct steer or normal mode.
But in both cases, the steertorque value is oscillating a lot.
Not sure I answer the question...

Trying to tune the P and D seems to be a good idea...


Are you guys using Direct Steer Angle or Torque?


I use angle, torque doesn't make much sense on my ffb controller.

Played around with the P/D settings today, but I can't get it to make much difference at all.
I had to try..


I (try to) use angle too.
so, apparently the "steer torque" output value cannot be modulated with the P/D settings...


I don't know what values to use though..
The standards are:
P= -250
D= -40 ( I think)

Tried different values from 0 to 1000 at FFB at 90%, but nothing stopped the insanity. Next step would be to try the same at 60-70% FFB.
At under 40%, FFB is not as noisy.
I had to try..


hmmm... if the steer torque value is less noisy when you decrease the FFB strength, I wonder if there's a way to reduce that noise when FFB is not active at all.
As I use a gamepad, I will not be able to enable FFB. Instead, I wanted to use the UDP data to generate the FFB.

At least, if the steer torque value is actually impacted by the FFB strength, then we are sure that we extracted the right info from the UDP message...


March 12, 2020, 02:23:36 PM #28 Last Edit: March 12, 2020, 06:05:01 PM by h106frp
As the magnitudes and periods are so extreme I wonder if we have 'raw' non-damped torque values.
Applying a damping function to simulate the steer system i.e. f(x)=X sin(torque) might give a more useful output. For this linear example the torque would be 'squished' between y=-X an y=+X. a sort of S curve crossing at zero.

So I tried it with my test set-up and the result is pretty good (madness constrained), this was the arduino code so far;

        if (m_iCrashed != 1 ){
          m_fSteerTorque = m_fSteerTorque / 2; // roughly in the range 0 to 100Nm as observed from data
          float SteerTorque = constrain (m_fSteerTorque, -90.0 ,90.0); //limit to equivalent of +-90 degrees
          float dampedtorque = 20 * (sin((3.14/180) * SteerTorque)); // damping equivalent to 20 degrees
          servopos = 90 + int (m_fSteer  + dampedtorque); //centre servo at 90 and add steer and torque
          servopos = constrain (servopos, 45 ,135); //constrain servo max angle
          myservo.write(servopos); //position servo
          Serial2.write(188); //update debug LCD
          Serial2.print("servo : ");
        else {
          servopos = 90; // centre servo

Need to play with damping coeff X or add a sensitivity pot adjuster to arduino analogue in so you can do it dynamically

It would be nice to have the joystick input position go to the arduino as well to help with servo tracking, at low speed fsteer is pretty good but at higher speed fsteer is not a vey good indication of how much stick input has moved so you start to feel the spring force - next development  ::)


I've just tried with a rolling average of the received value and the results are similar to yours.
I tried with standard steering mode.
The damped value makes sense: I can see clearly that it pulses (up to around 200Nm) when I suddenly change direction.
It is quite stable when you ride quietly. 

For the dynamic tuning, prior to sending to Arduino, I use Processing so I can adjust in real-time the sent value using virtual buttons.
You're right about the joystick position, I hadn't thought about that yet...

Looks like we're on the good way.
Thank you for the help!