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

Fixed touch detection #27

merged 5 commits into from
Aug 28, 2019

Conversation

omichel
Copy link
Owner

@omichel omichel commented Aug 27, 2019

This PR fixes 7.7 on aiwc#58

👍

@omichel omichel added the bug Something isn't working label Aug 27, 2019
@omichel omichel requested a review from chshong August 27, 2019 09:51
@omichel omichel self-assigned this Aug 27, 2019
@omichel
Copy link
Owner Author

omichel commented Aug 27, 2019

@chshong: can you check if this PR also fixes 7.8? I believe it does.
Please approve it if you believe 7.7 is fixed and comment about 7.8.

@chshong
Copy link
Collaborator

chshong commented Aug 28, 2019

I have checked the program and found an issue that when robot's 'touch' is set to True, it never returns back to False even if the robot is not in touch anymore. I fixed this issue.

@chshong
Copy link
Collaborator

chshong commented Aug 28, 2019

In investigating this issue, I found another issue that, the participant programs are receiving more packets than they supposed to. Since the supervisor's PERIOD_MS is 50 ms, the participant programs should received a packet (thus a call to update()) in 50 ms period. However, it looks like the packet is sent in each of Webots's basic time step, which is 10 ms period.

I will add this to issue list since this is not directly related to touch detection

@omichel
Copy link
Owner Author

omichel commented Aug 28, 2019

Thank for the fix. If you agree, I will remove the debug code (print statements) that you added.

@omichel omichel requested a review from chshong August 28, 2019 06:31
@omichel
Copy link
Owner Author

omichel commented Aug 28, 2019

May I let you check my two commits (they shouldn't affect functionality) and re-approve this PR if you agree?

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...

Copy link
Collaborator

@chshong chshong left a comment

Choose a reason for hiding this comment

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

Simplification made around line 1000 changes the behavior of the loop

@omichel omichel requested a review from chshong August 28, 2019 06:48
@omichel
Copy link
Owner Author

omichel commented Aug 28, 2019

I just fixed the problem you reported. Can you confirm it looks good to you now?

Copy link
Collaborator

@chshong chshong left a comment

Choose a reason for hiding this comment

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

Yes, it looks fine

@omichel omichel merged commit db2c554 into develop Aug 28, 2019
@omichel omichel deleted the fix-touch-detection branch August 28, 2019 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants