Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

schlepp

Compute and render Schleppkurven — swept-path diagrams showing the area traced by a vehicle's body as it executes a turning maneuver.

articulated truck making a 90° left turn

What is a Schleppkurve?

When a vehicle turns, its body sweeps through a larger area than the path its wheels follow. The swept envelope (Schleppkurve) is critical for road design, intersection layout, parking garage clearances, and loading dock access. This tool computes the envelope and renders it as an SVG you can import into Inkscape, embed in documents, or archive alongside design drawings.

Installation

Requires Python 3.11+.

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Quick start

schlepp run examples/straight-arc-straight.toml
# writes examples/straight-arc-straight.svg

TOML file format

A maneuver file has three sections: [vehicle], [[path]] (one entry per segment), and an optional [render].

[vehicle] — vehicle geometry

Defines the steered/driven segment (tractor). All dimensions in metres.

[vehicle]
wheelbase      = 2.7   # distance between front and rear axle
front_overhang = 0.9   # body extension ahead of the front axle
rear_overhang  = 0.5   # body extension behind the rear axle
width          = 1.8   # total body width
  ←front_overhang→←— wheelbase —→←rear_overhang→
  ┌───────────────────────────────┐
  │           vehicle body        │   ↑ width
  └───────────────────────────────┘
                  ↑ rear axle (reference point)

The reference point — the point that traces the maneuver path — is the centre of the rear axle.

Optional trailer

Add a [vehicle.trailer] subsection to simulate an articulated vehicle. The trailer accepts the same geometry fields as the tractor.

[vehicle]
wheelbase      = 4.5
front_overhang = 1.2
rear_overhang  = 0.8
width          = 2.5
hitch_offset   = 1.5   # distance from tractor rear axle to hitch point
                        # defaults to rear_overhang if omitted

[vehicle.trailer]
wheelbase      = 8.0
front_overhang = 0.5
rear_overhang  = 1.2
width          = 2.5

hitch_offset controls where the coupling sits relative to the tractor's rear axle. A value equal to rear_overhang places the hitch at the very back of the tractor body.

[[path]] — maneuver segments

Defines the path the reference point follows. Segments are executed in order; each begins where the previous one ended. The vehicle always starts at the origin (0, 0) heading along the +X axis.

Two segment types are supported:

Straight

[[path]]
type   = "straight"
length = 10.0   # metres

Arc

[[path]]
type   = "arc"
radius = 12.0    # metres; must be positive
angle  = 90.0    # degrees; positive = left turn (CCW), negative = right turn (CW)

A full approach–turn–departure maneuver looks like this:

[[path]]
type = "straight"
length = 5.0

[[path]]
type = "arc"
radius = 6.0
angle = 90.0      # 90° left turn

[[path]]
type = "straight"
length = 5.0

[render] — output and simulation options (optional)

[render]
# Output dimensions
ghost_interval = 2.0    # metres between ghost vehicle outlines (default: 2.0)
px_per_m       = 100.0  # pixels per metre in the output SVG (default: 100.0)

# Simulation resolution
straight_step  = 0.05   # step size along straight segments, metres (default: 0.05)
arc_step       = 0.5    # step size along arc segments, degrees (default: 0.5)

# Ghost outlines (default: true — set to false for a clean envelope-only diagram)
show_ghosts          = true

# Optional overlays (all default to false; only apply when show_ghosts = true)
show_axles           = false  # draw axle lines across each ghost outline
show_reference_point = false  # draw a dot at the reference point on each ghost
show_axle_traces     = false  # draw path traces for all non-reference axle centres
show_scale           = false  # draw a 0–5 m scale bar

ghost_interval controls how densely the vehicle outline is drawn along the path. Smaller values produce more outlines; larger values produce fewer. The vehicle's start and end positions are always included regardless of this setting.

px_per_m scales the SVG pixel dimensions. At the default of 100, a 20 m wide diagram is rendered as a 2000 px wide SVG. Increase this for higher-resolution exports; decrease it for smaller file sizes.

straight_step and arc_step control the simulation resolution. Smaller values produce a smoother, more accurate swept envelope at the cost of slightly longer computation. The defaults (0.05 m / 0.5°) are accurate enough for engineering use; coarser values (0.5 m / ) are fine for quick previews, and finer values (0.01 m / 0.1°) may be useful for very tight maneuvers or high-resolution exports.

show_ghosts controls whether ghost vehicle outlines are drawn at all. Set to false for a clean diagram showing only the swept envelope and reference path — useful for presentations or overlaying multiple maneuvers.

show_scale draws a horizontal 0–5 m scale bar in the bottom-left corner of the SVG. Tick marks appear at every metre (taller at 0 and 5); labels are placed below each tick. The scale bar is placed within the existing bottom margin (1 m) and so does not increase the SVG height. If the diagram is narrower than 5.9 m it will expand the SVG width just enough to fit the bar — this is rare in practice.

show_axles draws a short perpendicular line across the vehicle body at each axle position on every ghost outline. The tractor rear axle (reference point axle) is drawn in dark grey; the tractor front axle in blue; trailer axles follow the same colours as the axle traces below.

show_reference_point draws a filled orange dot at the reference point (tractor rear axle centre) on each ghost outline. Useful for confirming exactly where the path trace originates.

show_axle_traces draws a dashed polyline through every simulation step for each non-reference axle centre. Each trace has a distinct colour:

Axle Colour
Tractor rear axle (reference point) Red dashed — always shown in the reference-path layer
Tractor front axle Blue
Trailer rear axle Green
Trailer front axle / hitch point Purple

SVG output

The output SVG contains three named layers (SVG <g> groups):

Layer id Contents
envelope Filled polygon of the full swept area
reference-path Red dashed line tracing the tractor rear axle (reference point)
axle-traces Dashed traces for all other axle centres — only present when show_axle_traces = true
scale 0–5 m scale bar in the bottom-left corner — only present when show_scale = true
ghosts Vehicle outlines (and optional axle lines / reference point dots) at sampled positions

Each layer can be toggled or restyled independently in Inkscape or Illustrator.

All coordinates are in metres in the viewBox; the width and height attributes set the pixel display size according to px_per_m.

Examples

File Description
examples/straight.toml Car on a straight run
examples/arc.toml Car making a 90° left turn
examples/straight-arc-straight.toml Car approaching, turning 90°, departing
examples/articulated.toml Truck with semitrailer, 90° left turn

Run all examples:

for f in examples/*.toml; do schlepp run "$f"; done

Python API

The library can be used directly without the CLI:

from schlepp import load, simulate, compute_envelope, render_svg

vehicle, maneuver, render = load("my_maneuver.toml")
states = simulate(vehicle, maneuver)
envelope = compute_envelope(states, vehicle)
svg = render_svg(envelope, states, vehicle,
                 ghost_interval=render.ghost_interval,
                 px_per_m=render.px_per_m)

with open("output.svg", "w") as f:
    f.write(svg)

simulate() returns a list of VehicleState objects (one per simulation step) with fields:

Field Type Description
x, y float Tractor rear axle position (metres)
heading float Tractor heading (radians; 0 = +X)
dist float Accumulated path length (metres)
trailer_x, trailer_y float | None Trailer rear axle position (if trailer present)
trailer_heading float | None Trailer heading (radians)

Running tests

source .venv/bin/activate
pytest

About

Compute and render **Schleppkurven** - swept-path diagrams showing the area traced by a vehicle's body as it executes a turning maneuver.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages