The online racing simulator
The PACT Driving Assistant - Driver Assistance Addon
Hey,
The PACT Driving Assistant was made to avoid collisions caused by not paying attention while cruising on TC...
For old stuff, check out this thread: https://www.lfs.net/forum/thread/92775-The-PACT-Driving-Assistant---DOWNLOAD

I need a lot of feedback to improve the just released rewrite. Sooo if you have nothing else to do -
feel free to test Wink



Current Version: PACT Driving Assistant 2 (V13) (mouse, keyboard, and wheel supported)
Download (zip), with installation guide: MAKE SURE TO FOLLOW THE INSTALL GUIDE!
Not all features working perfectly yet:
https://drive.google.com/drive/folders/1Byr4onJvHW1MP7zCei0HUgOUG9t5R_Dl?usp=sharing

Videos/Explanations: https://www.youtube.com/channel/UCBbp3JqEGoq3iNrKcIAOuKw?view_as=subscriber

INSTALL GUIDE AND EXPLANATIONS for V12: https://youtu.be/mCfSat2n2i0

If you have questions, suggestions or trouble installing, just post a reply here or hit me up on discord!
Robert M.#6244

Features:
Collision Warning: (working) Audible and visual warning if a possible collision with a car in front is detected. Autonomous emergency braking available for wheel / keyboard and mouse users.

Bus Routes Support: (working partly) Bus Routes on TC City Driving server can be detected and will be more realistic with announcements and other sound effects.

Blind Spot Warning: (working partly) A little warning will be displayed at the side of the screen if a car is in your blindspot, or approaching fast from behind.

Light Assist: (working) While performing a full emergency stop the car will automatically flash the taillights while braking and activate the hazard lights when stationary to alert the following vehicles.

Yield Warning: (working on Aston, Blackwood, Westhill, soon more) Warnings will be displayed when you are approaching an intersection if you have to give way to other traffic.

Cop Mode: (working) The program will not give collision warnings when playing as a cop. The Program will automatically turn on/off the siren if you start/end a chase. The Siren and strobe can also be turned on manually. A tracker displays the suspect's speed as well as

Cross Traffic Warning: (working) Works Up to approx. 110 kph. A warning will be displayed if a possible collision with crossing traffic is detected. If a collision is likely, the car will brake as necessary to avoid the collision.

Head-Up Display: (working) It shows the speed, collision warnings, and current RPM. The head-up display can be turned on or off in the driver assistance menu. The position is adjustable from V11.9.9.1.

PDC (Park Distance Control): (working) Displays the distance to the cars around and beeps, just like you'd expect a PDC to do! Works best with FZ5 and cars of similar size.

PSC (PACT Stability Control): (not that good yet) Uses the brakes of your vehicle to stop the car from spinning for example when evading something.

Gearbox: (working with FZ5 and some mods) Unlike the Live for Speed gearbox, the car will shift like a “normal” car would in real life. When suddenly flooring the throttle, kick down mode will be engaged and the car immediately shifts down into the gear that can deliver the most power at the current speed. Currently only working with Fz5. If turned on, it "replaces" the sequential gearbox. Auto clutch must be active in settings.

Emergency Stop Assist: (working as beta) If you are not attentive, the car will first give a visual, then an audible warning. If you still don't react, the car will automatically come to a stop. With a supported wheel, and when lanes are detected, the car will try to stay within its lane.

Trip Computer (working as beta) When driving supported cars, you can click on the bc icon in the head-up display to view your average or current fuel consumption or your range. Click on the button that displays it to switch modes. Your setting will be stored.

Lane Departure Warning: (working on some tracks) If a road with lane lines is detected (only Westhill and Blackwood, more tracks supported soon), the car will warn you if you are slowly drifting out of the lane. This system might also trigger the Emergency Stop Assist if you do not react. With a later update, a corrective steering input will be applied.
The car will display a green symbol next to the head-up display if lanes are detected.

Traffic-Aware Cruise Control: If engaged, the car will maintain the set speed. If a car in front is detected, the car will automatically slow down accordingly and accelerate back up to the set speed as soon as possible.


