Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed touch detection #27

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions controllers/supervisor/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,17 +990,12 @@ def run(self):
self.publish_current_frame()
self.reset_reason = Game.NONE


touch = self.get_robot_touch_ball()
# update touch statuses of robots
touch = self.get_robot_touch_ball()
for team in constants.TEAMS:
for id in range(constants.NUMBER_OF_ROBOTS):
self.robot[team][id]['touch'] = touch[team][id]

# if any of the robots has touched the ball at this frame, update touch status
for team in constants.TEAMS:
for id in range(constants.NUMBER_OF_ROBOTS):
if touch[team][id]:
if touch[team][id]: # if any of the robots has touched the ball at this frame, update touch status
self.recent_touch = touch
break
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior of the program because if one if touch[team][id] is True, the loop will stop immediately and statuses of remaining robots will not be updated.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. I will fix this...


Expand Down