Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f381c84
Added UI
jvogt23 Jun 2, 2024
c67d840
Partial copy of main_window changes
jvogt23 Jun 2, 2024
0340e89
partial message addition
jvogt23 Jun 2, 2024
c44ad84
OverridePosition.msg
jvogt23 Jun 25, 2024
5b17f1f
Merge branch 'ros2' into test-mode
jvogt23 Jun 25, 2024
dfa6e38
Set up working override positions, needs refactor
jvogt23 Jun 26, 2024
8d2c07b
Working position override created
jvogt23 Jul 1, 2024
0036b6e
Fix bug where changing the goalie num to a robot that is not auto doe…
jvogt23 Jul 1, 2024
907aa11
Fixes based on code review
jvogt23 Oct 15, 2024
9de5737
force test rerun
jvogt23 Nov 23, 2024
a501d4e
Fix Code Style On test-mode (#2264)
github-actions[bot] Nov 23, 2024
c84a54a
Resolving final conversations for review
jvogt23 Dec 9, 2024
2673072
Merge branch 'test-mode' of github.com:RoboJackets/robocup-software i…
jvogt23 Dec 9, 2024
cd5bffd
Fix Code Style On test-mode (#2315)
github-actions[bot] Dec 9, 2024
d86225e
Merge branch 'ros2' into test-mode
jvogt23 Jan 20, 2025
3175848
Removed LENGTH enum value
jvogt23 Jan 20, 2025
7e4c95d
asdf
jvogt23 Jan 20, 2025
bd5bff0
Update soccer/src/soccer/strategy/agent/position/robot_factory_positi…
jvogt23 Jan 27, 2025
a217a0e
Fix braces on if statement
jvogt23 Jan 27, 2025
d476111
Style fixes
jvogt23 Jan 27, 2025
5ca24d4
Made different topic for each robot id's overriding position
jvogt23 Jan 27, 2025
4030e05
FixStyle on changes
jvogt23 Jan 27, 2025
18ac7b9
Rename topic to fit convention
jvogt23 Jan 28, 2025
b150791
Fix naming conventions and comments
jvogt23 Jan 29, 2025
64cbc9d
Last thing
jvogt23 Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion rj_msgs/msg/OverridePosition.msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
# to set for that ID, based on the enum OverridingPositions,
# which is contained in soccer/src/soccer/strategy/agent/position/overriding_positions.hpp

uint32 robot_id
uint32 overriding_position
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
std::string node_name{"robot_factory_position_"};
_node = std::make_shared<rclcpp::Node>(node_name.append(std::to_string(robot_id_)));
override_play_sub_ = _node->create_subscription<rj_msgs::msg::OverridePosition>(
"override_position_for_robot", 1,
"override_position_for_robot_" + std::to_string(robot_id_), 1,
[this](const rj_msgs::msg::OverridePosition::SharedPtr msg) { test_play_callback(msg); });

Check warning on line 23 in soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

the const qualified parameter 'msg' is copied for each invocation; consider making it a reference
_executor.add_node(_node);
_executor_thread = std::thread([this]() { _executor.spin(); });
}
Expand Down Expand Up @@ -126,9 +126,11 @@
}
}