Later (V12+):
Lane Keeping Assist: The lane-keeping assist can be activated when traveling below 100 kph and on roads with corners having a maximum angle of 25°. The car will try to travel in the middle of the detected lane. This, however, can only be considered an assistant. The car will require you to put your hands onto your controller after 10 seconds if it doesn't detect your presence. The driver remains in control of the vehicle at all times.

Oncoming Traffic Warning: This warning will be issued if the car detects that you are heading towards oncoming traffic on the same street, for example when not paying attention.

Traffic Jam Assist: When traveling behind another car at speed of up to 40 kph, the car will stay in its lane and keep a safe distance. No driver intervention is required. As soon as a higher speed is reached, the system will prompt you to take over within 5 seconds. If you do not react, the car will come to a complete standstill in its lane.


Changelogs:
V12-> PDA V2 ALPHA(Feb 2024)
- rewrite for improved efficiency
- many new features and improvements
- some features are still missing from the old version!

V11.9.9.5 -> V12.0.1: (May 2023)
- efficiency improvements
- new, much more accurate cross traffic warning
- messages with $ prefix are now commands for the Driving Assistant.

V11.9.9.1 -> V11.9.9.5: (April 2023)
- adjustable HUD position bugs fixed
- The mouse pointer can be hidden when driving with Mouse
- Massive improvements in park assist calculations
- Improvements to forward collision warning
- Improvements to fuel and calculations
- "Town Bus" is now supported for the automatic gearbox.
- Some more cars were added for range support.
- Some more improvements to increase efficiency.

V11.9.9 -> V11.9.9.1: (March 2023)
-adjustable HUD position (adjustable in the in-game-menu, will be saved)
-adjustable units metric/imperial (mph/kph)
-bus routes should work fine again
-minor bug fixes

V11.9.4 -> V11.9.9: (January 2023)
- PDC System now also works for most layout objects
- Many many bugfixes
- New ACC for wheel users
- One known issue is that bus routes might not be detected (fix next version).

V11.9.1 -> V11.9.4: (January 2023)
- PDC System Bugfixes
- Fuel consumption and range monitor bug fixes
- New way the collision warning calculates the emergency braking threshold.
- Emergency braking comes to a complete stop now, which it sometimes couldnt do before
- Improvements to the collision warning when the car has no abs
- LFS now doesnt have to be running to start the PDA. It will automatically wait for LFS to start first.

V11.9.1 -> V11.9.2: (December 2022)
- Reimplemented the entire PDC system, now much more accurate
- Fuel consumption and range can now be displayed for supported cars

V11.9 -> V11.9.1: (November 2022)
- Added indicator sounds
- Added new warning sounds
- Many bugfixes
- Added PSC Beta
- New Menu and Settings
- Gearbox working for some other cars
- Added warning distances for several mods
- New .exe logic, now only one file again
- other minor fixes/changes

V11.8.7 -> V11.9:
- Auto-indicators and Auto-Sirens can be turned off separately.
- HUD now includes images for the forward collision warning.
- Rev-bouncer is gone, caused too many issues.

V11.8.6 -> V11.8.7:
- error in bus routes fixed that would only detect one route and then no route again before a restart of the program.

V11.8.5 -> V11.8.6 (May 2022):
- Westhill bus routes
- Westhill yield warnings
- Indicator turn off and light assistance are individual settings now
- Once again new logic for forward collision warning distances, recalibration only needed for weird setups
- known bug, that it sends the car name to the console, just ignore that haha
- bus route detection also works with non-ASCII characters like Chinese now
- some more bugfixes

V11.8.4 -> V11.8.5:
- EV support (Low Battery instead of low fuel and no anti-stall and auto engine start anymore)

V11.8.3 -> V11.8.4:
- Minor bug fixes
- Yield warning on some intersections on Blackwood

V11.8.2 -> V11.8.3:
- "Connection to LFS successful" message only if it actually is successful.
- New script comes with the program now. Put it in LFS->script folder to automatically set /insim 29999 on startup.

