2026-10-06 22:07:41 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 18:28:45 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 18:28:45 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 18:11:59 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00
2026-10-06 22:07:41 +00:00

ATS Native FSD

Experimental simulator autopilot and Tesla Semi cab displays for American Truck Simulator. The controller follows the game's directed lanes and active GPS route, measures nearby vehicles and trailers, and drives through vJoy.

Run

Use Run-Native-Drive.bat or the Tesla Semi FSD desktop shortcut to open ATS and its companion together. With tools/install_ats_autostart.ps1 installed, opening ATS through any shortcut also starts the cab screens and native controller automatically. The per-user login watcher stays idle when ATS is closed; no administrator setup is needed.

The watcher reuses an existing companion, prevents competing vJoy runners, retries a failed companion with backoff, and closes its companion cleanly when the exact ATS process exits. Automatic startup never engages driving controls; F8 remains required. Startup logs are in diagnostics/ats-autostart.log and diagnostics/native-runtime.log. Remove ATS Native FSD Companion from your Windows Startup folder to disable automatic launch.

C:\Python314\python.exe -B tools/run_native_gameplay.py --input auto

The engine must be powered, Drive selected, ATS cruise disabled, and a supported GPS route available before engagement. The map cache prepares the trip in the background and the screen reports readiness and missing connections.

  • F8: engage or release driving controls.
  • Home / End: adjust MAX by 5 MPH.
  • Manual steering/braking or Escape: release controls.
  • Cabin mouse-look: independent of driving observations.

User-facing speeds, distances and range use imperial units. Every confirmed change in the truck navigator's posted limit resets MAX to that limit, including decreases. Home/End adjusts by 5 MPH within +/-5 MPH with a trailer or +/-10 MPH without one, bounded by the controller's 5-80 MPH range. Unchanged or temporarily unavailable limits preserve the manual setting; a new sign resets it.

The verified automatic input transport is vJoy. --input vjoy, --input ets2la and --input spf select explicit transports; the SPF bridge is diagnostic and its acknowledgement alone does not establish that ATS mapped its controls.

Native driving

NativeLaneGraphManager verifies mounted game/mod assets, keeps a persistent map cache, and expands it in a separate process as the truck and GPS route move. A changed executable or mounted archive invalidates incompatible geometry.

The whole-trip planner works backwards from the destination over directed lane connections. It selects lanes needed for later turns and exits, reports unresolved segments, and plans supported truck detours. A prepared maneuver still needs current boundary permissions and observed traffic clearance.

Steering follows ordered lane geometry with lane-center feedback, damping, speed-dependent limits, and stronger low-speed authority for tight turns. Speed control combines the selected path, curve anticipation, coverage, traffic following, and signal stops. Braking slows a zero-drag truck when a lower target requires it; releasing throttle alone is insufficient in this game.

Passing uses mounted adjacent-road lane definitions and measured vehicle bodies. When MAX exceeds a slower lead's speed, the planner checks a supported passing lane, signals, follows a road-anchored transition, and returns only after the passed vehicle clears the player's trailer. Shoulders and opposing lanes are excluded. Signalized junction queues do not trigger a pass.

Traffic-light planning associates live lamp states with authored stop curves. Exact prefab UID lookups in the pinned game map registry supplement the nearby list, which can omit the junction under the truck. An identity-verified loaded segment with no semaphore instances establishes an unsignalized junction; missing lamp observations alone do not. Green or unsignalized entry also requires supported authored priority and fresh observed traffic gaps. Unconditional stop completion and unsupported additional rules retain a hold. Incomplete observations retain a hold. Vehicle observations do not provide complete detection of random construction cones, yellow X barriers, invisible walls, or temporary closures. Unsupported geometry remains an explicit route gap.

Roads and prefab paths use verified source formulas and measured spans. Banked roads support an experimental linear endpoint-roll surface model up to six degrees; truck heading, height and lane-membership checks still apply. The approximation and driving controller remain experimental.

Charging stops

