Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9cdc257
Centerline of random gen now uses the same format the maps centerline.
AhmadAmine998 Jun 13, 2024
8dc076f
Add utils for saving raceline and centerline to track. Used in random…
AhmadAmine998 Jun 13, 2024
597c835
Implemented scaling down parameter
AhmadAmine998 Aug 4, 2024
c625963
Add pyqt rendering skeleton code
AhmadAmine998 Aug 5, 2024
8ddc384
Add pyqt objects skeleton code
AhmadAmine998 Aug 5, 2024
9e709c5
Implement render lines and closed lines
AhmadAmine998 Aug 5, 2024
abf0b66
Implement pyqt TextObject
AhmadAmine998 Aug 5, 2024
afa7e59
Deprecate pyqt Map object
AhmadAmine998 Aug 5, 2024
2214094
Initial implementation of PyQt Car object
AhmadAmine998 Aug 5, 2024
d984495
Make update of car consistent with env renderer
AhmadAmine998 Aug 5, 2024
9f97e98
Update pyqt text object rendering to be consistent with env renderer
AhmadAmine998 Aug 5, 2024
75fba6f
Initial implementation of env renderer render
AhmadAmine998 Aug 5, 2024
448031e
Fix initialization of TextObject
AhmadAmine998 Aug 5, 2024
b997e53
Initial implementation of EnvRender init
AhmadAmine998 Aug 5, 2024
e255bea
Disable default mouse interactions for plot
AhmadAmine998 Aug 5, 2024
b051635
Update render callbacks to update waypoints instead of redrawing
AhmadAmine998 Aug 5, 2024
ddacb8a
Fix issue with jagged lines in rendering
AhmadAmine998 Aug 6, 2024
e8154e6
Now renders cars correctly
AhmadAmine998 Aug 6, 2024
166f0a5
Implement scaled and translated image for proper plotting
AhmadAmine998 Aug 6, 2024
eb95c96
Added wheels
AhmadAmine998 Aug 6, 2024
c12bf0b
Bugfix wheel orientation
AhmadAmine998 Aug 6, 2024
b364741
minor fixes
AhmadAmine998 Aug 6, 2024
1340029
Implement focus and mouse click callbacks
AhmadAmine998 Aug 6, 2024
450ea14
Implement keyboard press event handle
AhmadAmine998 Aug 6, 2024
9e39cbb
Add rendering yaml toggle to switch rendering types
AhmadAmine998 Aug 6, 2024
a2bdc82
Merge branch 'dev-qtgraph-rendering' into dev-model-scale
AhmadAmine998 Aug 6, 2024
989f8a8
Fixed rendering of scaled track, works only for pyqt6 rendering
AhmadAmine998 Aug 6, 2024
1da98e9
Merge branch 'v1.0.0' into dev-qtgraph-rendering
AhmadAmine998 Aug 6, 2024
d8a3a45
Add qt as dependency. Fix render_points
AhmadAmine998 Aug 6, 2024
719465a
Typo in toml
AhmadAmine998 Aug 6, 2024
e476f6d
Merge branch 'dev-qtgraph-rendering' into dev-model-scale
AhmadAmine998 Aug 9, 2024
35c3125
Fix wrong scan simulator resolution
AhmadAmine998 Aug 9, 2024
78591eb
Implemented rgb_array mode for rqt6
AhmadAmine998 Aug 9, 2024
690daa9
Updated ST model
nandantumu Sep 21, 2024
0fe5f53
Updated locked dependencies
nandantumu Sep 21, 2024
d3d181a
Refactored dynamics into a module
nandantumu Sep 21, 2024
38b6fe4
Refactored dynamics into a module
nandantumu Sep 21, 2024
13970c3
Replaced pyproject.toml
nandantumu Sep 21, 2024
3d19862
Merge remote-tracking branch 'origin/dev-model-scale' into dev-dynamics
nandantumu Sep 21, 2024
45a2816
Fixed errors so tests run.
nandantumu Sep 21, 2024
3052c43
Updated so KeyboardInterrupt does not segfault on macOS
nandantumu Sep 21, 2024
4c9a5b9
Fixed typing error
nandantumu Sep 21, 2024
b1856c5
Working MB commit
nandantumu Sep 23, 2024
9b173e6
Updated speed and kinematic threshold for numerical stability.
nandantumu Sep 23, 2024
dc91a46
Updated dynamics tests
nandantumu Sep 23, 2024
cea4ea3
Fully working MB model
nandantumu Sep 24, 2024
ab7a6ec
Attempted speed optimization.
nandantumu Sep 24, 2024
0348928
Fix rendering of tires to be correct
AhmadAmine998 Sep 24, 2024
00e268d
Removing keepalive from example
nandantumu Sep 24, 2024
0e41aa3
Merge branch 'dev-qtgraph-rendering' into dev-model-scale
AhmadAmine998 Sep 27, 2024
c782fb4
Updated observations for futher compatibility.
nandantumu Sep 27, 2024
78e394e
Add scale to default_dict. Fix setting scale
AhmadAmine998 Sep 28, 2024
74435ed
Qt rgb is rendering now returns rgb no alpha
AhmadAmine998 Sep 28, 2024
33c9d3d
Renders car and callbacks in rgb mode
AhmadAmine998 Sep 28, 2024
339a5b8
Update ci to install qt dependencies and make qt headless
AhmadAmine998 Sep 30, 2024
1dfd648
Replace export in CI with variables
AhmadAmine998 Oct 1, 2024
cb7455b
Switch to env in ci
AhmadAmine998 Oct 1, 2024
75e62f1
Instantiate QApp for rgb_array_list test
AhmadAmine998 Oct 1, 2024
f2dcf44
Merge branch 'v1.0.0' into dev-qtgraph-rendering
AhmadAmine998 Oct 1, 2024
9f022c2
Merge branch 'dev-qtgraph-rendering' into dev-model-scale
AhmadAmine998 Oct 1, 2024
a62c9d8
Merge branch 'dev-model-scale' into dev-dynamics
AhmadAmine998 Oct 2, 2024
de44270
Update dynamics to use arctan. Update tests to use func_KS, func_ST
AhmadAmine998 Sep 27, 2024
dfe00de
Fix test to correct calls of func_KS/ST
AhmadAmine998 Oct 2, 2024
67d72cf
Set environment variable
nandantumu Oct 2, 2024
967e1aa
Fixing last commit
nandantumu Oct 2, 2024
cd9c1f4
Implemented random map reset. No guarantees of inside track
AhmadAmine998 Oct 8, 2024
1ec0546
Add track creation from path
AhmadAmine998 Oct 8, 2024
c23ad6d
Merge branch 'dev-map-reset' into dev-dynamics-ros
AhmadAmine998 Oct 8, 2024
34a1d73
Only sets qpa offscreen if rgb_array
AhmadAmine998 Oct 8, 2024
4d706e6
Add f1fifth params
AhmadAmine998 Oct 8, 2024
953e70b
Add scaling to track from dir
AhmadAmine998 Oct 9, 2024
0d735fd
Add optional wrapping to get init state for python3.9 compatibility
AhmadAmine998 Oct 2, 2024
4c65a68
Merge branch 'dev-dynamics' into dev-dynamics-ros
AhmadAmine998 Oct 9, 2024
0c7d412
Change the switch speed for ST to 0.5
AhmadAmine998 Oct 9, 2024
df4187e
Update frenet conversion with ephi wrapping and raceline flag
AhmadAmine998 Oct 11, 2024
b24ad7e
Update __init__.py
nandantumu Oct 11, 2024
5ba30b4
Update __init__.py
nandantumu Oct 11, 2024
a481224
Merge pull request #142 from f1tenth/dev-dynamics-ros
nandantumu Jan 22, 2025
87a4bdf
Handle edge case in frenet conversion tests
AhmadAmine998 Jan 27, 2025
10c5423
Handle unwrapped env, float obs, and check_env warnings
AhmadAmine998 Jan 27, 2025
e5d8198
Convert env. calls to unwrapped and use make_vec
AhmadAmine998 Jan 27, 2025
50db444
Replace example utils with local frameCounter def
AhmadAmine998 Jan 27, 2025
2a7fb1c
pulling blank map from follow / set correct cornering values from the…
AhmadAmine998 Jan 29, 2025
84db297
Migrate to ND cubic spline interpolation for continuous yaw and eyaw …
AhmadAmine998 Feb 11, 2025
77c450a
Fix calc yaw by using edge order 2 for np gradient
AhmadAmine998 Mar 26, 2025
25c6d7a
Implement more stable gradient calculation in _calc_kappa_from_xy by …
AhmadAmine998 Mar 26, 2025
d661c00
Merge pull request #145 from f1tenth/dev-dynamics-frenet-fix
AhmadAmine998 Mar 26, 2025
31bc6d2
Merge branch 'dev-dynamics' into feature/trackgenUtils
AhmadAmine998 Mar 26, 2025
b94014c
Merge pull request #146 from f1tenth/feature/trackgenUtils
AhmadAmine998 Mar 26, 2025
5eeaf90
Add support for Track from raceline file
AhmadAmine998 Mar 30, 2025
b23c384
Updated fullscale cornering stiffness params
nandantumu Apr 25, 2025
b4cd72c
Fixed hcg parameter
nandantumu Apr 25, 2025
86114c7
Change cubicspline init to ensure continuous path, init raceline with…
AhmadAmine998 Jun 13, 2025
7d35a9d
Flexible raceline construction from centerline or raceline files usin…
AhmadAmine998 Jun 13, 2025
2779a9f
Make RaceCar Threadsafe
nandantumu Jul 7, 2025
02e45c0
Fix track loading from name
AhmadAmine998 Nov 24, 2025
67bc6db
Merge branch 'dev-dynamics' of https://github.com/f1tenth/f1tenth_gym…
AhmadAmine998 Nov 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
# env:
# QT_QPA_PLATFORM: offscreen

