pulse / vibration motor when abs is active ?

Gadget11

Registered
Hi guys

I want to vibrate the brake pedal when the abs of the car is active

is there a flag or variable that will indicate the abs is active

how can read this flag and transmit it to a serial port etc so i can drive a dc rumble motor

I have a background in electronics / software and need a bit of help getting started

ideally i would like to build a windows app that records the basic things like speed, rpm, gforce etc and use this to send data to a serial port

Is there an API or anything similar that can be used ?

any help greatly appreciated
 
You may have luck comparing unfiltered and filtered brake in the plugin interface, but I'm not sure if that'll indicate ABS.
 
If I can get the wheels speeds and the vehicle speed I should be able to work out when the ABS is active

I have downloaded the Iron Wolf Plugin - will see what data is available

I assume the Iron wolf plugin uses the RFactor API

where is the API ? and is there any documentation ?
 
I have found the files at https://www.studio-397.com/modding-resources/

I can see the filtered and unfiltered brake and also the forces on the wheels etc

but how do I access these values from a windows forms application - eg visual basic or delphi etc

(been a while but years ago I would declare a dll and then could access the functions inside it)

once the dll is recognised can you do stuff like RF2.GetSpeed() etc ?
 
I have found the files at https://www.studio-397.com/modding-resources/

I can see the filtered and unfiltered brake and also the forces on the wheels etc

but how do I access these values from a windows forms application - eg visual basic or delphi etc

(been a while but years ago I would declare a dll and then could access the functions inside it)

once the dll is recognised can you do stuff like RF2.GetSpeed() etc ?

The rF2SharedMemoryMap plugin linked above should help. That way you don't need your own rF2 plugin.
 
The rF2SharedMemoryMap plugin linked above should help. That way you don't need your own rF2 plugin.

@Gadget11 just to explain that a little more:

Rather than using that plugin's source as an example of how to access rF2, use the plugin itself (install it in your game) and access the memory mapped file it creates to get the data you need. That's what the plugin is for. So then you just need to work out how to access the data with your language, I'm sure Seven Smiles can help with any specifics (though much is probably already covered on github)
 
Hi Lazza thank you for the advice

I have a background in software development - just not with C

is the memory mapped file a text file or similar and you read it like an ini file ?

what is the name of the file the plugin writes to ?
 
Hi Lazza thank you for the advice

I have a background in software development - just not with C

is the memory mapped file a text file or similar and you read it like an ini file ?

what is the name of the file the plugin writes to ?

This page has a description https://github.com/TheIronWolfModding/rF2SharedMemoryMapPlugin

And mentions an example program in C# that should be quite similar to what you'll be using.

Apologies to @The Iron Wolf , said seven smiles above by accident (though he can probably help too - I haven't used rF2SMMP myself).
 
ok - i am making some progress - thank you for the help and support guys - its is very much appreciated !

I have researched memory maps and found an example -- http://voiceofgeek.blogspot.com/2009/02/memory-mapped-file-in-delphi.html


i have created a hello world app using Delphi and here is the code

(I can load the whole project if people want to test it themselves)

I will write a version in Visual Studio when i can get the software downloaded - (Seven Smiles I upgraded VS to use Python last night and it took hours !! )

In the example below I am using a memory map called 'MMAP'

what is the RF2 memory map called ?




-------------------------------------------------------------------------------------------------------------------------------------------------

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public




{ Public declarations }
end;


type
PRecordInfo = ^TRecordInfo;
TRecordInfo = packed record
Field1 : ShortString;
Field2 : Integer;
Field3 : Integer;
end; //TInstanceInfo




var
Form1: TForm1;

FMappingHandle : THandle = 0;
FRecordInfo : PRecordInfo= nil;
FMappingName : String = 'MMAP';




implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);


begin





{ To Create a Mapping File }
FMappingHandle := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TRecordInfo), @FMappingName[1]);
FRecordInfo := MapViewOfFile(FMappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, SizeOf(TRecordInfo));
FRecordInfo.Field1 := 'Value 1';
FRecordInfo.Field2 := 0;
FRecordInfo.Field3 := 1;



end;

procedure TForm1.Button2Click(Sender: TObject);

begin

{ To Open the Memory Map File }
FMappingName := 'MMAP';
FMappingHandle := OpenFileMapping(FILE_MAP_ALL_ACCESS, false, @FMappingName[1]);

{ To Read the File Contents}
FRecordInfo := MapViewOfFile(FMappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, SizeOf(TRecordInfo));
edit1.Text := FRecordInfo^.Field1;//Read the Contents
edit2.Text := inttoStr(FRecordInfo^.Field2);//Read the Contents
edit3.Text := inttostr(FRecordInfo^.Field3);//Read the Contents


end;

end.
 
There are several
Code:
        const string MM_TELEMETRY_FILE_NAME = "$rFactor2SMMP_Telemetry$";
        const string MM_SCORING_FILE_NAME = "$rFactor2SMMP_Scoring$";
        const string MM_RULES_FILE_NAME = "$rFactor2SMMP_Rules$";
        const string MM_FORCE_FEEDBACK_FILE_NAME = "$rFactor2SMMP_ForceFeedback$";
        const string MM_GRAPHICS_FILE_NAME = "$rFactor2SMMP_Graphics$";
        const string MM_PITINFO_FILE_NAME = "$rFactor2SMMP_PitInfo$";
        const string MM_WEATHER_FILE_NAME = "$rFactor2SMMP_Weather$";
        const string MM_EXTENDED_FILE_NAME = "$rFactor2SMMP_Extended$";
        const string MM_HWCONTROL_FILE_NAME = "$rFactor2SMMP_HWControl$";
        const string MM_WEATHER_CONTROL_FILE_NAME = "$rFactor2SMMP_WeatherControl$";
"$rFactor2SMMP_Telemetry$" is the one you want
 
Thank you guys - i have managed to read the first 3 items in $rFactor2SMMP_Telemetry$
i have no idea what they are and what they contain yet - but its some good progress

do you have to read all the item one by one - or can you specify which item to read

i will do some research on $rFactor2SMMP_Telemetry$

very pleased I am making progress :)
 
Hi Dave, I did try simhub first, but it does not have a flag for ABS active
simhub shakeit has ABS effect. I don't know if it works in rF2, but Watever is amazing guy, he would answer your questions about that (try SH Discord). SH uses my plugin. Also, yes, rF2 does not expose ABS active flag, but I suspect you could derive that info (from speed dropping, brake input, wheel rotation speed, assuming rF2 simulates ABS properly). How I would go about it is I would plot wheel RPS using SH and see how graph looks like when ABS is engaged (available properites window).
 
Last edited:
Back
Top