-
Notifications
You must be signed in to change notification settings - Fork 186
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
Check out the wall chucker #2325
base: ros2
Are you sure you want to change the base?
Changes from all commits
965ccdb
1a425b0
4550964
83debe9
b700651
cc171c8
6b6b676
10d0969
855886e
f3cda3e
b8978ba
86d123a
fc123cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,7 +268,6 @@ std::optional<RobotIntent> Offense::state_to_task(RobotIntent intent) { | |
auto collect_cmd = planning::MotionCommand{"collect"}; | ||
intent.motion_command = collect_cmd; | ||
intent.dribbler_speed = 255.0; | ||
// } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. crazy find. looks correct, but how was the previous code compiling? |
||
|
||
return intent; | ||
} | ||
|
@@ -521,48 +520,6 @@ double Offense::distance_from_their_robots(rj_geometry::Point tail, rj_geometry: | |
return min_angle; | ||
} | ||
|
||
bool Offense::can_steal_ball() const { | ||
// Ball in red zone or not | ||
if (ball_in_red()) { | ||
return false; | ||
} | ||
// Ball location | ||
rj_geometry::Point ball_position = this->last_world_state_->ball.position; | ||
|
||
// Our robot is closest robot to ball | ||
bool closest = true; | ||
|
||
auto current_pos = last_world_state_->get_robot(true, robot_id_).pose.position(); | ||
|
||
auto our_dist = (current_pos - ball_position).mag(); | ||
for (auto enemy : this->last_world_state_->their_robots) { | ||
auto dist = (enemy.pose.position() - ball_position).mag(); | ||
if (dist < our_dist) { | ||
closest = false; | ||
break; | ||
} | ||
} | ||
|
||
if (!closest) { | ||
return closest; | ||
} | ||
|
||
for (auto pal : this->last_world_state_->our_robots) { | ||
// if (pal.robot_id_ == robot_id_) { | ||
// continue; | ||
// } | ||
auto dist = (pal.pose.position() - ball_position).mag(); | ||
if (dist < our_dist) { | ||
closest = false; | ||
break; | ||
} | ||
} | ||
|
||
return closest; | ||
|
||
// return distance_to_ball() < kStealBallRadius; | ||
} | ||
|
||
rj_geometry::Point Offense::calculate_best_shot() const { | ||
// Goal location | ||
rj_geometry::Point their_goal_pos = field_dimensions_.their_goal_loc(); | ||
|
@@ -587,13 +544,6 @@ rj_geometry::Point Offense::calculate_best_shot() const { | |
return best_shot; | ||
} | ||
|
||
// Checks whether ball is out of range for stealing/receiving | ||
bool Offense::ball_in_red() const { | ||
auto& ball_pos = last_world_state_->ball.position; | ||
return (field_dimensions_.our_defense_area().contains_point(ball_pos) || | ||
field_dimensions_.their_defense_area().contains_point(ball_pos) || | ||
!field_dimensions_.field_rect().contains_point(ball_pos)); | ||
} | ||
void Offense::broadcast_seeker_request(rj_geometry::Point seeking_point, bool adding) { | ||
communication::SeekerRequest seeker_request{}; | ||
communication::generate_uid(seeker_request); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,10 +210,10 @@ class Offense : public Position { | |
*/ | ||
double distance_from_their_robots(rj_geometry::Point tail, rj_geometry::Point head) const; | ||
|
||
/** | ||
* @brief Check if this agent could easily steal the ball | ||
*/ | ||
bool can_steal_ball() const; | ||
// /** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's get rid of these entirely if we're elevating to Position (rather than commenting out) |
||
// * @brief Check if this agent could easily steal the ball | ||
// */ | ||
// bool can_steal_ball() const; | ||
|
||
/** | ||
* @return distance from this agent to ball | ||
|
@@ -233,10 +233,10 @@ class Offense : public Position { | |
*/ | ||
rj_geometry::Point calculate_best_shot() const; | ||
|
||
/** | ||
* @return whether the ball is in an area that non-goalies cannot reach. | ||
*/ | ||
bool ball_in_red() const; | ||
// /** | ||
// * @return whether the ball is in an area that non-goalies cannot reach. | ||
// */ | ||
// bool ball_in_red() const; | ||
|
||
void broadcast_seeker_request(rj_geometry::Point seeking_point, bool adding); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,4 +286,54 @@ communication::Acknowledge Position::acknowledge_ball_in_transit( | |
return acknowledge_response; | ||
} | ||
|
||
// Checks whether ball is out of range for stealing/receiving | ||
bool Position::ball_in_red() const { | ||
auto& ball_pos = last_world_state_->ball.position; | ||
return (field_dimensions_.our_defense_area().contains_point(ball_pos) || | ||
field_dimensions_.their_defense_area().contains_point(ball_pos) || | ||
!field_dimensions_.field_rect().contains_point(ball_pos)); | ||
} | ||
|
||
bool Position::can_steal_ball() const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see now, they were elevated to superclass? then we should definitely delete from subclass. |
||
// Ball in red zone or not | ||
if (ball_in_red()) { | ||
return false; | ||
} | ||
// Ball location | ||
rj_geometry::Point ball_position = this->last_world_state_->ball.position; | ||
|
||
// Our robot is closest robot to ball | ||
bool closest = true; | ||
|
||
auto current_pos = last_world_state_->get_robot(true, robot_id_).pose.position(); | ||
|
||
auto our_dist = (current_pos - ball_position).mag(); | ||
for (auto enemy : this->last_world_state_->their_robots) { | ||
auto dist = (enemy.pose.position() - ball_position).mag(); | ||
if (dist < our_dist) { | ||
closest = false; | ||
break; | ||
} | ||
} | ||
|
||
if (!closest) { | ||
return closest; | ||
} | ||
|
||
for (auto pal : this->last_world_state_->our_robots) { | ||
// if (pal.robot_id_ == robot_id_) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be commented out? Do we want to include ourselves in this calculation? |
||
// continue; | ||
// } | ||
auto dist = (pal.pose.position() - ball_position).mag(); | ||
if (dist < our_dist) { | ||
closest = false; | ||
break; | ||
} | ||
} | ||
|
||
return closest; | ||
|
||
// return distance_to_ball() < kStealBallRadius; | ||
} | ||
|
||
} // namespace strategy |
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.
we probably want
break
here and in the below case