Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1ce04f9
Improved logic past original state using FSMs
Muxite Nov 15, 2025
ce5d32e
Merge branch 'master' of github.com:Muxite/Thunderbots-Muk into kicko…
Muxite Nov 15, 2025
1be72c4
testing almost done except mystery halt issue
Muxite Nov 15, 2025
197d7ff
mystery halt issue persists, adjusted fsm
Muxite Nov 22, 2025
f200673
Merge remote-tracking branch 'upstream/master' into kickoff_fsm
Muxite Jan 24, 2026
28d107a
post merge checking
Muxite Jan 24, 2026
9a304b4
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jan 24, 2026
1be1c15
temporary
Muxite Feb 22, 2026
fcaaa97
Merge branch 'kickoff_fsm' of github.com:Muxite/Thunderbots-Muk into …
Muxite Feb 22, 2026
3734594
Merge branch 'master' into kickoff_fsm
Muxite Feb 22, 2026
637c516
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 22, 2026
01f1b49
removed merge conflicts
Muxite Feb 22, 2026
ca0d2d3
merging
Muxite Feb 22, 2026
46a7613
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 22, 2026
20571a5
it works, testing doesnt tho
Muxite Feb 22, 2026
9aced51
works
Muxite Feb 22, 2026
be6267c
Merge branch 'kickoff_fsm' of github.com:Muxite/Thunderbots-Muk into …
Muxite Feb 22, 2026
fd7d6b5
removed shooting
Muxite Mar 7, 2026
7786676
merged
Muxite Mar 7, 2026
b9805f5
updated docs
Muxite Mar 7, 2026
2bc6999
linted
Muxite Mar 7, 2026
059cff1
BUILD fix
Muxite Mar 7, 2026
e01a895
added javadoc
Muxite Mar 7, 2026
3fa2da8
remove cc test
Muxite Mar 8, 2026
213d1c6
Comment out cc test
Muxite Mar 8, 2026
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
28 changes: 28 additions & 0 deletions docs/fsm-diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ Terminate:::terminate --> Terminate:::terminate : <i>updateStop</i>

```

## [KickoffEnemyPlayFSM](/src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_fsm.h)

```mermaid

stateDiagram-v2
classDef terminate fill:white,color:black,font-weight:bold
direction LR
[*] --> SetupState
SetupState --> SetupState : <i>kickoff</i>

```

## [KickoffFriendlyPlayFSM](/src/software/ai/hl/stp/play/kickoff_friendly/kickoff_friendly_play_fsm.h)

```mermaid

stateDiagram-v2
classDef terminate fill:white,color:black,font-weight:bold
direction LR
[*] --> SetupState
SetupState --> SetupState : [!isSetupDone]\n<i>setupKickoff</i>
SetupState --> ChipState : [isSetupDone]
ChipState --> ChipState : [!isPlaying]\n<i>chipBall</i>
ChipState --> Terminate:::terminate : [isPlaying]
Terminate:::terminate --> Terminate:::terminate

```

## [OffensePlayFSM](/src/software/ai/hl/stp/play/offense/offense_play_fsm.h)

```mermaid
Expand Down
103 changes: 18 additions & 85 deletions src/software/ai/hl/stp/play/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,6 @@ package(default_visibility = ["//visibility:public"])
# "factory" design pattern to work are linked in
# https://www.bfilipek.com/2018/02/static-vars-static-lib.html

cc_library(
name = "kickoff_enemy_play",
srcs = ["kickoff_enemy_play.cpp"],
hdrs = ["kickoff_enemy_play.h"],
deps = [
":play",
"//shared:constants",
"//software/ai/evaluation:enemy_threat",
"//software/ai/evaluation:possession",
"//software/ai/hl/stp/tactic/goalie:goalie_tactic",
"//software/ai/hl/stp/tactic/move:move_tactic",
"//software/ai/hl/stp/tactic/shadow_enemy:shadow_enemy_tactic",
"//software/logger",
"//software/util/generic_factory",
],
alwayslink = True,
)

cc_library(
name = "kickoff_friendly_play",
srcs = ["kickoff_friendly_play.cpp"],
hdrs = ["kickoff_friendly_play.h"],
deps = [
":play",
"//shared:constants",
"//software/ai/evaluation:enemy_threat",
"//software/ai/hl/stp/tactic/chip:chip_tactic",
"//software/ai/hl/stp/tactic/move:move_tactic",
"//software/logger",
"//software/util/generic_factory",
],
alwayslink = True,
)