steps:
- name: Update apt
run: sudo apt update

- name: Install openGL
run: sudo apt install freeglut3-dev
run: sudo apt install -y freeglut3-dev libglib2.0-0 libsm6 libxrender1 libxext6 libxkbcommon-x11-0 libdbus-1-dev

- uses: actions/checkout@v2

Expand Down
24 changes: 15 additions & 9 deletions examples/random_trackgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import matplotlib.pyplot as plt
import numpy as np
import shapely.geometry as shp
from f1tenth_gym.envs.track import Track


def main(args):
Expand All @@ -52,8 +53,9 @@ def main(args):
while True:
try:
print(f"[info] creating track {i}")
track, track_int, track_ext = create_track()
convert_track(track, track_int, track_ext, i, outdir)
WIDTH = 10.0
track, track_int, track_ext = create_track(WIDTH)
convert_track(track, track_int, track_ext, WIDTH, i, outdir)
print(f"[info] saved track {i} in {outdir}/")
break
except Exception as _: # noqa: F841
Expand All @@ -62,13 +64,12 @@ def main(args):
print()


def create_track():
def create_track(track_width):
CHECKPOINTS = 16
SCALE = 6.0
TRACK_RAD = 900 / SCALE
TRACK_DETAIL_STEP = 21 / SCALE
TRACK_TURN_RATE = 0.31
WIDTH = 10.0

