-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v1.0.0' into dev-frenet-utils
- Loading branch information
Showing
50 changed files
with
3,189 additions
and
2,677 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import numpy as np | ||
|
||
from waypoint_follow import PurePursuitPlanner | ||
from f1tenth_gym.envs.track import Track | ||
import gymnasium as gym | ||
|
||
|
||
def main(): | ||
""" | ||
Demonstrate the creation of an empty map with a custom reference line. | ||
This is useful for testing and debugging control algorithms on standard maneuvers. | ||
""" | ||
# create sinusoidal reference line with custom velocity profile | ||
xs = np.linspace(0, 100, 200) | ||
ys = np.sin(xs / 2.0) * 5.0 | ||
velxs = 4.0 * (1 + (np.abs(np.cos(xs / 2.0)))) | ||
|
||
# create track from custom reference line | ||
track = Track.from_refline(x=xs, y=ys, velx=velxs) | ||
|
||
# env and planner | ||
env = gym.make( | ||
"f1tenth_gym:f1tenth-v0", | ||
config={ | ||
"map": track, | ||
"num_agents": 1, | ||
"observation_config": {"type": "kinematic_state"}, | ||
}, | ||
render_mode="human", | ||
) | ||
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) | ||
|
||
# simulation | ||
obs, info = env.reset() | ||
done = False | ||
env.render() | ||
|
||
while not done: | ||
speed, steer = planner.plan( | ||
obs["agent_0"]["pose_x"], | ||
obs["agent_0"]["pose_y"], | ||
obs["agent_0"]["pose_theta"], | ||
lookahead_distance=0.8, | ||
vgain=1.0, | ||
) | ||
action = np.array([[steer, speed]]) | ||
obs, timestep, terminated, truncated, infos = env.step(action) | ||
done = terminated or truncated | ||
env.render() | ||
|
||
env.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import gymnasium as gym | ||
|
||
gym.register( | ||
id="f1tenth-v0", | ||
entry_point="f1tenth_gym.envs:F110Env", | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
gym/f110_gym/envs/integrator.py → f1tenth_gym/envs/integrator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import warnings | ||
from abc import abstractmethod | ||
from enum import Enum | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.