Skip to content

Commit

Permalink
Merge pull request #135 from UoA-CARES/docs/add-environment-comments
Browse files Browse the repository at this point in the history
Docs/add environment comments
  • Loading branch information
retinfai authored Oct 25, 2023
2 parents 575e27b + f0c3879 commit a7be3ec
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 19 deletions.
40 changes: 40 additions & 0 deletions src/environments/environments/CarBeatEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,46 @@

class CarBeatEnvironment(Node):

"""
CarBeat Reinforcement Learning Environment:
Task:
Agent learns to drive a track and overtake a car that is driving at a constant speed.
The second car is using the Follow The Gap algorithm.
Observation:
full:
Car Position (x, y)
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
no_position:
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
lidar_only:
Car Velocity
Car Angular Velocity
Lidar Data
No. of lidar points is configurable
Action:
It's linear and angular velocity (Twist)
Reward:
+2 if it comes within REWARD_RANGE units of a goal
+200 if it overtakes the Follow The Gap car
-25 if it collides with a wall
Termination Conditions:
When the agent collides with a wall or the Follow The Gap car
Truncation Condition:
When the number of steps surpasses MAX_GOALS
"""
def __init__(self,
rl_car_name,
ftg_car_name,
Expand Down
21 changes: 12 additions & 9 deletions src/environments/environments/CarBlockEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@

class CarBlockEnvironment(F1tenthEnvironment):
"""
CarWall Reinforcement Learning Environment:
CarBlock Reinforcement Learning Environment:
Task:
Here the agent learns to drive the f1tenth car to a goal position
Agent learns to navigate to a goal position while avoiding obstacles that are dynamically placed at the start of each episode
Observation:
It's position (x, y), orientation (w, x, y, z), lidar points (approx. ~600 rays) and the goal's position (x, y)
Car Position (x, y)
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
Action:
It's linear and angular velocity
Its linear and angular velocity (Twist)
Reward:
It's progress toward the goal plus,
100+ if it reaches the goal plus,
-50 if it collides with the wall
Its progress towards the goal * 10
+100 if it reaches the goal
-25 if it collides with an obstacle or flips over
Termination Conditions:
When the agent is within REWARD_RANGE units or,
When the agent is within COLLISION_RANGE units
When the agent collides with a wall or reaches the goal
Truncation Condition:
When the number of steps surpasses MAX_STEPS
Expand Down
20 changes: 11 additions & 9 deletions src/environments/environments/CarGoalEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@

class CarGoalEnvironment(F1tenthEnvironment):
"""
CarWall Reinforcement Learning Environment:
CarGoal Reinforcement Learning Environment:
Task:
Here the agent learns to drive the f1tenth car to a goal position.
This happens all within a 10x10 box
This happens in an open area.
Observation:
It's position (x, y), orientation (w, x, y, z), lidar points (approx. ~600 rays) and the goal's position (x, y)
Car Position (x, y)
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Goal Position (x, y)
Action:
It's linear and angular velocity
Its linear and angular velocity
Reward:
It's progress toward the goal plus,
100+ if it reaches the goal plus,
-50 if it collides with the wall
Its progress toward the goal plus,
+100 if it reaches the goal plus
Termination Conditions:
When the agent is within REWARD_RANGE units of the goal or,
When the agent is within COLLISION_RANGE units of a wall
When the agent is within REWARD_RANGE units of the goal
Truncation Condition:
When the number of steps surpasses MAX_STEPS
Expand Down
37 changes: 37 additions & 0 deletions src/environments/environments/CarTrackEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,43 @@

class CarTrackEnvironment(F1tenthEnvironment):

"""
CarTrack Reinforcement Learning Environment:
Task:
Agent learns to drive a track
Observation:
full:
Car Position (x, y)
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
no_position:
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
lidar_only:
Car Velocity
Car Angular Velocity
Lidar Data
Action:
It's linear and angular velocity (Twist)
Reward:
+2 if it comes within REWARD_RANGE units of a goal
-25 if it collides with a wall
Termination Conditions:
When the agent collides with a wall or the Follow The Gap car
Truncation Condition:
When the number of steps surpasses MAX_GOALS
"""

def __init__(self,
car_name,
reward_range=0.5,
Expand Down
7 changes: 6 additions & 1 deletion src/environments/environments/CarWallEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class CarWallEnvironment(F1tenthEnvironment):
This happens all within a 10x10 box
Observation:
It's position (x, y), orientation (w, x, y, z), lidar points (approx. ~600 rays) and the goal's position (x, y)
Car Position (x, y)
Car Orientation (x, y, z, w)
Car Velocity
Car Angular Velocity
Lidar Data
Goal Position (x, y)
Action:
It's linear and angular velocity
Expand Down

0 comments on commit a7be3ec

Please sign in to comment.