-
Notifications
You must be signed in to change notification settings - Fork 27
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
Defending added with minor fixes in util.functions #65
base: fsm
Are you sure you want to change the base?
Conversation
Since there have been recent commits and Merges in fsm branch, there are merge conflicts. Resolve them. |
@@ -94,8 +94,8 @@ def intersection_with_circle(self, circle): | |||
|
|||
# CHECK ----> SLOPE | |||
def intersection_with_line(self, line2): | |||
if not isinstance(line, line2): | |||
raise ValueError("Expected Line instance, got %s" %type(line2).__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this error handling is commented out?? If this is because of syntax error, isinstance(line2, Line)
will be the correct syntax.
x = point.x - (3.5 * BOT_RADIUS) * (math.cos(theta)) | ||
y = point.y - (3.5 * BOT_RADIUS) * (math.sin(theta)) | ||
x = point.x - (1*BOT_RADIUS) * (math.cos(theta)) | ||
y = point.y - (1*BOT_RADIUS) * (math.sin(theta)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is bot able to reach the point returned by this function without colliding with ball?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He's using the getPointBehindBall, during intercept state, where defender is supposed to be ready to kick and clear the ball, I guess. Hence the small radius. But yeah we might have to increase it, if required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function can also be used to find a point by the attacker to kick towards the goal. Now if bot is in between the region of ball and goal post, attacker needs to cross the ball hence a point at sufficient distance is required otherwise path planner replans the path at every instant assuming ball as an obstacle
def getPointBehindTheBall(point, theta): | ||
x = point.x - (1*BOT_RADIUS) * (math.cos(theta)) | ||
y = point.y - (1*BOT_RADIUS) * (math.sin(theta)) | ||
return Vector2D(int(x), int(y)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, a merge with fsm branch to get this branch updated will fix this.
|
||
|
||
import memcache | ||
shared = memcache.Client(['127.0.0.1:11211'],debug=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unwanted import statements and memcache
if not required
creating two files of defender for different positions isn't a good way to do this. You should create a class for Defender and pass arguments to place it at different position |
if dist(awayPos,getPointBehindTheBall(ball,math.pi))/MAX_BOT_SPEED<opp_time: | ||
opp_time=dist(awayPos,getPointBehindTheBall(ball,math.pi))/MAX_BOT_SPEED | ||
our_time=dist(self.kub.state.homePos[2],getPointBehindTheBall(ball,0))/MAX_BOT_SPEED | ||
if our_time > dist(self.kub.state.homePos[1],getPointBehindTheBall(ball,0))/MAX_BOT_SPEED: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldnt hardcode BotID like this
Three new files added :
Also minor bugs fixed in utils.functions