start_alpha = 0.0

Expand Down Expand Up @@ -183,15 +184,15 @@ def create_track():
track_poly = shp.Polygon(track_xy)

# Finding interior and exterior walls
track_xy_offset_in = track_poly.buffer(WIDTH)
track_xy_offset_out = track_poly.buffer(-WIDTH)
track_xy_offset_in = track_poly.buffer(track_width)
track_xy_offset_out = track_poly.buffer(-track_width)
track_xy_offset_in_np = np.array(track_xy_offset_in.exterior.xy).T
track_xy_offset_out_np = np.array(track_xy_offset_out.exterior.xy).T

return track_xy, track_xy_offset_in_np, track_xy_offset_out_np


def convert_track(track, track_int, track_ext, track_id, outdir):
def convert_track(track, track_int, track_ext, track_width, track_id, outdir):
# converts track to image and saves the centerline as waypoints
fig, ax = plt.subplots()
fig.set_size_inches(20, 20)
Expand Down Expand Up @@ -238,11 +239,16 @@ def convert_track(track, track_int, track_ext, track_id, outdir):

# Saving centerline as a csv
centerline_filepath = outdir / f"map{track_id}_centerline.csv"
x_m, y_m = xy_pixels[:, 0] * 0.05, xy_pixels[:, 1] * 0.05
with open(centerline_filepath, "w") as waypoints_csv:
waypoints_csv.write("#x,y\n")
waypoints_csv.write("# x_m, y_m, w_tr_right_m, w_tr_left_m\n")
for row in xy_pixels:
waypoints_csv.write(f"{0.05 * row[0]}, {0.05 * row[1]}\n")
waypoints_csv.write(f"{0.05 * row[0]}, {0.05 * row[1]}, {track_width}, {track_width}\n")

