-
Notifications
You must be signed in to change notification settings - Fork 58
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
Force Value reverses after hitting 255 #53
Comments
I found something in the Joystick.h file all the way at the bottom. Mayby its something which could be fixed with the Limitation. I mean right around this line: //it should be added some limition here,but im so tired,it's 2:24 A.M now!
}; |
I add the value limit in my arduino code, not in the library code. I will analyze the reasonableness of adding output value restrictions to the code in the library, thank you for your feedback. |
I found out it works fine. I would need to get JUST the "understeer effect" seperately so i can add it to my motor to make it harder to steer when the car understeers. Another thing would be my steering wheel being too snappy on low force(0) values, so it would be optimal if i can change the gain only for low values. But thats mainly a problem by the steering wheel itself |
Hello, I would like to ask, have you ever encountered a situation where the force feedback done by this library will cause the game to drop frames in the game? Or freeze and dodge? |
Hi, the force feedback works just fine, but if i turn the wheel really fast, the Force[0] value reverses back until it hits 0 and then into negative. It feels like a Variable overshoots and goes back down instead of having a limit.
In my code i just get the Force Value and tell the wheel to turn in the direction depending on positive or negative and how high the value is.
This is my setup:
//Setup
void setup() {
define_can_messages();
pinMode(A3, INPUT);
pinMode(A5, INPUT);
Serial.begin(115200);
Joystick.begin();
Setup_MCP2515();
c = 0;
}
And this is the Signal for the Steering wheel:
//Lenkrad
void Signal_Lenkrad() {
int HighP = canMsg.data[1];
int LowP = canMsg.data[0];
uint16_t Position = (HighP << 8) + (LowP & 0xff);
long corrPos = 0;
corrPos = Position;
if (canMsg.data[3] == 255) {
corrPos = corrPos - 65535;
}
Signalrdy = corrPos / 124 + 512; // Wandelt corrPos in Signal von 0 bis 1023 um
int posChange = feedback + 255;
//set EffectParameters for force feedback
myeffectparams[0].springMaxPosition = 1023;
myeffectparams[0].springPosition = Signalrdy; //0 - 1023
// myeffectparams[0].damperMaxVelocity = 0;
// myeffectparams[0].damperVelocity = 0;
//myeffectparams[0].inertiaMaxAcceleration = 512;
//myeffectparams[0].inertiaAcceleration = posChange;
//myeffectparams[0].frictionMaxPositionChange = 255;
//myeffectparams[0].frictionPositionChange = posChange;
Serial.println(feedback);
//Joystick.getGains();
Joystick.setEffectParams(myeffectparams);
Joystick.getForce(forces); //get the forces of the Wheel
Joystick.setXAxis(Signalrdy);
}
After that i just insert the forces[0] value into the motor. but the forces[0]value itself is overshooting like written above.
The text was updated successfully, but these errors were encountered: