## Calculated Brake Pressure

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

### Calculated Brake Pressure

Hi Everyone,

Is it possible to create a calculated brake channel based on negative g acceleration in the forward direction?

I'm open to doing this post run via excel. Or alternatively via a calculated math channel in LUA.

I'm clueless as how I might correlate negative G to brake pressure.

Has anyone tried this?

Mustangkev
Posts: 27
Joined: Thu Apr 09, 2015 8:18 pm
Here is a way that it has been done.

http://www.jameshakewill.com/brake-trace.pdf

I wrote a script that included it which is in the second post here:

viewtopic.php?t=5227

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA
Thank you!!!

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA
Mustangkev wrote:Here is a way that it has been done.

http://www.jameshakewill.com/brake-trace.pdf

I wrote a script that included it which is in the second post here:

viewtopic.php?t=5227
I found some time tonight to integrate your brakeg script. I ran into two issues; see bold. The first was the missing parentheses. Easy enough. The second was that brakeG was displaying acceleration Gs. I removed the sign switch and that fixed the issue.

Code: Select all

``````brakegId=addChannel&#40;"BrakeG",10,2,0,1.5,"G"&#41;

local g1=getImu&#40;0&#41;
local u3=getGpsSpeed&#40;&#41;
local b2=&#40;&#91;b&#93;-1*&#91;/b&#93;g1&#41;-&#40;&#40;u3^2/10000&#41;&#91;b&#93;&#41;&#91;/b&#93;
if b2>0 then
setChannel&#40;brakegId,b2&#41;
end
local g2=getImu&#40;1&#41;
local g3=&#40;&#40;g1^2&#41;+&#40;g2^2&#41;&#41;^&#40;0.5&#41;
setChannel&#40;totalgId,g3&#41;
``````

Now that I have brakeG I assume I point RaceRender at this channel as my brake input. How did you scale it from 0 to 100 for brake input? Can you set 0 Gs = 0 and my highest brake G as 100? This doesn't necessarily represent the brake pedal input. Am I missing something or is this as good as it gets without a brake pressure sender?

Mustangkev
Posts: 27
Joined: Thu Apr 09, 2015 8:18 pm
Yes, I did miss a parenthesis.

I haven't really played with this too much but your suggestion of scaling the result from 1-100 seems reasonable.

MrBlahh
Posts: 45
Joined: Tue Sep 27, 2016 11:13 pm
boggie what did you decide to do about scaling the data?

wizrd54
Posts: 23
Joined: Sat Apr 15, 2017 6:56 pm
This worked great. Really good document to explain everything as well. Thank you.

I scaled it 0-100 and ended up needing to use 200000 instead of the 50000 called out in the PDF. Our 318ti chump car is a bit less aerodynamic than a Formula Ford used in the documentation haha.