V11.8 -> V11.8.2 (April 2022):
- Bus routes error fixed
- Bus routes on Aston, Blackwood, South City, and Kyoto are finished now. Fern Bay is almost there, 60% of routes already working.
- Yield warnings on Aston are working now.

V11.7.4 -> V11.8:
- Bus route errors fixed
- New logic for emergency braking distances
- minor other bugfixes

V11.7 -> V11.7.4:
-Fixed cop assistance errors
-Fixed chase tracker issue
-Bus support for fern bay from east station
-many bugfixes

V11.7 -> V11.7.2:
-Error in Lane departure warning fixed.
-known issue with cop tracker found, will be fixed next version

V11.6 -> V11.7 (March 2022):
-Blackwood lane departure warnings
-Bus support (announcements on south city and kyoto)
-Many Bugfixes
-Collision warning distance depending on the vehicle (many mods now supported)

V11.5 -> V11.6 (Feb 2022):
-Westhill lane departure warning on western highway, paddock, and some other roads
-Lane departure warning settings early, medium and reduced


V11.3 -> V11.5 (Feb 2022):
-emergency assist working when not paying attention
-PDC buttons should not be in conflict with Lazy buttons anymore.

V11.2 -> V11.3:
-fixed another error in gearbox
-fixed another error in message handling
-preparations for emergency assist
-exe now in a folder, not a single file anymore due to a python 3 bug with the c runtime. A shortcut is in the PACT Driving Assistant folder, so for you nothing really changes, its just in the background.
-port to python 3 finally fully completed
-started to work on a message handling bug, should be fixed in 11.4
-lazy support in 11.4 or 11.6

V11.1 -> V11.2:
-fixed error in gearbox
-fixed error in message handling

V11 -> V11.1:
-port to python 3 finished
-new logic for stall detection/anti-stall and auto-engine start, because of issues caused by pygame with python 3, that would disable force feedback by the wheel.

V10.8 -> V11:
-Changed from Python 2.7 to python 3. Which was overdue. By an insane amout of time. But hey, i made it finally.

V10.5 -> V10.8: (Jan 2022)
-Preparations for semi-autonomous driving support
-Preparation for lane-departure warning
-Settings for Handbrake, Brake, Acceleration, Shift and Ignition Keys.
-Gearbox support when in "sequential" gearbox mode
-Updated Gear indicators on HUD
-Autobrake fix for keyboard
-Preparations for install-guide

V10.4 -> V10.5:
-Wheel support for autobraking
-Mouse and Keyboard support for autobraking
-Error in collision warning fixed, when multiple cars are in front
-Fixed error in player handling from version 10.2

V10.3 -> V10.4:
-Some small things, like auto-hold and auto-engine start for wheel users.
-Mouse and Keyboard are now supported, though, there is no automatic braking for any type of controller yet.

V10.2 -> V10.3:
-Many Bugfixes, settings are saved now

V10.1 -> V10.2: (Nov 2021)
-Program understands whether the car is on track, or the user is in the menu

V10 -> V10.1:
-New OutGauge logic

V9 -> V10:
-Entirely new logic for how the car can perceive the world around itself.
-Entirely new project structure
-Rewrite of most of the program
-A much better structure of the main features

V8.2->V9: (Aug 2020)
-Rewrite of some functions that were using a lot of memory

V8.1->V8.2:
-Mayor Bugfixes
-New Light Assist now with automatic indicator turnoff.
-New Advanced Cop Aid System.

V8->V8.1: (Jan 2020)
-Minor Bugfixes
-New Siren button when playing as a cop. No need for TC Lights anymore Smile.

V7.5->V8:
-New warning distances
-Overhauled cross-traffic warning
-Added Lane Departure Warning
-Added Emergency Stop Assist
-Some changes to wheel support

V7.2->V7.5:
-The preliminary warning will now precondition the brakes for a possible full emergency stop.
-The brakes can be applied autonomously, even when using a wheel as a controller.
-Warning distance when the car in front is braking is now much more accurate.

