Skip to content

Commit

Permalink
fix: wrong margin & mock images during parking (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeadTriXz authored Jul 1, 2024
1 parent 2b3c84e commit c3746fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/simulation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def simulate_lane_assist(park: bool = False) -> None:

def get_sim_image_generator() -> Generator[np.ndarray, None, None]:
while True:
if park:
yield np.zeros((height, width), dtype=np.uint8)
continue

responses = client.simGetImages([airsim.ImageRequest("0", airsim.ImageType.Scene, False, False)])
response = responses[0]

Expand Down
4 changes: 2 additions & 2 deletions src/utils/parking.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def __is_centered(self, available_space: float) -> bool:
return True

margin = (config["kart"]["dimensions"]["length"] / 2) - config["kart"]["lidar_offset"]
margin -= self.__speed_controller.get_braking_distance()
margin += self.__speed_controller.get_braking_distance()

center = available_space / 2 * 1000

return frontal_distance - margin * 1000 >= center
return frontal_distance + margin * 1000 >= center

def __is_past_barrier(self) -> bool:
"""Check if the go-kart is past the barrier.
Expand Down

0 comments on commit c3746fb

Please sign in to comment.