-
Notifications
You must be signed in to change notification settings - Fork 189
Made goalie line up with ball and kicker in penalty #2469
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
base: ros2
Are you sure you want to change the base?
Conversation
automated style fixes Co-authored-by: franklin-yuan <franklin-yuan@users.noreply.github.com>
rishiso
left a comment
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.
left a few comments
| // return this->field_dimensions_.our_goal_loc(); | ||
| // be smart | ||
| // find robot on their team closest to ball | ||
| std::vector<RobotState> const their_robots = last_world_state_->their_robots; |
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.
No need to make a copy of their_robots. If you really want to keep this, make their_robots a reference.
| rj_geometry::Point enemy_location; | ||
| rj_geometry::Point enemy_shooter_location; |
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.
| rj_geometry::Point enemy_location; | |
| rj_geometry::Point enemy_shooter_location; |
| rj_geometry::Point enemy_shooter_location; | ||
|
|
||
| double closest_distance = std::numeric_limits<double>::infinity(); | ||
| RobotState curr_shooter; |
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.
curr_shooter can just store the enemy robot's position, no need to store the entire RobotState
|
|
||
| // SPDLOG_INFO("botpos {} {}", enemy_shooter_location.x(), enemy_shooter_location.y()); | ||
| // SPDLOG_INFO("ballpos {} {}", ball_pos.x(), ball_pos.y()); | ||
| // SPDLOG_INFO("GOALX {}", field_dimensions_.goal_width()); | ||
|
|
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.
| // SPDLOG_INFO("botpos {} {}", enemy_shooter_location.x(), enemy_shooter_location.y()); | |
| // SPDLOG_INFO("ballpos {} {}", ball_pos.x(), ball_pos.y()); | |
| // SPDLOG_INFO("GOALX {}", field_dimensions_.goal_width()); |
|
|
||
| // SPDLOG_INFO("enemy {}", goalie_pos_x); | ||
|
|
||
| rj_geometry::Point goaliepose = {goalie_pos_x, goalie_pos_y}; | ||
| return goaliepose; |
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.
| // SPDLOG_INFO("enemy {}", goalie_pos_x); | |
| rj_geometry::Point goaliepose = {goalie_pos_x, goalie_pos_y}; | |
| return goaliepose; | |
| rj_geometry::Point goalie_pos{goalie_pos_x, goalie_pos_y}; | |
| return goalie_pos; |
To keep consistent with other uses
| (ball_pos.x() - enemy_shooter_location.x())) / | ||
| (ball_pos.y() - enemy_shooter_location.y()); | ||
|
|
||
| goalie_pos_x = std::clamp(goalie_pos_x, -1 * field_dimensions_.goal_width() / 2, |
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.
Use the field_dimensions_.our_goal_segment() to make this easier for someone to understand
| // SPDLOG_INFO("GOALX {}", field_dimensions_.goal_width()); | ||
|
|
||
| double goalie_pos_y = field_dimensions_.our_goal_loc().y(); | ||
| float goalie_pos_x = |
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.
Make this a double
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: use the built-in intersect functions for this
| State latest_state_ = IDLING; | ||
|
|
||
| rj_geometry::Point penalty_location(); | ||
| rj_geometry::Point penalty_location(WorldState* world_state); |
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: Consider passing in just the parts of the world_state you need instead of the entire thing
Description
Made goalie line up with the ball and the closest enemy robot to the ball
Associated / Resolved Issue
Resolves #86b6ubvaq or ClickUp card
Design Documents
Link
Steps to Test
Test Case 1
Setup penalty, set goalie state to penalty
Expected result:
Goalie should move automatically between ball and opposing kicker
Key Files to Review
Group 1
Group 2
Review Checklist
(Optional) Sub-issues (for drafts)
Note: if you find yourself breaking this PR into many smaller features, it may make sense to break up the PR into logical units based on these features.