-
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_edt_asset
- Loading branch information
Showing
26 changed files
with
1,044 additions
and
729 deletions.
There are no files selected for viewing
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 f110_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( | ||
"f110_gym:f110-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
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
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
Oops, something went wrong.