cc_library(
name = "shoot_or_chip_play",
srcs = ["shoot_or_chip_play.cpp"],
Expand Down Expand Up @@ -106,8 +72,6 @@ cc_library(
cc_library(
name = "all_plays",
deps = [
":kickoff_enemy_play",
":kickoff_friendly_play",
":shoot_or_chip_play",
":stop_play",
"//software/ai/hl/stp/play/ball_placement:ball_placement_play",
Expand All @@ -118,62 +82,15 @@ cc_library(
"//software/ai/hl/stp/play/example:example_play",
"//software/ai/hl/stp/play/free_kick:free_kick_play",
"//software/ai/hl/stp/play/halt_play",
"//software/ai/hl/stp/play/kickoff_enemy:kickoff_enemy_play",
"//software/ai/hl/stp/play/kickoff_friendly:kickoff_friendly_play",
"//software/ai/hl/stp/play/offense:offense_play",
"//software/ai/hl/stp/play/penalty_kick:penalty_kick_play",
"//software/ai/hl/stp/play/penalty_kick_enemy:penalty_kick_enemy_play",
"//software/ai/hl/stp/play/shoot_or_pass:shoot_or_pass_play",
],
)

cc_test(
name = "kickoff_friendly_play_cpp_test",
srcs = ["kickoff_friendly_play_test.cpp"],
deps = [
"//shared/test_util:tbots_gtest_main",
"//software/ai/hl/stp/play:kickoff_friendly_play",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/non_terminating_validation_functions",
"//software/simulated_tests/terminating_validation_functions",
"//software/simulated_tests/validation:validation_function",
"//software/test_util",
"//software/time:duration",
"//software/world",
],
)

cc_test(
name = "kickoff_enemy_play_cpp_test",
srcs = ["kickoff_enemy_play_test.cpp"],
deps = [
"//shared/test_util:tbots_gtest_main",
"//software/ai/hl/stp/play:kickoff_enemy_play",
"//software/geom/algorithms",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/non_terminating_validation_functions",
"//software/simulated_tests/terminating_validation_functions",
"//software/simulated_tests/validation:validation_function",
"//software/test_util",
"//software/time:duration",
"//software/world",
],
)

py_test(
name = "kickoff_play_test",
srcs = [
"kickoff_play_test.py",
],
# TODO (#2619) Remove tag to run in parallel
tags = [
"exclusive",
],
deps = [
"//software:conftest",
"//software/simulated_tests:validation",
requirement("pytest"),
],
)

cc_test(
name = "stop_play_test",
srcs = ["stop_play_test.cpp"],
Expand Down Expand Up @@ -274,3 +191,19 @@ py_test(
requirement("pytest"),
],
)

py_test(
name = "kickoff_play_test",
srcs = [
"kickoff_play_test.py",
],
# TODO (#2619) Remove tag to run in parallel
tags = [
"exclusive",
],
deps = [
"//software:conftest",
"//software/simulated_tests:validation",
requirement("pytest"),
],
)
44 changes: 44 additions & 0 deletions src/software/ai/hl/stp/play/kickoff_enemy/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load("@simulated_tests_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//visibility:public"])

cc_library(
name = "kickoff_enemy_play",
srcs = [
"kickoff_enemy_play.cpp",
"kickoff_enemy_play_fsm.cpp",
],
hdrs = [
"kickoff_enemy_play.h",
"kickoff_enemy_play_fsm.h",
],
deps = [
"//shared:constants",
"//software/ai/evaluation:enemy_threat",
"//software/ai/evaluation:possession",
"//software/ai/hl/stp/play",
"//software/ai/hl/stp/tactic/goalie:goalie_tactic",
"//software/ai/hl/stp/tactic/move:move_tactic",
"//software/ai/hl/stp/tactic/shadow_enemy:shadow_enemy_tactic",
"//software/logger",
"//software/util/generic_factory",
],
alwayslink = True,
)

# cc_test(
# name = "kickoff_enemy_play_cpp_test",
# srcs = ["kickoff_enemy_play_test.cpp"],
# deps = [
# "//shared/test_util:tbots_gtest_main",
# "//software/ai/hl/stp/play:kickoff_enemy_play",
# "//software/geom/algorithms",
# "//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
# "//software/simulated_tests/non_terminating_validation_functions",
# "//software/simulated_tests/terminating_validation_functions",
# "//software/simulated_tests/validation:validation_function",
# "//software/test_util",
# "//software/time:duration",
# "//software/world",
# ],
#)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play.h"

#include "proto/parameters.pb.h"
#include "shared/constants.h"
#include "software/util/generic_factory/generic_factory.h"

KickoffEnemyPlay::KickoffEnemyPlay(
std::shared_ptr<const TbotsProto::AiConfig> ai_config_ptr)
: PlayBase<KickoffEnemyPlayFSM>(ai_config_ptr, false)
{
}

void KickoffEnemyPlay::getNextTactics(TacticCoroutine::push_type &yield,
const WorldPtr &world_ptr)
{
// Does not get called.
while (true)
{
yield({{}});
}
}

void KickoffEnemyPlay::updateTactics(const PlayUpdate &play_update)
{
fsm.process_event(KickoffEnemyPlayFSM::Update(control_params, play_update));
}

std::vector<std::string> KickoffEnemyPlay::getState()
{
std::vector<std::string> state;
state.emplace_back(objectTypeName(*this) + " - " + getCurrentFullStateName(fsm));
return state;
}


// Register this play in the genericFactory
static TGenericFactory<std::string, Play, KickoffEnemyPlay,
std::shared_ptr<const TbotsProto::AiConfig>>
factory;
27 changes: 27 additions & 0 deletions src/software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include "proto/parameters.pb.h"
#include "software/ai/hl/stp/play/kickoff_enemy/kickoff_enemy_play_fsm.h"
#include "software/ai/hl/stp/play/play.h"
#include "software/ai/hl/stp/play/play_base.hpp"
#include "software/ai/hl/stp/play/play_fsm.hpp"

/**
* A play that runs when its currently the enemy kick off.
*/

class KickoffEnemyPlay : public PlayBase<KickoffEnemyPlayFSM>
{
public:
/**
* Creates an enemy kickoff play
*
* @param ai_config_ptr the play config for this play
*/
explicit KickoffEnemyPlay(std::shared_ptr<const TbotsProto::AiConfig> ai_config_ptr);

void getNextTactics(TacticCoroutine::push_type &yield,
const WorldPtr &world_ptr) override;
void updateTactics(const PlayUpdate &play_update) override;
std::vector<std::string> getState() override;
};
Loading