void RobotFactoryPosition::update_position() {

Check warning on line 129 in soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

function 'update_position' has cognitive complexity of 42 (threshold 25)
bool manual_position_set = check_for_position_override();
if (manual_position_set) return;
if (manual_position_set) {
return;
}

switch (current_play_state_.state()) {
case PlayState::State::Playing: {
Expand Down Expand Up @@ -350,11 +352,9 @@
}

void RobotFactoryPosition::test_play_callback(
const rj_msgs::msg::OverridePosition::SharedPtr message) {

Check warning on line 355 in soccer/src/soccer/strategy/agent/position/robot_factory_position.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

the const qualified parameter 'message' is copied for each invocation; consider making it a reference
if (message->robot_id == this->robot_id_) {
override_play_position_ =
static_cast<Strategy::OverridingPositions>(message->overriding_position);
}
override_play_position_ =
static_cast<Strategy::OverridingPositions>(message->overriding_position);
}

/**
Expand Down
20 changes: 11 additions & 9 deletions soccer/src/soccer/ui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ MainWindow::MainWindow(Processor* processor, bool has_external_ref, QWidget* par
_set_game_settings = _node->create_client<rj_msgs::srv::SetGameSettings>(
config_server::topics::kGameSettingsSrv);

override_play_pub_ =
_node->create_publisher<rj_msgs::msg::OverridePosition>("override_position_for_robot", 1);
// Publishers to signal when a manual position override is occurring
for (int i = 0; i < 16; ++i) {
override_play_pubs_.push_back(_node->create_publisher<rj_msgs::msg::OverridePosition>(
"override_position_for_robot_" + std::to_string(i), 1));
}

_executor.add_node(_node);
_executor_thread = std::thread([this]() { _executor.spin(); });
Expand Down Expand Up @@ -1050,13 +1053,14 @@ void MainWindow::on_actionUse_Multiple_Joysticks_toggled(bool value) {
void MainWindow::on_goalieID_currentIndexChanged(int value) {
update_cache(_game_settings.request_goalie_id, value - 1, &_game_settings_valid);
QString goalieNum = _ui.goalieID->currentText();
bool goalieNumIsInt{false};
bool goalieNumIsInt{false}; // TODO: Better type conversion? - QT5 Requires bool in its toInt.
int goalieInt = goalieNum.toInt(&goalieNumIsInt);
current_goalie_num_ = goalieInt;
if (goalieNumIsInt)
if (goalieNumIsInt) {
setGoalieDropdown(goalieInt);
else
} else {
setGoalieDropdown(-1);
}
}

////////////////
Expand Down Expand Up @@ -1277,21 +1281,19 @@ void MainWindow::on_robotPosition_15_currentIndexChanged(int value) {

void MainWindow::onResetButtonClicked(int robot) {
rj_msgs::msg::OverridePosition message;
message.robot_id = robot;
message.overriding_position = 0;

override_play_pub_->publish(message);
override_play_pubs_.at(robot)->publish(message);
position_reset_buttons.at(robot)->setEnabled(false);
robot_pos_selectors.at(robot)->setCurrentIndex(0);
}

void MainWindow::onPositionDropdownChanged(int robot, int position_number) {
if (current_goalie_num_ != robot) {
rj_msgs::msg::OverridePosition message;
message.robot_id = robot;
message.overriding_position = position_number;

override_play_pub_->publish(message);
override_play_pubs_.at(robot)->publish(message);
if (position_number != 0) {
position_reset_buttons.at(robot)->setEnabled(true);
} else {
Expand Down
2 changes: 1 addition & 1 deletion soccer/src/soccer/ui/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
void on_fastYellow_clicked();

// Robot Position Dropdowns and Reset Buttons
void on_robotPosition_0_currentIndexChanged(int value);

Check warning on line 168 in soccer/src/soccer/ui/main_window.hpp

View workflow job for this annotation

GitHub Actions / build-and-test

invalid case style for private method 'on_robotPosition_0_currentIndexChanged'
void on_robotPosition_1_currentIndexChanged(int value);

Check warning on line 169 in soccer/src/soccer/ui/main_window.hpp

View workflow job for this annotation

GitHub Actions / build-and-test

invalid case style for private method 'on_robotPosition_1_currentIndexChanged'
void on_robotPosition_2_currentIndexChanged(int value);

Check warning on line 170 in soccer/src/soccer/ui/main_window.hpp

View workflow job for this annotation

GitHub Actions / build-and-test

invalid case style for private method 'on_robotPosition_2_currentIndexChanged'
void on_robotPosition_3_currentIndexChanged(int value);
void on_robotPosition_4_currentIndexChanged(int value);
void on_robotPosition_5_currentIndexChanged(int value);
Expand Down Expand Up @@ -297,7 +297,7 @@
rclcpp::Node::SharedPtr _node;
rclcpp::Client<rj_msgs::srv::QuickCommands>::SharedPtr _quick_commands_srv;
rclcpp::Client<rj_msgs::srv::SetGameSettings>::SharedPtr _set_game_settings;
rclcpp::Publisher<rj_msgs::msg::OverridePosition>::SharedPtr override_play_pub_;
std::vector<rclcpp::Publisher<rj_msgs::msg::OverridePosition>::SharedPtr> override_play_pubs_{};
rclcpp::executors::SingleThreadedExecutor _executor;
std::thread _executor_thread;

Expand Down
Loading