-
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
Alive Robots in robot_factory_position #2212
Conversation
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 also need to update the position.cpp
implementation of alive robots. It currently searches the list for the robot id, but it should instead check if alive_robots[robot_id] == true
or something like that, because you changed it from a vector to an array
soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp
Outdated
Show resolved
Hide resolved
soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp
Outdated
Show resolved
Hide resolved
soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp
Outdated
Show resolved
Hide resolved
soccer/src/soccer/strategy/agent/position/robot_factory_position.hpp
Outdated
Show resolved
Hide resolved
2dee808
to
49ea2f7
Compare
…e alive_robots_. Modified type of alive_robots_ almost everywhere to be the std::array<bool, kNumShells> rather than the std::vector<int>
… the new array parameter, made code cleaner for loop in robot_factory_position
…ategy/alive_robots) for consistency
49ea2f7
to
1f8382f
Compare
@@ -94,18 +94,19 @@ SimRadio::SimRadio(bool blue_team) | |||
ip::udp::endpoint(address_, blue_team_ ? kSimBlueCommandPort : kSimYellowCommandPort); | |||
sim_control_endpoint_ = ip::udp::endpoint(address_, kSimCommandPort); | |||
|
|||
// assume robots 0-6 are always alive in sim |
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.
// assume robots 0-6 are always alive in sim | |
// assume robots 0-5 are always alive in sim |
@@ -49,29 +50,29 @@ std::optional<RobotIntent> RobotFactoryPosition::get_task(WorldState& world_stat | |||
// Assigning new position | |||
// Checking whether we have possesion or if the ball is on their half (using 1.99 to avoid |
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.
// Checking whether we have possesion or if the ball is on their half (using 1.99 to avoid | |
// Checking whether we have possesion or if the ball is on their half |
@@ -49,29 +50,29 @@ std::optional<RobotIntent> RobotFactoryPosition::get_task(WorldState& world_stat | |||
// Assigning new position | |||
// Checking whether we have possesion or if the ball is on their half (using 1.99 to avoid | |||
// rounding issues on midline) |
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.
// rounding issues on midline) |
@@ -6,7 +6,6 @@ RobotFactoryPosition::RobotFactoryPosition(int r_id) : Position(r_id, "RobotFact | |||
if (robot_id_ == 0) { |
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 (robot_id_ == 0) { | |
if (robot_id_ == goalie_id_) { |
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.
Goalie is never reassigned inside get_task(), so it is important to do this here
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.
good catch
@@ -16,7 +15,7 @@ RobotFactoryPosition::RobotFactoryPosition(int r_id) : Position(r_id, "RobotFact | |||
std::optional<RobotIntent> RobotFactoryPosition::get_task(WorldState& world_state, | |||
FieldDimensions& field_dimensions) { | |||
// If keeper, make no changes | |||
if (robot_id_ == 0) { | |||
if (robot_id_ == goalie_id_) { |
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 will need to double-check with Sid about this, but if the goalie can change, we need to add functionality here to update the goalie if it is not assigned correctly.
if (Position::our_possession_ || | ||
world_state.ball.position.y() > field_dimensions.length() / 1.99) { | ||
if (our_possession_ || | ||
world_state.ball.position.y() > field_dimensions.center_field_loc().y() - kBallDiameter) { | ||
// Offensive mode | ||
// Closest 2 robots on defense, rest on offense | ||
if (i <= 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.
While we're working on this file, could we change the i variable name to something more descriptive? Perhaps robot_y_index
?
Variable defined on line 42 but it's collapsed so GitHub won't let me comment there
Merged into kicker-picker see #2200 |
Changed a few things so that robot_factory_position and a couple other classes use the alive_robots_ array properly. Had to change the type of alive_robots_ from vector to array in a few classes.
In the loop in robot_factory_position, there is a variable j that keeps track of the count and the for each loop gets all of the booleans from alive_robots_ and uses that value in whether to execute the code in the loop body or not.