tjfenwick / DIY-Sim-Racing-Active-Pedal

This is my Sim Racing DIY Active Pedal prototype, an affordable alternative to the official Simucube pedals that cost over $2,000 per pedal.
MIT License
251 stars 33 forks source link

Telemetry from Simhub idea - Traction loss, Wheel Lock and ABS #8

Open GWiz-GitHub opened 1 year ago

GWiz-GitHub commented 1 year ago

I'm planning on making an active brake pedal and using Simhub to export the telemetry to the brake pedal to add effects. This is what I have come up with so far:

Set Simhub bass shakers to output telemetry:

if([DataCorePlugin.GameRunning]=0,'', 'WL' + format([ShakeITBSV3Plugin.Export.WheelLock.All],'000') + 'WS' + format([ShakeITBSV3Plugin.Export.WheelSlip.All],'000') +'ABS'+ format([DataCorePlugin.GameData.NewData.ABSActive],'0'))

This should then send over serial the telemetry in this format:

WL000WS000ABS0

Where braking lock up and traction loss under braking are measured up to 100 after WL and WS and ABS active or not is 1 or zero.

Simhub allows some customisation of when he effects are triggered and by how much by modifying the response curve in the Shakeit Bass Shakers section.

My plan is to use this information in the arduino sketch to create a fine vibration for wheel slip, a stronger vibration for wheel lock up and a larger pulse effect for ABS.

ChrGri commented 1 year ago

@GWiz-GitHub Good idea, but why setup a bass shaker if Simhub can output custom serial data itself: https://github.com/SHWotever/SimHub/wiki/Custom-serial-devices#configuration

I thought about writing a custom Simhub plugin for the DIY active pedal, e.g. to customize the pedal curve, effects, etc., but could not find much helpful information on how to start with that task.

GWiz-GitHub commented 1 year ago

@ChrGri I initially has a setup working to an extent without using the shaker plugin, but there are a few reasons why I decided to use off the shaker plugin instead.

Several games don't output Wheel Slip data directly and so you need to compare the vehicle speed to tyre speed, taking into consideration the tyre diameter of the vehicle. There is a custom plugin that does exactly this, but I found it simpler to piggy back off the Shaker module which does these calculations already (The motors plugin would work just as well).

The shaker and motors plugins have some useful features build in such as only triggering when the pedal is depressed by a certain amount and easy adjustment of the output curve. By using the existing plugin, it allows cross compatibility when swapping games without having to worry about how a specific game outputs it's telemetry (Not all the games send the data in the same format). A custom Simhub plugin would be nice, you could take parts of the exiting plugins but add options for the pedal curve etc as you have mentioned. I haven't worked out how to do that yet either.

Ibakha commented 1 year ago

I don't know if this is helping, but I found this plugin for calculating the wheel slip https://github.com/blekenbleu/CalcLngWheelSlip

GWiz-GitHub commented 1 year ago

@Ibakha Yes, that's the plugin that I used previously, but I found the bass shaker export to be easier to set up and more configurable.

ChrGri commented 1 year ago

An initial implementation of ABS effect and a SimHub plugin to control the pedals have been added to my fork. Tested it in iRacing, where it was working beautiful.