The Tesla Semi battery estimate uses the mod's SDK fuel amount divided by capacity. At 20% or below, a background planner searches for the nearest reachable mapped charging/fuel service over qualified connected lanes.

The custom navigation display shows the detour and retains the original trip. Game GPS/job data is preserved. At a supported pump approach, the controller holds the brake while the driver completes the game's refuelling interaction. At 90% or above, it resumes the original route. A diversion never automatically engages F8. Unsupported station entrances are reported and leave the original route selected.

Cab displays

The two custom Tesla Semi screens show driving status, vehicle and trailer visuals, nearby traffic, the selected path, active navigation, gear, truck indicators, battery estimate and range. The right screen powers off with the truck. Normal launches render only these screens; use --desktop-panel to show the additional desktop panel. --cab-only remains supported.

Native driving does not capture a camera feed. The auxiliary viewport and camera hook are retired. Disable-Forward-Camera.bat runs the reversible removal helper with ATS closed, preserving the SPF framework, TruckScreen plugin, telemetry and vJoy.

native/truck_screen consumes display-only shared frames. Producers and the installed plugin use matching native V1 protocol names. The bridge validates frame handoffs, retains its last valid frame through short gaps, and shows an offline state when the producer expires. native/spf_sdk contains shared framework headers used by the screen and optional input plugins.

Build with native/truck_screen/build.ps1; install the display package with Install-Tesla-Screens.bat while ATS is closed. Addon installation preserves existing game/mod archives.

Runtime reliability and diagnostics

GPS, actor and signal reads run in independent background workers. The control loop consumes completed observations without waiting for slow process-memory reads or reconnects. Original observation times and expiry checks remain; a late result cannot become fresh by completing late. Pauses and GPS destination changes invalidate cached observations immediately.

GPS process-memory verification runs in its own read-only process, isolated from bulk map decoding and display work. Its handoff permits one outstanding read and retains the original request and cached observation times through delayed replies.

Mounted lane source checks also run in a background verifier after startup validation. Snapshots reject archive changes or checks older than two seconds. Lane projection uses bounded scalar geometry to avoid repeated thread handoffs during bulk work; slow mapping iterations and command timeouts record competing thread locations without copying their locals.

Bulk map/permission JSON decoding yields between object batches, and cache writes stream the same pinned bytes. Cyclic garbage collection runs only while disengaged, without a pending F8 request, with fresh stopped telemetry and the parking brake set. Reference counting remains enabled. Per-planner timings and parked collection durations appear in control diagnostics.

Cab rendering runs in a separate process that owns only the display textures. A bounded feeder sends one display snapshot at a time and replaces pending snapshots with the latest; full lane graphs are excluded. Stale display packets cannot publish old ACTIVE status as current. The control process uses a 1 ms Python thread slice so bulk workers yield execution sooner. Actuator command publication and release use separate synchronization. A 500 ms command watchdog remains active; manual takeover and confirmed focus/actuator faults release controls. Every new engagement requires a human F8 press.

diagnostics/native-control.jsonl records the loaded Git revision and source fingerprint at startup, engagements, releases, source ages, reader durations, selected lanes, trip gaps, traffic, charging status, and control/render timings. diagnostics/native-lanes/trips contains trip reports. Normal launches use compact control logs; --record opts into full scene recording. --no-record overrides it. Full evidence encoding yields between batches so diagnostic recording can share execution with control threads.

C:\Python314\python.exe -B -m unittest discover -s tests
C:\Python314\python.exe -B tools/check_native_trip.py

The regression suite covers native routing, geometry, traffic, signals, speed, input ownership, displays and asynchronous observations. Simulator behavior still needs live validation; passing tests does not establish complete route coverage or collision avoidance.

S
Description
ATS native Tesla-style autopilot, route planner, traffic-aware control, and in-game displays
Readme
4.5 MiB
Languages
Python 83.2%
C 11.6%
C++ 3.5%
PowerShell 1.6%
Batchfile 0.1%