Stormworks: Build and Rescue

Stormworks: Build and Rescue

39 ratings
AVNav Self-Driving: Sawyer
2
3
   
Award
Favorite
Favorited
Unfavorite
Vehicles: Land
Tags: v1.13.6
File Size
Posted
Updated
235.280 KB
19 Dec, 2021 @ 8:19am
23 Feb @ 12:40pm
10 Change Notes ( view )

Subscribe to download
AVNav Self-Driving: Sawyer

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

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: Sawyer only works on Sawyer. As the position of Sawyer remains consistent across all worlds, AVNav will work in any world regardless of the world seed.

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
  • Although AVNav is extensively optimized, with execution times averaging 2-4 ms for the worst-case scenario on Sawyer, having many vehicles using AVNav simultaneously may slow the game down. 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. The entrance to Dean Hall is also mapped.
  • AVNav does not avoid obstacles for you.
  • AVNav can autonomously navigate out of O'Neill and Harrison hangars.
  • AVNav does not require an add-on or mission for it to be used.

Version
23 February 2025: AVNav: Sawyer is updated to be in-line with AVNav: Arid, introducing a new data storage format and route calculation optimizations.
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 Sawyer R5-B2 10 March 2024
937 nodes ● 20 ways ● 5.65 kB
Changes:
  • Redundant nodes removed to slightly improve performance and decrease size.
  • Potentially significant route change: bypasses a narrow mountain road west of North Harbor with a detour using the train track. See image.

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.
29 Comments
liam.limb0 11 Oct @ 12:06am 
Which way do i orient my compass? it keeps going away from my set location.
LionsFan20 13 Jun @ 10:47pm 
Is there a cruise control system that you know of that can connect to this system, and change speed according to recommended speed for turns? I am working on an autonomous taxi system, and I can't seem to find a cruise control system for this system.
silo8811 21 Apr @ 10:45am 
Speed suggestion is NaNing, would suggest update to use the 8192 chars for lua and add a nan check
average_beverage 29 Dec, 2024 @ 7:59am 
does this work in arctic?
average_beverage 28 Dec, 2024 @ 10:48am 
the controller is making errors o the route to harrison, its turning itself off road and in circles
ardows 3 Jul, 2024 @ 3:45pm 
anyone know how it can start moving on its own? (like going faster and slower)
[AIM] scrapguy 28 Mar, 2024 @ 12:54pm 
what abaut arid?
red 14 Jan, 2024 @ 12:04am 
Yeah, can we please get an Airid Update?
Xyadran 28 Aug, 2023 @ 8:18pm 
theres no plans to adapt this to the Airid map again yes?
Walker75842 23 Apr, 2023 @ 6:42pm 
@Gaming_Guy, it doesn't control the motor itself, but it does give a seed recommendation for your vehicle, which can be used to control the motor. If you don't want to build a system yourself you can use my Silicon OS Auto, even if your just extracting the throttle control parts.