raceline_format = Track.from_refline(x=x_m, y=y_m, velx=np.ones_like(x_m) * 4.0)
raceline_format.spec.name = f"map{track_id}"
raceline_format.save_raceline(outdir)
print(f"[info] saved centerline in {centerline_filepath}")

if __name__ == "__main__":
import argparse
Expand Down
4 changes: 2 additions & 2 deletions examples/run_in_empty_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def main():
planner = PurePursuitPlanner(track=track, wb=0.17145 + 0.15875)

# rendering callbacks
env.add_render_callback(track.raceline.render_waypoints)
env.add_render_callback(planner.render_lookahead_point)
env.unwrapped.add_render_callback(track.raceline.render_waypoints)
env.unwrapped.add_render_callback(planner.render_lookahead_point)

# simulation
obs, info = env.reset()
Expand Down
51 changes: 40 additions & 11 deletions examples/waypoint_follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numpy as np
from numba import njit

from f1tenth_gym.envs.f110_env import F110Env

"""
Planner Helpers
Expand Down Expand Up @@ -187,6 +188,9 @@ def __init__(self, track, wb):
self.lookahead_point = None
self.current_index = None

self.lookahead_point_render = None
self.local_plan_render = None

def load_waypoints(self, conf):
"""
loads waypoints
Expand All @@ -201,16 +205,26 @@ def render_lookahead_point(self, e):
Callback to render the lookahead point.
"""
if self.lookahead_point is not None:
points = self.lookahead_point[:2][None] # shape (1, 2)
e.render_points(points, color=(0, 0, 128), size=2)
points = self.lookahead_point[:2][None] # shape (1, 2)~
if self.lookahead_point_render is None:
self.lookahead_point_render = e.render_points(
points, color=(0, 0, 128), size=2
)
else:
self.lookahead_point_render.setData(points)

def render_local_plan(self, e):
"""
update waypoints being drawn by EnvRenderer
"""
if self.current_index is not None:
points = self.waypoints[self.current_index : self.current_index + 10, :2]
e.render_lines(points, color=(0, 128, 0), size=1)
if self.local_plan_render is None:
self.local_plan_render = e.render_lines(
points, color=(0, 128, 0), size=1
)
else:
self.local_plan_render.updateItems(points)

def _get_current_waypoint(
self, waypoints, lookahead_distance, position, theta
Expand Down Expand Up @@ -287,29 +301,36 @@ def main():
work = {
"mass": 3.463388126201571,
"lf": 0.15597534362552312,
"tlad": 0.82461887897713965,
"vgain": 1,
"tlad": 0.82461887897713965 * 10,
"vgain": 1.0,
}

num_agents = 3
num_agents = 1
env = gym.make(
"f1tenth_gym:f1tenth-v0",
config={
"map": "Spielberg",
"map": "Spielberg_blank",
"num_agents": num_agents,
"timestep": 0.01,
"integrator": "rk4",
"control_input": ["speed", "steering_angle"],
"model": "st",
"model": "mb",
"observation_config": {"type": "kinematic_state"},
"params": {"mu": 1.0},
"params": F110Env.fullscale_vehicle_params(),
"reset_config": {"type": "rl_random_static"},
"scale": 10.0,
},
render_mode="human",
)
track = env.unwrapped.track

planner = PurePursuitPlanner(track=track, wb=0.17145 + 0.15875)
planner = PurePursuitPlanner(
track=track,
wb=(
F110Env.fullscale_vehicle_params()["lf"]
+ F110Env.fullscale_vehicle_params()["lr"]
),
)

env.unwrapped.add_render_callback(track.raceline.render_waypoints)
env.unwrapped.add_render_callback(planner.render_local_plan)
Expand All @@ -333,7 +354,6 @@ def main():
work["vgain"],
)
action[i] = np.array([steer, speed])

obs, step_reward, done, truncated, info = env.step(action)
laptime += step_reward
frame = env.render()
Expand All @@ -343,3 +363,12 @@ def main():

if __name__ == "__main__":
main()
# %%
work = {
"mass": 3.463388126201571,
"lf": 0.15597534362552312,
"tlad": 0.82461887897713965 * 10,
"vgain": 1,
}

num_agents = 1
Loading
Loading