Stormworks: Build and Rescue

Stormworks: Build and Rescue

Not enough ratings
AVNav Self-Driving: Arid
   
Award
Favorite
Favorited
Unfavorite
Vehicles: Land
Tags: v1.11.5
File Size
Posted
207.996 KB
27 Jun, 2024 @ 5:12pm
1 Change Note ( view )

Subscribe to download
AVNav Self-Driving: Arid

Description
AVNav: Arid only works on the Arid (Industrial DLC) land area. Click here for the version that works on Sawyer.

Overview
AVNav Self-Driving is a microcontroller that allows a land vehicle to automatically drive itself to a destination by providing steering and speed outputs given the vehicle's GPS coordinates and the target coordinates.

Road data is stored in the microcontroller and calculations are performed on the microcontroller. No add-on or external component is needed.

AVNav only calculates the shortest path to your destination. It may not be the fastest path, nor may it be suitable for your vehicle. Please exercise caution when using the system.

AVNav: Arid only works on Arid. As the position of Arid remains consistent across all worlds, AVNav will work in any world regardless of the world seed.

Known Issues
  • On straightaways in dense areas AVNav may inappropriately suggest the minimum speed when there is no need for it (no turn is coming up). In other words, on straight roads using the AVNav speed system, sometimes the vehicle may drive unexpectedly slow. A fix is planned. For now: recommended to have a throttle override for these situations.

Operation
This section contains technical details that normal users do not have to worry about.
The AVNav microcontroller contains data defining every intersection and every curve of every road (node data) along with data defining the connections between those nodes to form roads (way data).
This data is stored in a compressed data format as property texts and is processed when the vehicle is spawned.

AVNav uses the A* pathfinding algorithm to find the shortest route to a destination using Euclidean distance heuristic. Extensive optimization was applied to ensure that AVNav does not slow down the game.

AVNav outputs steering based on the vehicle's direction to the next node. Suggested speed is also output based on the upcoming road curvature. This suggested speed can be piped into a cruise control system or other speed maintenance system so that the vehicle can maintain a controllable speed.

Microcontroller
The microcontroller has the following input nodes:
  • Number: GPS X - The current GPS X coordinate of the vehicle.
  • Number: GPS Y - The current GPS Y coordinate of the vehicle. Connect these to a GPS sensor.
  • Number: Target X - The X coordinate of the destination.
  • Number: Target Y - The Y coordinate of the destination. You can connect these to a 2x1 keypad for the ability to autofill from a set waypoint.
  • Number: Steering passthrough - Passthrough for steering: connect to driver seat. This value will be sent to the wheels if self-driving is not engaged.
  • Number: Compass - Connect this to a compass sensor.
  • On/off: Engage self-driving - Engages the self-driving system.
Output nodes:
  • Number: Steering out - Connect to wheels. Also available through composite channel 1.
  • Composite: Data
    -- Channel 1: Steering out - Connect to wheels. Also available through number node.
    -- Channel 2: Road distance to destination, in meters
    -- Channel 3: Suggested speed (kmh kilometers per hour) based on configuration and upcoming turns/curves. Connect to cruise control system (if applicable)
    -- Channel 4: ETA to destination, in seconds
    -- Channel 5 - 32: X and Y positions of the next 14 nodes in the calculated path

For video output (debugging information + a map of the calculated route), add a video output node to the microcontroller and connect it to the Lua script in the microcontroller. This node is omitted by default to reduce size.

Customization
The following properties can be tweaked in the microcontroller:
  • Max Speed (kmh) - This is the upper limit for the speed suggestion system. Tweak this based on the handling characteristics of your vehicle.
  • Min Speed (kmh) - This is the lower limit for the speed suggestion system. Tweak this based on the handling characteristics of your vehicle.
  • Turn Angle Limit (degrees) - Adjust sensitivity of the speed suggestion system based on the sharpness / curvature of an imminent turn. This is the angle of a turn at which the speed suggestion system will suggest the minimum speed. Increase this to decrease sensitivity/increase speed. Decrease this to increase sensitivity/decrease speed.

Miscellaneous
  • Compared to Sawyer, Arid is a large region and so, given the corresponding increase in map complexity, having many vehicles using AVNav simultaneously may slow the game down. Although route recalculation is performed sparingly - every few ticks, and only when needed - execution times are averaging 5-10 ms for the worst-case scenario and so caution must be taken to avoid simulation stuttering. The cost of route calculation is typically directly proportional to the distance from the target.
  • AVNav has been tested in many dedicated servers and can be used with no issues in multiplayer.
  • Only paved roads are mapped. Facilities/large structures containing roads are also mapped.
  • AVNav does not avoid obstacles for you.
  • AVNav can autonomously navigate out of all hangars (tested) and possibly out of other structures (untested).
  • AVNav does not require an add-on or mission for it to be used.

Version
AVNav
15 April 2024 Feature Update // release 27 June 2024
Changes:
  • Significant optimizations to route calculation reduce execution time.
  • Significantly improved data storage format reduces the size for node data by ~30% and way data by ~90%.
Map
AVNav Arid R1 15 April 2024
3267 nodes ● 183 ways ● 21.99 kB
Changes:
  • Initial release for Arid region.

Please, do not use AVNav without credit. Link to this workshop page when using AVNav in your creation.
Please rate 👍 if AVNav proves useful for you.
8 Comments
Teniente Vlaskovich 5 Jul, 2024 @ 3:27am 
Awesome work
tod tree 3 Jul, 2024 @ 1:41pm 
i understand the reason you cant make it on sawyer is because the island is in the same place but on sawyer could you make it so the user inputs the coordinates of a common location such as the bridge or a lighthouse then basing coordinates of roads and other things of it.
CatLover2500 2 Jul, 2024 @ 11:05am 
make it to where it can drive on any road
Sergeant Polar Bear 29 Jun, 2024 @ 3:01am 
can you make a version with both arid and sawyers?
jiri.kribek 28 Jun, 2024 @ 7:35am 
and if u can make it turn sooner
jiri.kribek 28 Jun, 2024 @ 6:46am 
try to go form Endair airfield to 30dolar trainyard
jiri.kribek 28 Jun, 2024 @ 6:44am 
and it has problems with sharp turns
jiri.kribek 28 Jun, 2024 @ 6:40am 
cool can u addspeed control