Skip to content

Commit

Permalink
updated files for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Squid5678 committed Oct 15, 2023
1 parent f12fee6 commit ba95382
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
23 changes: 19 additions & 4 deletions soccer/src/soccer/strategy/agent/agent_action_client.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "agent_action_client.hpp"
#include <memory>

#include "rj_constants/topic_names.hpp"

Expand Down Expand Up @@ -75,7 +76,9 @@ AgentActionClient::AgentActionClient(int r_id)

if (r_id == 0) {
current_position_ = std::make_unique<Goalie>(r_id);
} else if (r_id == 1 || r_id == 3 || r_id == 5) {
} else if (r_id == 1) {
current_position_ = std::make_unique<Runner>(r_id);

Check failure on line 80 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
} else if (r_id == 3 || r_id == 5) {
current_position_ = std::make_unique<Defense>(r_id);
} else if (r_id == 2 || r_id == 4) {
current_position_ = std::make_unique<Offense>(r_id);
Expand Down Expand Up @@ -144,6 +147,8 @@ void AgentActionClient::get_task() {
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);

Check failure on line 150 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand All @@ -170,13 +175,13 @@ void AgentActionClient::update_position(const rj_msgs::msg::PositionAssignment::
next_position_ = std::make_unique<Goalie>(robot_id_);
break;
case 1:
next_position_ = std::make_unique<Defense>(robot_id_);
next_position_ = std::make_unique<Runner>(robot_id_);

Check failure on line 178 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
break;
case 2:
next_position_ = std::make_unique<Offense>(robot_id_);
break;
case 3:
next_position_ = std::make_unique<PenaltyPlayer>(robot_id_);
next_position_ = std::make_unique<Defense>(robot_id_);
break;
case 4:
next_position_ = std::make_unique<GoalKicker>(robot_id_);
Expand Down Expand Up @@ -223,6 +228,8 @@ void AgentActionClient::goal_response_callback(
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);

Check failure on line 231 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand All @@ -242,6 +249,8 @@ void AgentActionClient::feedback_callback(
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);

Check failure on line 252 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand All @@ -258,6 +267,8 @@ void AgentActionClient::result_callback(const GoalHandleRobotMove::WrappedResult
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);

Check failure on line 270 in soccer/src/soccer/strategy/agent/agent_action_client.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'Runner'
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand Down Expand Up @@ -289,6 +300,8 @@ void AgentActionClient::get_communication() {
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand Down Expand Up @@ -437,6 +450,8 @@ void AgentActionClient::check_communication_timeout() {
if (robot_id_ == 0) {
current_position_ = std::make_unique<Goalie>(robot_id_);
} else if (robot_id_ == 1) {
current_position_ = std::make_unique<Runner>(robot_id_);
} else if (robot_id_ == 2) {
current_position_ = std::make_unique<Defense>(robot_id_);
} else {
current_position_ = std::make_unique<Offense>(robot_id_);
Expand Down Expand Up @@ -475,4 +490,4 @@ void AgentActionClient::update_position_alive_robots() {
}
}

} // namespace strategy
} // namespace strategy
2 changes: 1 addition & 1 deletion soccer/src/soccer/strategy/agent/position/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Runner::State Runner::update_state() {
rj_geometry::Point robot_position = world_state->get_robot(true, robot_id_).pose.position();
switch (latest_state_) {
case IDLING:
initial_position_ = robot_position;
initi+al_position_ = robot_position;

Check failure on line 20 in soccer/src/soccer/strategy/agent/position/runner.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'initi'

Check failure on line 20 in soccer/src/soccer/strategy/agent/position/runner.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

use of undeclared identifier 'al_position_'
return RUN_FIRST_SIDE;
case RUN_FIRST_SIDE:
if ((robot_position.y() - initial_position_.y()) > kSideLength) {
Expand Down
4 changes: 2 additions & 2 deletions soccer/src/soccer/strategy/coach/coach_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void CoachNode::assign_positions_normal(std::array<uint32_t, kNumShells>& positi
positions[robot_id] = Positions::Goalie;
break;
case 1:
positions[robot_id] = Positions::Offense;
positions[robot_id] = Positions::Runner;
break;
case 2:
positions[robot_id] = Positions::Defense;
Expand Down Expand Up @@ -423,4 +423,4 @@ bool CoachNode::check_robot_alive(u_int8_t robot_id) {
}
}

} // namespace strategy
} // namespace strategy
7 changes: 4 additions & 3 deletions soccer/src/soccer/strategy/coach/coach_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "strategy/agent/position/defense.hpp"
#include "strategy/agent/position/goalie.hpp"
#include "strategy/agent/position/offense.hpp"
#include "strategy/agent/position/runner.hpp"
#include "strategy/agent/position/position.hpp"

namespace strategy {
Expand All @@ -35,12 +36,12 @@ enum MatchSituation {
in_play, // normal play
};

enum Positions { Goalie, Defense, Offense, PenaltyPlayer, GoalKicker };
enum Positions { Goalie, Defense, Runner, Offense, PenaltyPlayer, GoalKicker };

// These values are explicitly declared because they are the ints that are published to
// strategy/positions i.e. the same values as strategy::Positions
namespace OverridePosition {
enum OverridePosition { Goalie = 0, Defense = 1, Offense = 2, None = 3 };
enum OverridePosition { Goalie = 0, Defense = 1, Offense = 2, Runner = 3, None = 4 };
} // namespace OverridePosition

/**
Expand Down Expand Up @@ -163,4 +164,4 @@ class CoachNode : public rclcpp::Node {
bool check_robot_alive(u_int8_t robot_id);
};

} // namespace strategy
} // namespace strategy

0 comments on commit ba95382

Please sign in to comment.