Skip to content
@autonomous-golf-cart

Self-Driving Golf Cart

Open-source self-driving golf cart.

Autonomous Golf Cart

An open-source, full-stack self-driving golf cart: perception, planning, control, firmware, and hardware.

License: MIT Python NVIDIA Jetson AGX Thor RTK GNSS

The cart driving itself on Stanford campus, nobody at the wheel

The cart driving itself through Stanford campus. Nobody touches the wheel.

Architecture · Quick start · Drive the cart · Hardware · Safety


Overview

This project turns a standard electric golf cart into a self-driving vehicle using off-the-shelf parts: an NVIDIA Jetson for compute, an ODrive-driven steering column, linear actuators on the pedals, an RTK GNSS receiver, and cameras.

The cart's driving policies live in policies/. The two stacks share one hardware API:

🛰️ Drive by RTK

Follow waypoints with centimeter-level RTK GPS. Draw lanes on a map, pick a route in the web UI, press Drive, and a pure-pursuit controller steers the cart along it.

Drive from a camera alone. SegFormer segments the road, the drivable area is projected into a bird's-eye view, and a lane-aware planner outputs a trajectory and steering angle.

⚙️ cart-api · cartlib

One Python interface to the RTK GPS, steering, gas, and brake. Both stacks drive through it.

Road segmentation overlay
Drive by Segmentation: SegFormer road mask (purple) on campus footage

Architecture

            ┌──────────────────────────┐        ┌──────────────────────────────┐
            │       policies/rtk       │        │    policies/segmentation     │
            │ map UI · route graph ·   │        │ SegFormer · BEV projection · │
            │ pure-pursuit follower    │        │ lane-aware planner           │
            └────────────┬─────────────┘        └──────────────┬───────────────┘
                         │   steer_deg · gas · brake           │
                         └──────────────────┬──────────────────┘
                                            ▼
                    ┌─────────────────────────────────────────────┐
                    │            cart-api  (cartlib)              │
                    │  Cart · GpsReceiver · NtripClient ·         │
                    │  SteeringController · PedalController       │
                    └──────┬─────────────────┬─────────────────┬──┘
                    USB-CDC│ ODrive ASCII    │ serial G/B/S/H/D│ NMEA / RTCM
                           ▼                 ▼                 ▼
                    ┌─────────────┐   ┌──────────────┐  ┌──────────────┐
                    │  ODrive S1  │   │ Arduino Mega │  │ u-blox ZED-F9│
                    │  + M8325s   │   │ pedal fw +   │  │ RTK receiver │
                    │  steering   │   │ watchdog     │  │ + NTRIP      │
                    └─────────────┘   └──────┬───────┘  └──────────────┘
                                             ▼
                                   gas + brake actuators
                                   (hardware e-stop loop)

Compute runs on an NVIDIA Jetson AGX Thor. Development also works on a laptop. Deeper notes live in docs/architecture.md.

Quick start

git clone https://github.com/autonomous-golf-cart/autonomous-golf-cart.git
cd autonomous-golf-cart

# 1. Install the cart API
pip install -e "cart-api[server]"

# 2. Check the hardware (read-only, nothing moves)
./cart-api/cart test
[GPS]      fix=GPS sats=12 hdop=0.54  lat=37.426562 lon=-122.164102      PASS
[PEDALS]   gas_pot=0.007 brake_pot=0.009  failsafe=True estop=False      PASS
[STEERING] bus_voltage=47.5 V  angle=-0.01°  state=IDLE  errors=0        PASS

Drive by RTK

export MAPBOX_TOKEN=pk.your_token
export NTRIP_RTKDATA_USER=...  NTRIP_RTKDATA_PASS=...
./policies/rtk/golive.sh --ntrip          # → http://localhost:3001

Drive by segmentation

pip install -r policies/segmentation/requirements.txt
python policies/segmentation/live.py

Drive the real cart from Python

The cart API is how every policy moves the actual cart. These calls turn the steering column and press the pedals on the real vehicle.

from cartlib import Cart

with Cart() as cart:
    cart.arm()                       # GPS streaming, pedals out of failsafe
    print(cart.snapshot())           # live GPS + pedals + steering state

    cart.steering.enable()           # energize steering motor
    cart.steering.set_angle(15)      # +15° at the steering column
    cart.pedals.set_brake(0.2)       # brake (always safe)
    cart.stop()                      # release pedals
Command What it does
cart test Read-only self-test of all three subsystems
cart read [--ntrip] Live read-only dashboard
cart record PATH Drive manually and record an RTK path
cart follow PATH Preview a path (dry run)
cart drive PATH --max-speed X Drive the path autonomously
cart serve [--gps-only] WebSocket bridge for the map UI (ws://localhost:8765)

Full reference: cart-api/README.md.

Hardware

The cart is a Club Car Precedent retrofitted with drive-by-wire steering and pedals. An ODrive S1 controls an M8325s motor through a 3:1 HTD 5M belt drive; a printed chestplate fits over the steering wheel to turn it. Two 12 V linear actuators press the gas and brake, driven by BTS7960 H-bridges and an Arduino Mega with potentiometer feedback.

An onboard Jetson AGX Thor connects to the cameras, IMU, and GNSS receiver. The pictured build carries six cameras, three front and three rear, plus a roof-mounted Starlink Mini for connectivity.

Annotated cart hardware photo showing the camera rig, Starlink Mini, onboard electronics, pedal actuators, and steering-wheel assembly
Installed hardware (left) and steering-wheel assembly (right).
Subsystem Hardware Interface
Compute NVIDIA Jetson AGX Thor —
Steering ODrive S1 + M8325s, 3:1 HTD 5M belt USB · ODrive ASCII
Gas + brake 2× linear actuators, BTS7960 drivers, Arduino Mega 2560 USB serial
Localization u-blox ZED-F9x RTK GNSS + NTRIP corrections NMEA / RTCM
Vision Camera rig; six cameras in the pictured build USB
Safety Hardware e-stop + firmware heartbeat watchdog —

The cart includes 33 mechanical 3D-printed components for steering, pedal actuation, camera mounting, sensor housings, and accessories.

Landscape catalog of all 33 mechanical components, with CAD renders and dimensions

Browse the CAD exports, per-component renders, and installation descriptions in the hardware catalog. Subsystem write-ups are in docs/: steering · pedal actuators · e-stop · GPS · cameras.

Safety

Warning

This software moves a real vehicle. Always test in a closed area, at low speed, with a person ready on the hardware e-stop.

  • The pedal firmware boots in FAILSAFE and re-enters it (gas released, brake applied) if the host heartbeat stops for more than 300 ms.
  • A hardware e-stop forces full brake and zero gas at the firmware level.
  • Throttle is capped in layers: hardware pot max → global speed limit → per-mode cap. See hardware/arduino-sketches/limits.py.
  • Anything that moves the cart is opt-in. The gas demo additionally requires --i-understand-this-drives.

Contributing

Issues and pull requests are welcome.

License

The hardware and software of this project are fully open source, released under the MIT License.

Pinned Loading

  1. autonomous-golf-cart autonomous-golf-cart Public

    Open-source full-stack self-driving golf cart: RTK waypoint following, camera segmentation driving, control API, firmware, and hardware designs.

    Python 4

Repositories

Showing 2 of 2 repositories

Top languages

Loading…

Most used topics

Loading…