V7.0->V7.2:
-Visual warnings look much better now
-The warning distance is now even more math, but you gut much less unnecessary warnings
-You can actually start the program together with lfs, you don't have to wait until your on track anymore: The program will restart automatically if the connection to lfs is lost; problem solved Smile

V6.0->V7.0: (Dez 2019)
-Basically everything is a little better now.
-New warnings sounds, that aren't so annoying. (Old ones can still be used)
-New acute blind-spot warning, with a warning sound when you are steering towards a car in your blind spot and a collision is very likely.
-PDC is much better now.

V5.2->V6.0:
-Added a tutorial at first start.
-Literally completely overhauled the collision warning.
-Some settings are now customizable via set.txt file.

V5.0 -> V5.2:
-Fixed an issue with the collision warning in V5.0
-You can now activate and deactivate the assistance systems via an assistance menu.

V4.0 -> V5.0:
-The System needs fewer data to determine if warnings are needed now. It's much more stable.
-Many fixes concerning the collision and cross-traffic warning.
-Beta PDC (Park distance control)

V3.5 -> V4.0:
-Many bugfixes and a more accurate collision warning
-New auto-gearbox with two shifting modes!

V3.2 -> V3.5:
-Added a preliminary warning. This is helpful to optimize your reaction time.
-The program now works much better on low-end PC's, because it needs much less data than before.

V3.1 -> V3.2:
-New Cop Mode, the car will now try to determine whether you are a cop and not give you collision warnings as a cop. All other warnings work as usual.

V2.5 -> V3.1: (Feb 2019)
-The program is now a .exe, not a .py anymore!

V2.4 -> V2.5:
-Fixed an issue with the indicators, causing them to not turn off after the rear-end collision prevention was triggered.
-Minor changes to the warning distance.

V2.3 -> 2.4:
-Fixed issues with the indicators.
-Fixed issues with false warnings for cars on bridges.
-Improvements to the rear end thing were made.
-Added the cross-traffic warning.
-Minor improvements to the blind spot warning were made.

V2 -> V2.3:
-Added the Rear-End Collision Prevention
-The program now considers the heading for the collision warning which means you don't get false warnings for oncoming traffic now anymore.
-Many false warnings caused by considering the false car were being fixed now.

V1 -> V2: (November 2018)
-Added the Blind Spot Warning.
-The program now considers more than one car for the warning
-Mayor improvements too the Collision warning were made.
-Several new warning sounds were added.
Hey man, this has so many features i was looking for! thank you! I have a couple of questions/suggestions.

The HUD displays KPH is there a way to change it to display MPH? if not is it possible to maybe have a settings toggle to be able to do this?.

Cruise Control is it possible to increase the limit to 100mph?

Also is it possible to adjust where the HUD is positioned? i use fixed to horizon and it likes to move around a a bit sometimes getting in the middle of my view. Or have i missed something regarding this?

Finally, the Auto Gearshift I love it! makes cruising so much more satisfying and realistic would there be a posibility of a sensitivity setting/toggle like D and D/S mode? where kickdown is initated faster in say a Sport Mode so it kicks down abit earlier?.

I'd say the normal D mode is great as is. Again Thank you!!
Great job ! Congratulations
Quote from Bizzle :Hey man, this has so many features i was looking for! thank you! I have a couple of questions/suggestions.

The HUD displays KPH is there a way to change it to display MPH? if not is it possible to maybe have a settings toggle to be able to do this?.
...

I'd say the normal D mode is great as is. Again Thank you!!

Hey there, thanks for the feedback. Exactly the kind of feedback i need Wink.

Yes, some of that was already available in earlier versions for testing, some is in development.

All of your suggestions are noted. The only thing I am not sure about is the cruise control limit, as at more than 100mph, the cruise control cant really react to cars anymore. Other than that yeah that will come with the next versions.
Just noticed that range is still displayed in km when set to miles. Gonna fix that with the next version Smile
Hi why does insim give me this?
InSim: Password does not match your multiplayer admin password
Quote from LOXISLOXIS :Hi why does insim give me this?
InSim: Password does not match your multiplayer admin password

That's because you have Set an admin Password in Multiplayer Mode. LFS uses that for your insim Connection as Well.


