mdjarv / assettocorsasharedmemory

Assetto Corsa Shared Memory library written in C#
MIT License
113 stars 34 forks source link

MaxRpm stuck at 0 and Shift Light ? #9

Open TheSkyline35 opened 6 years ago

TheSkyline35 commented 6 years ago

Hi,

I'm using your library to write code for AC, learning C# and Arduino in the process, thank you for that work is a huge help, right now everything is going well but I face an issue I can't resolve !

Everything is working fine, but for an unknown reason the int I get from e.StaticInfo.MaxRpm is often at 0 (worked fine for 2h today, then for no reason, didn't changed anything it's stuck at 0, like yesterday), which is a big mess for my shift light LED, I'm comparing the CurrentRPM with the MaxRPM...etc.

Is there a magic tricks ? Am I doing something wrong ? Even the tiny simple code that you give as Example isn't giving me the correct RPM, I get for instance on Monza with a M4 :

_StaticInfo Car Model : ks_bmwm4 Track : Monza Max RPM : 0

mdjarv commented 6 years ago

There shouldn't be anything specific you need to do for MaxRPM so I'm thinking it might be a problem when updating StaticInfo in general.

Can you check some of the other values in StaticInfo to see if they change between races, for example if you change cars, will the new car be available under e.StaticInfo.CarModel?

I haven't started AC in years so this is mostly guesswork on my part

mdjarv commented 6 years ago

Also, just to help pinpoint where the problem could be I'd recommend you take the example from README.md and have it running while you enter and exit a few races with different cars to see if MaxRPM changes.

TheSkyline35 commented 6 years ago

Tested M4 and F40 on different track, MaxRPM : 0

Then closed everything, reboot, hooo surprise, the ford mustang is giving me

MaxRPM : 6619245

Then, deleted my assettocorsasharedmemor.dll, redownloaded it aaand...surprise surprise everything seems to work fince now... I don't get it, but it works, hum

Also how do you know the correct time to shift up ? For now I'm just comparing MaxRPM/CurrentRPM, and when it's under 1.05 I made blink the LEDS, but it's not accurate, some cars have their peak power in other RPM zone, but you don't have that data.

Also big thumb up for your work, helped me A LOT, I would have made it without you work !

mdjarv commented 6 years ago

I know the Mustang is a beast of a car, but revving it to 6619245 RPM does seem a bit excessive :smile:

If you were checking the MaxRPM values on the Arduino, and a reboot solved the issue I would suspect that the COM-ports might have locked up. I've had this happen a few times when messing with my arduinos, where a broken serial connection is holding the COM port hostage until windows has rebooted.

As for shift-lights, I think there's no easy mathematical formula for calculating peak power. You probably need to check the power output graphs and it might even vary from gear to gear.

What I would if precision was important, is to go over the power graphs of the cars you drive the most and create a static lookup table per car (and possibly gear) and map it to StaticInfo.CarModel. You can also use your current formula as a fallback if the car is not yet in your lookup table.

It would then be easy to transfer the current list of shift-light limits to the Arduino when the car changes. (It's always a good idea to do all calculations on your PC and let the Arduino be as dumb as possible)

mdjarv commented 6 years ago

This got me curious so I did a bit of digging, this was a very interesting read: http://forum.projectcarsgame.com/showthread.php?38144-Help-I-m-slow-in-the-straights&s=7c3ba3b651afc7fb04a4d8ec4344c212&p=1102710&viewfull=1#post1102710

It's not a straight answer to your question but it might help when figuring out optimal shift-RPM

cv256 commented 6 years ago

Hi,

take a look at this, I'm still writing the documentation, but it may help or give you ideas:

https://github.com/cv256/CVJoy

[https://avatars0.githubusercontent.com/u/25685468?s=400&v=4]https://github.com/cv256/CVJoy

cv256/CVJoyhttps://github.com/cv256/CVJoy github.com CVJoy - Car Simulator

best regards,

Claudio Vidal


From: TheSkyline35 notifications@github.com Sent: Thursday, October 26, 2017 11:12 PM To: mdjarv/assettocorsasharedmemory Cc: Subscribed Subject: [mdjarv/assettocorsasharedmemory] MaxRpm stuck at 0 and Shift Light ? (#9)

Hi,

I'm using your library to write code for AC, learning C# and Arduino in the process, thank you for that work is a huge help, right now everything is going well but I face an issue I can't resolve !

Everything is working fine, but for an unknown reason the int I get from e.StaticInfo.MaxRpm is often at 0 (worked fine for 2h today, then for no reason, didn't changed anything it's stuck at 0, like yesterday), which is a big mess for my shift light LED, I'm comparing the CurrentRPM with the MaxRPM...etc.

Is there a magic tricks ? Am I doing something wrong ? Even the tiny simple code that you give as Example isn't giving me the correct RPM, I get for instance on Monza with a M4 :

StaticInfo Car Model : ks_bmw_m4 Track : Monza Max RPM : 0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mdjarv/assettocorsasharedmemory/issues/9, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYft3DgpXSVHXg_Ferp0GmPVxi724FSfks5swQPLgaJpZM4QISie.

TheSkyline35 commented 6 years ago

Thanks guys :) this assettocorsasharedmemory.dll is very very cool

mdjarv commented 6 years ago

That looks incredible @cv256, hope I get to see some pictures of the actual rig as well as some details about the mechanical parts :)