-
Notifications
You must be signed in to change notification settings - Fork 98
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
Tune Pass Speed with Pass Distance #2918
Tune Pass Speed with Pass Distance #2918
Conversation
…rav_banna/pass_speed_cost � Conflicts: � src/software/thunderscope/thunderscope.py
…rav_banna/pass_speed_cost
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.
LGTM pending nits
edit: oops didnt see that it was a draft
pass_destination.y() - ball_position.y()); | ||
double pass_distance_length = pass_distance.length(); | ||
|
||
double deceleration = -0.5; |
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.
can we pull this out to either a file-level constant or global constant
power = qBound( | ||
0.05f, | ||
m_sslCommand.kick_speed() - (ball->speed().length() / SIMULATOR_SCALE), | ||
m_specs.shot_linear_max()); |
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.
on saturday, we talked about doing this bound only if the ball's current speed is lower than some threshold
…rav_banna/pass_speed_cost
…/Thunderbots-Software into saurav_banna/pass_speed_cost
// we subtract the current speed of the ball from the intended kick speed | ||
// this ensures the ball leaves the robot at exactly the speed we want | ||
power = qBound(0.05f, | ||
ball->speed().length() < kickSpeedBoundThreshold | ||
? m_sslCommand.kick_speed() - | ||
(ball->speed().length() / SIMULATOR_SCALE) | ||
: m_sslCommand.kick_speed(), | ||
m_specs.shot_linear_max()); |
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.
nit: Could you split the lower bound into a separate if statement?
if (ball->speed().length() < kickSpeedBoundThreshold) | ||
{ | ||
lowerBound = | ||
m_sslCommand.kick_speed() - (ball->speed().length() / SIMULATOR_SCALE) | ||
} | ||
else | ||
{ | ||
lowerBound = m_sslCommand.kick_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.
if (ball->speed().length() < kickSpeedBoundThreshold) | |
{ | |
lowerBound = | |
m_sslCommand.kick_speed() - (ball->speed().length() / SIMULATOR_SCALE) | |
} | |
else | |
{ | |
lowerBound = m_sslCommand.kick_speed() | |
} | |
if (ball->speed().length() < kickSpeedBoundThreshold) | |
{ | |
lowerBound = | |
m_sslCommand.kick_speed() - (ball->speed().length() / SIMULATOR_SCALE); | |
} | |
else | |
{ | |
lowerBound = m_sslCommand.kick_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.
🔥
* @param field The field from which we determine the friendly half | ||
* @param pass The pass to rate | ||
* @param passing_config The passing config used for tuning | ||
* @return |
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.
return description missing
double ratePassBackwardsQuality(const Field& field, const Pass& pass, | ||
TbotsProto::PassingConfig& passing_config) | ||
{ | ||
if (field.pointInFriendlyHalf(pass.receiverPoint()) && | ||
field.pointInEnemyHalf(pass.passerPoint())) | ||
{ | ||
double pass_distance = (pass.receiverPoint() - pass.passerPoint()).length(); | ||
if (pass_distance > passing_config.backwards_pass_distance()) | ||
{ | ||
return 0; | ||
} | ||
} | ||
|
||
return 1; |
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.
I think it would be better to approach 0 as the pass distance increases instead of straight up returning a 0. There may be some times when a long backwards pass is actually a good option (maybe its the only way to avoid turning over possession), so the other cost functions might have very high ratings that would be annihilated by this cost function returning 0.
Please fill out the following before requesting review on this PR
Description
Before, we would have the problem of a robot passing the ball to another robot too fast. This causes the ball to just bounce off of the receiver's dribbler instead of being caught by it. So, we need to ensure that the pass is received at an acceptable speed.
To do this, this PR makes changes to the Pass Generator to pick an initial speed for a pass such that its final speed is less than the maximum acceptable speed to prevent the bouncing off.
Testing Done
Added a new simulated test just for passing which allows us to test these changes in isolation. Created a new validation to test for the speed at which a pass is received.
Resolved Issues
Resolved #2904
Length Justification and Key Files to Review
Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.h
file) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom
. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO
(or similar) statements should either be completed or associated with a github issue