F1Tenth.jl

A Julia port of the Python f1tenth_gym simulator, with the same features. For the same inputs it gives the same outputs (poses, LiDAR scans, collisions, laps) as the Python code, 10–20× faster.

Quick start

using F1Tenth

env = F110Env(map="berlin", num_agents=2)
obs, reward, done, info = reset!(env, [0.0 0.0 0.0; 2.0 0.0 0.0])   # rows: x, y, θ
while !done
    action = [0.1 2.0; 0.0 1.5]                 # rows: steering angle, speed
    obs, reward, done, info = step!(env, action)
end

For a window, load GLMakie and call render!:

using GLMakie
render!(env)

Coming from Python

PythonJulia
gym.make('f110_gym:f110-v0', map='berlin', num_agents=2)F110Env(map="berlin", num_agents=2)
env.reset(poses)reset!(env, poses)
env.step(action)step!(env, action)
env.render(mode='human_fast')render!(env; mode=:human_fast)
env.update_params(params, index=0)update_params!(env, params; index=1)
obs['poses_x'][0]obs[:poses_x][1] or obs.poses_x[1]
Integrator.RK4Integrator.RK4

Indices are 1-based. Observations are reused between steps; copy(obs) keeps one. Besides Python's maps, the 23 tracks of f1tenth_racetracks work by name (map="Spa"; downloaded on first use), and any ROS map works by path.

F1Tenth — Module
F1Tenth

A Julia port of the Python f1tenth_gym simulator, with the same features and outputs. Start with F110Env.

source