Skip to content

Commit

Permalink
Internal ref add penalty kick (#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvogt23 authored Feb 26, 2025
1 parent 0729903 commit 9981233
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 24 deletions.
2 changes: 1 addition & 1 deletion soccer/src/soccer/game_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct PlayState {
}
static PlayState playing() { return PlayState(State::Playing, Restart::None, false, {}); }
static PlayState penalty_playing(bool ours) {
return PlayState(State::PenaltyPlaying, Restart::Penalty, ours, {});
return PlayState(State::PenaltyPlaying, Restart::None, ours, {});
}

bool operator==(const PlayState& other) const {
Expand Down
22 changes: 18 additions & 4 deletions soccer/src/soccer/ui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,15 @@ void MainWindow::on_fastReady_clicked() {
void MainWindow::on_fastForceStart_clicked() { send_quick_command(PlayState::playing()); }

void MainWindow::on_fastKickoffBlue_clicked() {
send_quick_command(PlayState::setup_kickoff(context_->blue_team));
queued_command_ = PlayState::ready_kickoff(context_->blue_team);
PlayState setup_kickoff_state = PlayState::setup_kickoff(context_->blue_team);
send_quick_command(setup_kickoff_state);
queued_command_ = setup_kickoff_state.advanced_from_normal_start();
}

void MainWindow::on_fastKickoffYellow_clicked() {
send_quick_command(PlayState::setup_kickoff(!context_->blue_team));
queued_command_ = PlayState::ready_kickoff(context_->blue_team);
PlayState setup_kickoff_state = PlayState::setup_kickoff(!context_->blue_team);
send_quick_command(setup_kickoff_state);
queued_command_ = setup_kickoff_state.advanced_from_normal_start();
}

void MainWindow::on_fastBlue_clicked() {
Expand All @@ -1158,6 +1160,18 @@ void MainWindow::on_fastYellow_clicked() {
send_quick_command(PlayState::ready_free_kick(!context_->blue_team));
}

void MainWindow::on_fastPenaltyBlue_clicked() {
PlayState setup_penalty_state = PlayState::setup_penalty(context_->blue_team);
send_quick_command(setup_penalty_state);
queued_command_ = setup_penalty_state.advanced_from_normal_start();
}

void MainWindow::on_fastPenaltyYellow_clicked() {
PlayState setup_penalty_state = PlayState::setup_penalty(!context_->blue_team);
send_quick_command(setup_penalty_state);
queued_command_ = setup_penalty_state.advanced_from_normal_start();
}

bool MainWindow::live() { return !_playbackRate; }
void MainWindow::updateDebugLayers(const LogFrame& frame) {
// Check if any debug layers have been added
Expand Down
2 changes: 2 additions & 0 deletions soccer/src/soccer/ui/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ private Q_SLOTS:
void on_fastKickoffYellow_clicked();
void on_fastBlue_clicked();
void on_fastYellow_clicked();
void on_fastPenaltyBlue_clicked();
void on_fastPenaltyYellow_clicked();

// Robot Position Dropdowns and Reset Buttons
void on_robotPosition_0_currentIndexChanged(int value);
Expand Down
62 changes: 43 additions & 19 deletions soccer/src/soccer/ui/qt/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,47 @@
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="Penalties">
<item>
<widget class="QPushButton" name="fastPenaltyBlue">
<property name="icon">
<iconset resource="main_icons.qrc">
<normaloff>:/icons/penalty_blue.svg</normaloff>:/icons/penalty_blue.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fastPenaltyYellow">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="main_icons.qrc">
<normaloff>:/icons/penalty_yellow.svg</normaloff>:/icons/penalty_yellow.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="Kickoffs">
<item>
Expand Down Expand Up @@ -1813,7 +1854,6 @@
</item>
</layout>
</widget>

<widget class="QWidget" name="joystickTab">
<attribute name="title">
<string>Joystick</string>
Expand Down Expand Up @@ -1975,7 +2015,7 @@
<height>671</height>
</rect>
</property>
<layout class="QGridLayout" name="positions_gridLayout" rowstretch="0" columnstretch="0,0,0,0" rowminimumheight="0">
<layout class="QGridLayout" name="positions_gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0" rowminimumheight="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>11</number>
</property>
Expand Down Expand Up @@ -2058,7 +2098,6 @@
</property>
</widget>
</item>

<item row="1" column="1">
<widget class="QLabel" name="positionsLabel_1">
<property name="text">
Expand Down Expand Up @@ -2129,7 +2168,6 @@
</property>
</widget>
</item>

<item row="2" column="1">
<widget class="QLabel" name="positionsLabel_2">
<property name="text">
Expand Down Expand Up @@ -2200,7 +2238,6 @@
</property>
</widget>
</item>

<item row="3" column="1">
<widget class="QLabel" name="positionsLabel_3">
<property name="text">
Expand Down Expand Up @@ -2271,7 +2308,6 @@
</property>
</widget>
</item>

<item row="4" column="1">
<widget class="QLabel" name="positionsLabel_4">
<property name="text">
Expand Down Expand Up @@ -2342,7 +2378,6 @@
</property>
</widget>
</item>

<item row="5" column="1">
<widget class="QLabel" name="positionsLabel_5">
<property name="text">
Expand Down Expand Up @@ -2413,7 +2448,6 @@
</property>
</widget>
</item>

<item row="6" column="1">
<widget class="QLabel" name="positionsLabel_6">
<property name="text">
Expand Down Expand Up @@ -2484,7 +2518,6 @@
</property>
</widget>
</item>

<item row="7" column="1">
<widget class="QLabel" name="positionsLabel_7">
<property name="text">
Expand Down Expand Up @@ -2555,7 +2588,6 @@
</property>
</widget>
</item>

<item row="8" column="1">
<widget class="QLabel" name="positionsLabel_8">
<property name="text">
Expand Down Expand Up @@ -2626,7 +2658,6 @@
</property>
</widget>
</item>

<item row="9" column="1">
<widget class="QLabel" name="positionsLabel_9">
<property name="text">
Expand Down Expand Up @@ -2697,7 +2728,6 @@
</property>
</widget>
</item>

<item row="10" column="1">
<widget class="QLabel" name="positionsLabel_10">
<property name="text">
Expand Down Expand Up @@ -2768,7 +2798,6 @@
</property>
</widget>
</item>

<item row="11" column="1">
<widget class="QLabel" name="positionsLabel_11">
<property name="text">
Expand Down Expand Up @@ -2839,7 +2868,6 @@
</property>
</widget>
</item>

<item row="12" column="1">
<widget class="QLabel" name="positionsLabel_12">
<property name="text">
Expand Down Expand Up @@ -2910,7 +2938,6 @@
</property>
</widget>
</item>

<item row="13" column="1">
<widget class="QLabel" name="positionsLabel_13">
<property name="text">
Expand Down Expand Up @@ -2981,7 +3008,6 @@
</property>
</widget>
</item>

<item row="14" column="1">
<widget class="QLabel" name="positionsLabel_14">
<property name="text">
Expand Down Expand Up @@ -3052,7 +3078,6 @@
</property>
</widget>
</item>

<item row="15" column="1">
<widget class="QLabel" name="positionsLabel_15">
<property name="text">
Expand Down Expand Up @@ -3123,7 +3148,6 @@
</property>
</widget>
</item>

</layout>
</widget>
</widget>
Expand All @@ -3140,7 +3164,7 @@
<x>0</x>
<y>0</y>
<width>1331</width>
<height>24</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menu_View">
Expand Down
2 changes: 2 additions & 0 deletions soccer/src/soccer/ui/qt/main_icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<file>force_start.svg</file>
<file>kickoff_blue.svg</file>
<file>kickoff_yellow.svg</file>
<file>penalty_blue.svg</file>
<file>penalty_yellow.svg</file>
<file>direct_blue.svg</file>
<file>direct_yellow.svg</file>
<file>indirect_blue.svg</file>
Expand Down
80 changes: 80 additions & 0 deletions soccer/src/soccer/ui/qt/penalty_blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9981233

Please sign in to comment.