|
|
|
|
#1 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
I made a brake vibration modification for rFactor (and GTR2, see post #20) and my Porsche 911 Turbo wheel and had a great time doing it, so I'm posting this here in case it gives someone else some ideas or inspiration to do something similar. This was my first go at programming for an electronic device and it was great fun and not as difficult as I had thought, so if you are curious about doing something yourself my advice is to dive right in!
A more thorough explanation is posted here but I'll give a quick run down below. Aim: Modify the brake pedal to give vibration feedback of locking wheels in rFactor The Damage: Velleman K8055 USB Experiment Interface Board from Maplin (UK) - 25GBP Vibration motor from PlayStation2 controller - 5GBP for 2nd hand controller Small 5V relay, a few shielded wires, 4xAA battery holder and batteries - 5GBP? So I guess it was about 35 quid all up, but I bought the USB interface as a general investment, not specifically for this mod. Putting it Together: The board has 8 digital outputs (among other features), one of which is to be switched by the rFactor plugin when there is brake lockup. Assembling the USB interface was pretty easy, the instructions were very clear. I'm not a complete novice with a soldering iron, but by no means a pro either. The tricky bit for this was always going to be programming the plugin, as I am a complete novice with C++. To soften the learning curve I took it in steps: 1) Write some Visual Basic code that can toggle a digital output on/off with the click of a button. I know a bit of VB, so this was just about working out how to call the dll supplied by Velleman to connect and switch an output. 2) Write the same functionality in C++ 3) Write the plugin in C++ by using ISI's plugin template as a base. In essence, the logic was IF Moving AND Braking AND AnyWheelRotationSpeed << ThatImpliedByCarSpeed THEN TurnOnVibration ELSE TurnOffVibration The vibration motor was stolen from a DualShock controller, and operated by 4 NiMH AA batteries. The vibration circuit is switched by a relay triggered by a digital output of the board (its actually slightly more complicated in practice). The Result: Amazingly it worked more or less straight out of the box, and after a bit of tweaking of the code I now get a noticable vibration on my foot when I lock up, without suffering any noticable frame rate drops (erherm Fanatec ).Future Plans: I keep meaning to try this logic instead: IF Moving AND Braking AND NotLockedUp THEN Vibrate ELSE Don'tVibrate I would like to improve it by using an analogue/PWM output and have the vibration on every time I brake but linked to car speed (the slower the brake rotor is turning, the slower the vibration), and then have vibration cut out entirely if a wheel locks, but although the code is already written for that, I'd have to power the motor with the board, which would probably cook it. If anyone knows another way to do this, please let me know. I'd love to implement this in GTR2 because it would be brilliant with P&G where I lock up several times per lap. If anyone knows how to get telemetry out of GTR2 to do this please reply (need car speed, brake%, individual wheel speed) Conclusion: For the price of 35 quid and about 5 full evenings I have a pretty good addition to rFactor. Its not going to lower my laptimes but it is another useful addition to the 'immersion factor'. But the real payoff was the fun and confidence gained from programming an external device to work with some existing software. Not as hard as I thought it would be, and it leaves me looking forward to the next project, whatever and whenever that will be. Last edited by hardjack79; 3 September 09 at 18:51. Reason: Added photos for folks who think words are worth 0.001*pic |
|
|
|
|
|
#2 |
|
Since 1979
Join Date: Oct 2006
Location: Bunbury. Western Australia.
Age: 31
|
Geez that's some pretty ingenious work there mate, well done. One question, does that mean the brake pedal is constantly vibrating unless the wheels lock, or does it require pedal pressure to initiate the vibration? Now all you need is a 4 sided steel box with independently moving sides to smash into you whenever you crash, and a bucket of broken glass to be thrown over you and the immersion factor is complete.
|
|
|
|
|
|
#3 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Thanks mate. Yeah I had thought about the steel box, but the broken glass is a new one -- thanks for that
![]() The first thing the code does is check whether the car is moving faster than 1m/s and whether the brake is depressed more than 10%. If either of these isn't true then there is no vibration. From there its pretty easy to choose between having the vibration on when the wheels are locked; or on when braking unless the wheels are locked. I can post the source code if anyone is interested. |
|
|
|
|
|
#4 |
|
Superator
Join Date: Oct 2006
Location: On a thin crust covering a huge ball of hot molten stone whizzing through space
Age: 37
|
I suggest to send the code + hardware info to Fanatec, because their implementation is VERY resource-heavy...
|
|
|
|
|
|
#5 | |
|
Since 1979
Join Date: Oct 2006
Location: Bunbury. Western Australia.
Age: 31
|
Quote:
![]() ![]()
|
|
|
|
|
|
|
#6 |
|
Join Date: Jan 2008
|
The pedals of today lack haptic feedback. I can't feel the clutch gripping, you'll have to guess the engagement point by using the RPM display and change in rev sound pitch.
Can you actually feel the ABS kick in with this mod? You should release it under GPL licence at Google Code, so other developers can implement it natively! Last edited by SgtH3nry3; 12 July 09 at 22:55. |
|
|
|
|
|
#7 | |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Quote:
![]() I'd have to have another look at what telemetry is sent out by rFactor, but I don't recall it reporting whether ABS is interferring in real time; just whether it is switched on or not. But if it does report that then it'd be easy to modify the code to implement it and it would be quite a realistic feeling effect. Also your comments about the clutch are quite interesting, SgtH3nry3... You got me thinking: I could sharpen up the clutch response with dxtweak2 and use the smaller PS2 motor on the clutch to denote the friction point. Thanks for your interest in this, guys |
|
|
|
|
|
|
#8 |
|
Superator
Join Date: Oct 2006
Location: On a thin crust covering a huge ball of hot molten stone whizzing through space
Age: 37
|
Richard, any idea why with the Fanatec driver the brake pedal vibe has such a huge performance hit?
|
|
|
|
|
|
#9 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
I'd like to see their code for sure, but I would speculate that it could be down to either:
1) Its not the brake vibe code that is causing the problem, maybe its the display code. Is there still a big hit when all but brake lockup is disabled? Even if there is it could be that the display routine is still run, just not output. 2) When I first ran this mod I assigned 4 LEDs on the board to indicate blocking in each wheel separately -- and why not? the outputs were there to be used -- but whenever I did lock up it dropped to <1fps. I need to revisit this because I have since made improvements to the code, but perhaps Fanatec do something similar en-route to deciding whether the state is LOCKED or NOT LOCKED? My hardware is of course completely different, and I noticed that it does not do well sending multiple instructions to the board in rapid succession (ie the state of each wheel (D1-4), plus the general lockup indicator (D6), plus analog rotor speed (A1)). Presumably the latency is too much for soft real time at ~60fps and it grinds to a halt. My code originally set D6 and A1 every frame, but this wasn't efficient, so now it only sets it if there has been a significant change in state. It means keeping track of the state within the plugin, and introducing a threashold for changing A1, but it has meant no fps hit and no sudden drops when lock up occurs. Sorry this was a bit unclear, I'm not a programmer really, and I only had a few minutes to type it before the web marshall blocks me from posting for the afternoon. Hope you can make sense of that! |
|
|
|
|
|
#10 |
|
Join Date: May 2007
|
How about using a pc compatible joypad?
Than use it's controller and its rumble motors? That controller should also be able to power the rumble effect by it self. Is it possible for rFactor to use 2 FFB devices? Last edited by riches; 23 July 09 at 15:00. |
|
|
|
|
|
#11 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
I'm not sure what you mean about the PC joypad, but i'll guess.... You could probably miss out the K8055 altogether if you could call the joypad's driver/dll routines directly, but I'm probably not clever enough to do that yet. That's a pretty good idea though.
In terms of rFactor using 2 devices, it has in built support for at least one controller (obviously) and you can add support for as many more as you like if you make a plugin(s). You could control several devices from one plugin, that isn't a problem at all. Latency could become a problem if you really go overboard on complexity of FFB instructions/calculations though --> the fps will crumble. |
|
|
|
|
|
#12 |
|
Join Date: May 2007
|
I was talking about a gamepad, is my typo...
But you get the idea, as the gamepad device is allready supported by it's driver. I was hoping some simple command to the gamespad should make it rumble. Just like it does when you only use the gamepad without a steeringwheel connected. (edit) Been reading about this Velleman USB card. I'm tempted to buy one, just to play around with. You can connect quite a lot more to this device. Last edited by riches; 23 July 09 at 18:58. |
|
|
|
|
|
#13 |
|
Join Date: Dec 2008
Location: Oz-Stralya, Mate
Age: 53
|
I've been playing about with adding feedback effects a little myself and thought you guys might find this usefull....
![]() These come from one of those massage cushions, they typically run on 12v and come in little pods making them easier to mount, there are useually six to eight per cushion and it comes equiped with a power supply. As you can see these ones have brass vibration weights which means they are easy to alter (file or cut down) to change the pitch of the vibration. ![]() Cheers, Jules |
|
|
|
|
|
#14 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Cheers Jules, I'll look into that. Hadn't thought of using a vibration cushion.
|
|
|
|
|
|
#15 |
|
Join Date: Dec 2008
Location: Oz-Stralya, Mate
Age: 53
|
Try reject shops/clearence houses, type of places, you can pick them up at reasonable prices, I bought another one recently that can respond to music/sound inputs and has eight motors. Now I figure that if I modify half the motors to vibrate higher by trimming down the "weights" and arange them in pairs (like a duel shock controller) it gives me two for the pedels, gearshift, wheel and seat of my race frame, all responding to the audio of the game much like my "Buttkicker Gamer" (gotta love that name) does only producing different vibrations.
![]() I have one of the motors pictured above mounted behind the dash but running at it's lowest RPM so if I stall the car and go for the starter the dash vibrates a bit like a real starter motors been engaged. (Yes I have way too much spare time) There are heaps of ways to use these things! ![]() ![]() You can just make out the "pod" mounted behind the ignition switch, rubbish pic but I was kinda upside down when I took it! lol
|
|
|
|
|
|
#16 | |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Quote:
Saturday: Scavenge some cool sh!t Sunday: Whip this sh!t into sim-racing gold. ![]() Jules, have you got any idea where one could raid some linear actuators from? I can't think of anything cheap that would have them. I'd like to start on something to provide some actual forces rather than just vibration. PS Your ignition switch mod cracked me up. I love it! |
|
|
|
|
|
|
#17 |
|
Join Date: Dec 2008
Location: Oz-Stralya, Mate
Age: 53
|
Hardjack, if that cracked you up, prepare to wet your pants
![]() The ignition key and lock (which are real) work like this, turning it to the first position gives power to the gauges'n'stuff and the needles Jump to life, the second position turns on the dashboard lights and the third position dims the lights in the guages (simulating the power drain of a starter motor), triggers the starter motor of the car in-game and makes the dash vibrate like a real starter motor would! ![]() There is nothing quite like grinding away on an ignition key while muttering unrepeatable profanity when you stall the car, it brings a smile to my face every time! Now dry yourself off sunshine and have a fun weekend! Actuators are a bit out of my league, I'm afraid, But I'm interested in hearing your ideas! For laughs aplenty there's a link to my Photobuket page in my profile, there's some other "mods" on there that I'm working on, you might like my car stereo ![]() P.S. Before the weekend comes have you checked out what the X-sim software can do? I havn't looked into the FF side of it yet but it controls servo's real easy and servos can be made to control motors........ (many possibilities) It's also what's used for controlling actators for motion sims. Last edited by Jules327; 28 July 09 at 20:18. |
|
|
|
|
|
#18 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Dude, its a masterpiece. Epic.
You should get along to the Aussie PnG league, great bunch of dudes there that would mock you relentlessly if they knew your whole desk was vibrating each time you fired up, accuse you of stalling deliberately... We are having fun races Sat and Sun evenings at the moment, drop by.Now I'll check out your other mods. |
|
|
|
|
|
#19 |
|
Join Date: Dec 2008
Location: Oz-Stralya, Mate
Age: 53
|
I'm all for upping the volume level on the 'immersion factor' as you called it above, I want to introduce feedback from a number of sources, not over the top, but subtle effects, think London Philharmonic not The Sex Pistols!
I think Electric DC Motors are a very versatile source of feedback, my Speedo & Tacho are powered by motors, so just in normal opperation they will add a vibration to the frame, one increaseing with vehicle speed the other with engine revs. BUT! I'd like to add another pair of motors that mimmick the others, just for effects perhaps driving something, ya know, add some centrifugle(?) force or inertia to the frame. I reckon THAT would be cool!
|
|
|
|
|
|
#20 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
A few updates if anyone is interested:
1) I tried out the clutch friction point mod discussed earlier. Basically the same physical setup as the brake mod, using the same power supply and switched by a different channel of the board by a different 5V relay. The coding was pretty simple too, just turn on when the clutch is anywhere in between 0 and 100%. Then I adjusted the clutch travel in dxtweak2 to be a lot sharper than it was. The result is so-so, its not particularly realistic feeling and doesn't really help the starts as far as I can tell. Plus there is only one start per race. Still, it was pretty easy to do and I'm not going to dismantle it unless I use the motor/relay for something else. 2) Added ini file support so that I can tweak some parameters without recompiling the plugin or exiting the game. I know: "who cares?" 3) Got brake lockup vibration working in GTR2 by using Nye's OCX and example code (what a legend for making that available Not sure what the next project will be now. |
|
|
|
|
|
#21 |
|
Join Date: Oct 2007
Location: Brisbane, Australia
|
just a question... when u lock up wouldnt the pedel just go dead and lose all pressure as the tires are sliding on one spot?.... thats what i figgureds they did in a racecar atleast
|
|
|
|
|
|
#22 |
|
Richard Jackett
Join Date: Dec 2006
Location: London
Age: 31
|
Yeah mate, I agree that makes more sense. Check out the future plans section of the original post... I mean to try it but I'm just too lazy. I want the vibration to be proportional to brake rotor speed, and until I can do that I haven't been bothered to even try the alternate coding out
|
|
|
|
|
|
#23 |
|
Join Date: Oct 2007
Location: Brisbane, Australia
|
the vibrating through the wheel from a flatspot would be kool if it was big enough
|
|
|
|
![]() |
| Thread Tools | |
|
|