Skip to content

Commit

Permalink
Update raycastparser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alhasacademy96 committed Sep 8, 2023
1 parent 0ec71be commit e40f473
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 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 @@ -160,9 +160,10 @@ def prettyPrint(self, raycast) -> str:
print("Parsed Raycast for Test 3:")
print(parsedRaycast)
rayParser.prettyPrint(test_raycast)
# Test 6: Mix of objects detected and not detected, including PILLARBUTTON

# 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_6 = RayCastParser(
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,
Expand All @@ -171,7 +172,7 @@ def prettyPrint(self, raycast) -> str:
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_6 = rayParser_6.parse(test_raycast)
print("Parsed Raycast for Test 6:")
print(parsedRaycast_6)
rayParser_6.prettyPrint(test_raycast)
parsedRaycast = rayParser.parse(test_raycast)
print("Parsed Raycast for Test 4:")
print(parsedRaycast)
rayParser.prettyPrint(test_raycast)

0 comments on commit e40f473

Please sign in to comment.