Go to LFS-> Multiplayer -> Start New Host -> delete Admin Password.

Then you should be good to Go Wink.

Hope that helps
Now it works thank you very much
New Big Update
Hey there!

I've been working on a new update that might not look like a lot - but under the bonnet, a lot has changed.
I just finished writing the code, ill have to test it a bit, and then ill release it asap, give me a few days max.

Changelog:
- HUD position change fixed
- The mouse pointer can be hidden when driving with Mouse
- Massive improvements in park assist calculations
- Improvements to forward collision warning
- Improvements to fuel and calculations
- Town Bus is now supported for the automatic gearbox.
- Some more cars were added for range support.
- Some more improvements to increase efficiency.


I'll upload it as soon as I've tested everything.

Hope you'll like the changes. If you have other wishes or suggestions, let me know Wink.

Cya Big grin
Update out now Wink
I have a suggestion for Active Cruise Control. You can get the user's road speed limit on TC and it would be great to have a toggle to set the ACC to follow the road speed limit.
Quote from RevLeon :I have a suggestion for Active Cruise Control. You can get the user's road speed limit on TC and it would be great to have a toggle to set the ACC to follow the road speed limit.

Yes totally. I've experimented around with that in the past, i believe i can make that work. It'll take a bit of time though Wink.

The next update for now will include a proper navigation system and a brand new, much better cross traffic warning Smile. But when im done with that that sounds like a nice addition!

Thx for the feedback Wink
Quote from Rob2003 :Yes totally. I've experimented around with that in the past, i believe i can make that work. It'll take a bit of time though Wink.

The next update for now will include a proper navigation system and a brand new, much better cross traffic warning Smile. But when im done with that that sounds like a nice addition!

Thx for the feedback Wink

It can be easily done with the Rest API TC uses. Also another thing that popped into my head, could you make the cruise speed controlls command based as well so people can bind it to buttons? Example: /o ccup /o ccdown
Quote from RevLeon :It can be easily done with the Rest API TC uses. Also another thing that popped into my head, could you make the cruise speed controlls command based as well so people can bind it to buttons? Example: /o ccup /o ccdown

I've added it to my to do list.
New update is out.

- all messages to the chat with the prefix "$" are now considered commands for the PACT Driving assist. You can use the following commands to quickly change settings:
  • $collision warning on
  • $collision warning off
  • $acc on (Turn on cruise control)
  • $acc off
  • $acc up (Increase cruise control speed)
  • $acc down
  • $auto-brake on
  • $auto-brake off (Disable automatic emergency braking, warnings will still be issued)
Make sure to spell them exactly as listed above. You can assign them to a wheel-button via the LFS settings.

- There is a new cross-traffic-warning that works much better than earlier versions. You will receive a yellow pre-warning, and a red flashing acute warning. If a collision is imminent, the car will break exactly as needed to avoid a collision if possible. Doesn't work at all speeds and all angles.

- Some things changed to improve efficiency.

- Note that bus routes on Westhill might not work as expected due to the bus routes update on TC. I'll get on that as soon as i find some time Wink.

- This version is the first with the new cross traffic warning logic, so it might not be perfectly stable. If you encounter bugs or crashes, please let me know.

Download:
https://drive.google.com/drive/folders/1Byr4onJvHW1MP7zCei0HUgOUG9t5R_Dl?usp=share_link
Hello, I am recieving issues with PACT, during regular gameplay it ends up crashing after x minutes, and in console it gives an error log «vjoy statement not found» it is not exactly what it says but i can send entire log when i get home

I don’t think i have vjoy installed on current pc, that might be the root issue?
Quote from monsternetwork :Hello, I am recieving issues with PACT, during regular gameplay it ends up crashing after x minutes, and in console it gives an error log «vjoy statement not found» it is not exactly what it says but i can send entire log when i get home

I don’t think i have vjoy installed on current pc, that might be the root issue?

Hey there,

Typically you don't have to install vjoy if...

... You use mouse or keyboard
... Or if you use wheel/joystick and DONT want the car to Autobrake.

