Skip to content

Commit

Permalink
Update raycaster.py with recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kozzy97 committed Sep 9, 2023
2 parents b0a700b + e40f473 commit 35ccf07
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions animalai/animalai/envs/raycastparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def prettyPrint(self, raycast) -> str:

if isinstance(raycast, dict):
raycast = raycast['rays']

parsedRaycast = self.parse(raycast)
for i in range(parsedRaycast.shape[0]):
print(self.listOfObjects[i].name, ":", parsedRaycast[i])
Expand Down Expand Up @@ -159,4 +159,20 @@ def prettyPrint(self, raycast) -> str:
parsedRaycast = rayParser.parse(test_raycast)
print("Parsed Raycast for Test 3:")
print(parsedRaycast)
rayParser.prettyPrint(test_raycast)
rayParser.prettyPrint(test_raycast)

# Test 4: Mix of objects detected and not detected, including PILLARBUTTON
# Description: This test checks if the parser correctly identifies some objects including PILLARBUTTON while ignoring others.
rayParser = RayCastParser(
[RayCastObjects.ARENA, RayCastObjects.PILLARBUTTON, RayCastObjects.MOVABLE], 7)
test_raycast = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0.1,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0.2,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0.3,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0.4,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0.5,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.6,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
parsedRaycast = rayParser.parse(test_raycast)
print("Parsed Raycast for Test 4:")
print(parsedRaycast)
rayParser.prettyPrint(test_raycast)

0 comments on commit 35ccf07

Please sign in to comment.