RoboJackets / robocup-software

Georgia Tech RoboJackets Software for the RoboCup Small Size League
Apache License 2.0
178 stars 187 forks source link

Rethink PreventDoubleTouch #9

Closed justbuchanan closed 10 years ago

justbuchanan commented 10 years ago

The RoboCup rules forbid a robot from

Our current way for handling this can be found in soccer/gameplay/PreventDoubleTouch.hpp. We basically watch if any of the above two things happen, then add the ball as an obstacle to the robot's path planner. The robot will still try and chase the ball (or whatever it was trying to do before), but it will be overridden at a lower level by the path planner. This is dumb.

A better solution would be to track this like above, but when we detect that we're about to "commit a double-touch", we should have a global variable that tracks which robot is not allowed to touch the ball. This global variable would probably belong on the singleton GameplayModule instance and just be an integer representing the robot's shell number. Setting it to -1 could mean that any robot is ok to go after the ball. However, this would require some rethinking in each Play that currently relies on PreventDoubleTouch to do its work. They'll have to check that global variable and adjust their behavior accordingly.

Reading: The official rules: http://robocupssl.cpe.ku.ac.th/_media/rules:ssl-rules-2013-2.pdf

justbuchanan commented 10 years ago

If we do robot assignment en masse using the hungarian algorithm, we can have a paramater for must-be-able-to-touch-the-ball, which will automatically assign a capable robot to approach the ball, which won't require much change in plays, it will be somewhat baked-in.

justbuchanan commented 10 years ago

I started this on the double-touch-rule branch.

justbuchanan commented 10 years ago

Just looked at the -official rules again to see specifics on this and here's the quote:

"If, after the ball enters play other than due to a forced restart, the kicker touches the ball a second time (without holding the ball) before it has touched another robot:

an indirect free kick is awarded to the opposing team, the kick to be taken from the place where the infringement occurred (see Law 13)"

Do you guys know what this means exactly? Does it mean that after touching the ball once, the robot is allowed to do a PivotKick (because it holds the ball), but not a LineKick (where it drives up to it and kicks immediately)?

cc @barulicm @ehuang3 @blueintegral

blueintegral commented 10 years ago

If a robot is driving down the field with the ball and does a PivotKick, does the ball ever leave the mouth? If you stop the dribbler and the ball rolls forward a few centimeters before you kick, they don't usually call anything. If it's more than that though, they'll probably call it. I think you're correct that LineKicks aren't legal after you've touched the ball if it involves backing off the ball a bit and driving forward again to kick.