If you have a controller/wheel/joystick of some kind or use your mouse as an emulated Controller, deactivate "Auto-Brake" setting in the menu, if you don't wish to install vjoy.

That way the issue should be solved, but the car also will not brake.

Of course you can also install vjoy. Just keep in mind to screenshots or write down your wheel settings as you will need to reset your controller settings in after you've installed vjoy, as it emulates a new controller.

If you have more issues, or that doesn't fix it, feel free to ask Wink
Bump.

Hii RobWave,

I've just installed this and it's great aside from a minor issue(s). Such as, losing steering if not paying attention. I have to go back into shift + o to reassign my steering axes, not sure whyShrug. Also, is there any way to get the auto gearshift to work for other cars/mods and not just the FZ5? I've removed vjoy after finding out AEB and ACC not worked for me since I do not have a wheel. Other PACT's features still worked after removing vjoy. The main issue is auto gearshift not working unless you're driving the FZ5. Will there be any future updates to allow it to work with other cars or any update at all?

Thank you for this, truly! Makes cruising that much more fun. Heart

PS: Allowing us to edit the auto gearshift values for when to up/downshift would be great but not needed. Default vaules are fine as is!
Quote from tiffany :Bump.

Hii RobWave,

I've just installed this and it's great aside from a minor issue(s). Such as, losing steering if not paying attention. I have to go back into shift + o to reassign my steering axes, not sure whyShrug. Also, is there any way to get the auto gearshift to work for other cars/mods and not just the FZ5? I've removed vjoy after finding out AEB and ACC not worked for me since I do not have a wheel. Other PACT's features still worked after removing vjoy. The main issue is auto gearshift not working unless you're driving the FZ5. Will there be any future updates to allow it to work with other cars or any update at all?

Thank you for this, truly! Makes cruising that much more fun. Heart

PS: Allowing us to edit the auto gearshift values for when to up/downshift would be great but not needed. Default vaules are fine as is!

Hey there!

Yes there will be more updates and there will be support for more mods etc. I just have a lot to do right now, so it might take a while.

The axis that is used to "reset" after a steering intervention is the axis that is set in the file "controls.txt" -> steering axis. I assume you use mouse axes, as you said you do not have a wheel. The axis system I created sadly only supports wheel axis as of now, so it's not yet possible to reset to a mouse axis. You might want to just disable the emergency assist then.

Hope that helps
Robert
Quote from Rob2003 :Hey there!

Yes there will be more updates and there will be support for more mods etc. I just have a lot to do right now, so it might take a while.


It's okay, we can wait. Smile

Quote from Rob2003 :

The axis that is used to "reset" after a steering intervention is the axis that is set in the file "controls.txt" -> steering axis. I assume you use mouse axes, as you said you do not have a wheel. The axis system I created sadly only supports wheel axis as of now, so it's not yet possible to reset to a mouse axis. You might want to just disable the emergency assist then.


I'm using wheel axis with a logitech controller, if that makes a difference? Or just need only a wheel? I'll disable the emergency assist. Thank you again!Thumbs up
what key to put the siren manually
Right... As many have reached out to me on discord, asking when the next big update for more mods will be, just an fyi:

I am currently rewriting the entire thing, as I am now a much better programmer than i was 3 years ago, when i did the last complete rewrite (probably due to the fact that i have been studying computer science for the past 2 years). There is no point in making the current code better as that's a crappy architecture - and the project is much bigger now than i ever expected it to be....

Therefore, it'll be some time until you can expect a new big update, but that wait will be worth it. I promise Wink.

I am doing my best to give you all the functionality of the current version, just that it hopefully will work for all cars (and mods)...

If you have any feature suggestions, please feel free to reply to this thread. I have a list with everything i want to add/implement, and if i like the idea, maybe i'll add it to that list Wink.

Just to give a time frame: Expect an alpha version of the new thing around march next year (that's going to have maybe half the functions of the final thing). I am probably going to be able to do a lot in the winter break.

In the meantime, i hope you still have fun with the current version Wink.
1

FGED GREDG RDFGDR GSFDG