Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NickGeramanis committed Sep 21, 2024
1 parent c70a555 commit dd9b359
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions gym_navigation/envs/navigation_goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def __init__(self,
def _do_perform_action(self, action: int) -> None:
super()._do_perform_action(action)
self._distance_from_goal = (
self._DISTANCE_STANDARD_DEVIATION
+ self._pose.position.calculate_distance(self._goal))
self._DISTANCE_STANDARD_DEVIATION
+ self._pose.position.calculate_distance(self._goal))

def _do_get_observation(self) -> np.ndarray:
angle_from_goal = (self._ANGLE_STANDARD_DEVIATION
Expand All @@ -80,9 +80,9 @@ def _do_calculate_reward(self, action: int) -> float:
reward = self._GOAL_REWARD
else:
reward = (
self._TRANSITION_REWARD_FACTOR
* (self._previous_distance_from_goal -
self._distance_from_goal))
self._TRANSITION_REWARD_FACTOR
* (self._previous_distance_from_goal -
self._distance_from_goal))

self._previous_distance_from_goal = self._distance_from_goal
return reward
Expand Down
14 changes: 7 additions & 7 deletions gym_navigation/geometry/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, start: Point, end: Point) -> None:
self.slope = ((start.y_coordinate - end.y_coordinate)
/ (start.x_coordinate - end.x_coordinate))
self.y_intercept = (
start.y_coordinate - self.slope * start.x_coordinate)
start.y_coordinate - self.slope * start.x_coordinate)

def get_intersection(self, other: Line) -> Point:
"""Get the intersection point between two lines.
Expand Down Expand Up @@ -72,11 +72,11 @@ def get_intersection(self, other: Line) -> Point:
def contains(self, point: Point) -> bool:
"""Calculate if the line contains a given point."""
contains_x = (
min(self.start.x_coordinate, self.end.x_coordinate)
<= point.x_coordinate
<= max(self.start.x_coordinate, self.end.x_coordinate))
min(self.start.x_coordinate, self.end.x_coordinate)
<= point.x_coordinate
<= max(self.start.x_coordinate, self.end.x_coordinate))
contains_y = (
min(self.start.y_coordinate, self.end.y_coordinate)
<= point.y_coordinate
<= max(self.start.y_coordinate, self.end.y_coordinate))
min(self.start.y_coordinate, self.end.y_coordinate)
<= point.y_coordinate
<= max(self.start.y_coordinate, self.end.y_coordinate))
return contains_x and contains_y
2 changes: 1 addition & 1 deletion gym_navigation/geometry/pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def move(self, distance: float) -> None:
self.position.x_coordinate += math.sqrt(
distance ** 2 / (slope ** 2 + 1))
self.position.y_coordinate -= (
slope * (starting_x - self.position.x_coordinate))
slope * (starting_x - self.position.x_coordinate))

def rotate(self, theta: float) -> None:
"""Rotate the yaw of the object by theta."""
Expand Down

0 comments on commit dd9b359

Please sign in to comment.