Skip to content

Commit

Permalink
bugfix: video_recording.py, fix wrong order steer, speed action.
Browse files Browse the repository at this point in the history
linting examples.
  • Loading branch information
luigiberducci committed Dec 19, 2023
1 parent af0bb64 commit 0dfa9a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/random_trackgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def create_track():
assert i1 != -1
assert i2 != -1

track = track[i1: i2 - 1]
track = track[i1 : i2 - 1]
first_beta = track[0][1]
first_perp_x = math.cos(first_beta)
first_perp_y = math.sin(first_beta)
Expand Down
2 changes: 1 addition & 1 deletion examples/video_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def main():
work["tlad"],
work["vgain"],
)
action[i] = [speed, steer]
action[i] = [steer, speed]

obs, step_reward, done, truncated, info = env.step(action)
laptime += step_reward
Expand Down
10 changes: 8 additions & 2 deletions examples/waypoint_follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_actuation(pose_theta, lookahead_point, position, lookahead_distance, whe
speed = lookahead_point[2]
if np.abs(waypoint_y) < 1e-6:
return speed, 0.0
radius = 1 / (2.0 * waypoint_y / lookahead_distance ** 2)
radius = 1 / (2.0 * waypoint_y / lookahead_distance**2)
steering_angle = np.arctan(wheelbase / radius)
return speed, steering_angle

Expand Down Expand Up @@ -317,7 +317,13 @@ def main():
planner = PurePursuitPlanner(track=track, wb=0.17145 + 0.15875)

poses = np.array(
[[track.raceline.xs[0], track.raceline.ys[0], track.raceline.yaws[0],]]
[
[
track.raceline.xs[0],
track.raceline.ys[0],
track.raceline.yaws[0],
]
]
)
env.unwrapped.add_render_callback(planner.render_waypoints)
env.unwrapped.add_render_callback(planner.render_local_plan)
Expand Down
4 changes: 0 additions & 4 deletions gym/f110_gym/envs/rendering/rendering_pygame.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
from PIL import Image, ImageColor

from f110_gym.envs.rendering.objects import (
FPS,
Timer,
BottomInfo,
Map,
Car,
TopInfo,
TextObject,
)
from f110_gym.envs.track import Track
Expand Down

0 comments on commit 0dfa9a2

Please sign in to comment.