Pavement Drive Assist

by Arcitos

Introduces a driver assistance system that autonomously follows paved roads, while maintaining a preset cruise speed if desired.

Utilities
4 years ago
0.14 - 0.18
185

i Great Mod!

7 years ago

I've been using this mod for weeks and it works great. I've even created blue-printable road intersection configurations that practically "program" your vehicle to follow really complicated tours of your base. It works great with the Vehicle Snap mod to stop the jittering on small tracks (especially thin diagonal paths). My only suggestion is that it had some "park tiles" that it can ... park into and leave. The current option is to do it manually or go off-road and coast into a spot.
Regards,
~B

7 years ago

Hi Bordo, i'm glad to hear that you have fun with this mod! You're right, parking is an issue and it's unfortunately one that is not easy to solve. The implementation of a function for automated parking is quite difficult. At the moment i'm working on a "road sign" type of tile, that tells the vehicle to change its cruising speed. This might be useful at the entrance of a parking lot (i.e. it tells the vehicle to reduce its speed to 10 kph), making parking a bit more intuitive.

7 years ago
(updated 7 years ago)

I made a parking lot using aai programmable vehicles, you just drive into the lot an hop out ... and it finds a space (actually finds a space based on the id of the vehicle, which results in some shuffling, but eventually all the vehicles re-park) ... speaking of aai ... would be nice for this mod to be able to pilot a car that you are not in, so you could automate several cars using special intersection layouts like Bordo mentioned. Simple thing might be to detect when a vehicle is moving without a player ... and engage autopilot.

AAI has a signal to set the speed of any vehicle, so it would be great if that could be used to start/stop the vehicle and PDA would steer. (I might dig into the code and see what it will take, I've been modding a bit)

Automated parking lot blueprint using aai programmable structures/signals and aai zones mods:
https://pastebin.com/q5Mg3dpw

Screenshot of parking lot:
https://www.dropbox.com/s/cjz035sb4e6ck8t/Screenshot%202017-08-24%2013.09.15.png?dl=0

To use: You will need to find and set the top-left bottom-right coordinates of the parking lot on the correct combinators (the 4 green X Y X Y combinators right below the substation), then place a single aai zone tile
("Zone Box Black") in each parking spot. Any vehicle you drive into the lot and then exit, will be parked for you.

7 years ago
(updated 7 years ago)

So I mucked around in the code and made vehicles under speed control from aai follow paths, and it's glorious, now to make sure it doesn't break everything else, and try to make it work well with the speed limit signs, I'll probably share something this weekend :-D

This functionality could be done without aai by making a key command for setting vehicle on full-auto when exiting the vehicle at a speed limit sign. And the controlling the speed limit signs to stop a "truck" at depots, auto-park, etc. ... maybe this is out of scope of this mod, as aai can easily be used in conjunction for this, but interesting.

Teaser videos:
https://www.youtube.com/watch?v=ACdb4Ouzuhc
https://www.youtube.com/watch?v=2s0eNPqEAIo

Here are my modifications to pda.lua to make this work: https://pastebin.com/t16GBbwe

The data structure is a bit "leaky" and maybe some work to do on performance, but I was running at 60ups right up until about 50 vehicles, then I saw a bit of a dip, (the 30-40 ups/fps in the screen recordings was due to my recording setup slowing things down, not this change)

7 years ago

So I mucked around in the code and made vehicles under speed control from aai follow paths, and it's glorious, now to make sure it doesn't break everything else, and try to make it work well with the speed limit signs, I'll probably share something this weekend :-D

This functionality could be done without aai by making a key command for setting vehicle on full-auto when exiting the vehicle at a speed limit sign. And the controlling the speed limit signs to stop a "truck" at depots, auto-park, etc. ... maybe this is out of scope of this mod, as aai can easily be used in conjunction for this, but interesting.

Teaser videos:
https://www.youtube.com/watch?v=ACdb4Ouzuhc
https://www.youtube.com/watch?v=2s0eNPqEAIo

Here are my modifications to pda.lua to make this work: https://pastebin.com/t16GBbwe

The data structure is a bit "leaky" and maybe some work to do on performance, but I was running at 60ups right up until about 50 vehicles, then I saw a bit of a dip, (the 30-40 ups/fps in the screen recordings was due to my recording setup slowing things down, not this change)

How do we add your edits to the PDA file? Could you upload a working version in zip format? I'm trying to but I Keep running into errors.

7 years ago

Bitbased, i'm very sorry for not responding earlier (Atm im 110% busy with university related stuff)! Your videos and your code look very promising. How much load per vehicle is caused by this extension? I experienced about 0.3 ms per player controlled vehicle, is this also applicable for AAI-controlled vehicles? Load is a key figure here, as i dont know if the tile scan routine still has potential for optimization.

6 years ago
(updated 6 years ago)

Ha, the mod portal really needs a notification system ... I'm using this workaround but forgot to subscribe :-D https://forums.factorio.com/viewtopic.php?f=189&t=30631

@HydrogenSonata, I have posted on your forked version, let me know if you still want my pda.lua, didn't really want to put it all on pastebin since it's @Arcitos work.

@Arcitos, on my Quad Core (altho only 1 core is relevant here) 2.9ghz i7, it must have been less than 0.5ms per controlled vehicle if I did the math right since it didn't drop the ups till ~50 vehicles. Waiting for AAI to update for 0.16 then I'll check again more "scientifically".

You could round-robin automated vehicle scanning so you skipped ticks in updating them (ex, only update 25 automated vehicles per tick) to keep the load down. Adding more vehicles could simply reduce scan rate/driving accuracy per automated vehicle (keeping full update rate for non automated vehicles), but not game performance. Or maybe as a general optimization, repeated "routes" could be cached as waypoints since the vehicles will likely be traveling the same routes, and reset the waypoints when new tiles are placed (this way you would only need to re-scan tiles if a driver steers left or right) ... this sounds really hard tho, lol.

6 years ago
(updated 6 years ago)

I love your idea bitbased, but it seems I'm to stupid to implement it correctly.
On starting the game I get:

Error while running event PavementDriveAssist::on_tick (ID 0)
LuaEntity doesn't contain key passenger.
stack traceback:
PavementDriveAssist/pda.lua:788: in function 'on_tick'
PavementDriveAssist/control.lua:73: in function <PavementDriveAssist/control.lua:72>

I checked now three times, that the insert positions were correct.
Any ideas why this happens?

Thanks

New response