Thunderbots Project
Loading...
Searching...
No Matches
play_fsm.h
1#pragma once
2
3#include "software/ai/hl/stp/tactic/tactic.h"
4#include "software/ai/passing/pass_with_rating.h"
5#include "software/util/sml_fsm/sml_fsm.h"
6#include "software/world/world.h"
7
8using TacticVector = std::vector<std::shared_ptr<Tactic>>;
9using PriorityTacticVector = std::vector<TacticVector>;
10using ConstTacticVector = std::vector<std::shared_ptr<const Tactic>>;
11using ConstPriorityTacticVector = std::vector<ConstTacticVector>;
12
13// Struct used to communicate between plays
15{
16 std::optional<PassWithRating> last_committed_pass;
17};
18
19// This callback is used to return tactics from the fsm
20using SetTacticsCallback = std::function<void(PriorityTacticVector)>;
21using SetInterPlayCommunicationCallback = std::function<void(InterPlayCommunication)>;
22
23// The play update struct is used to update plays and set the new tactics
25{
26 PlayUpdate(const WorldPtr& world_ptr, unsigned int num_tactics,
27 const SetTacticsCallback& set_tactics_fun,
28 const InterPlayCommunication& inter_play_communication,
29 const SetInterPlayCommunicationCallback& set_inter_play_communication_fun)
30 : world_ptr(world_ptr),
31 num_tactics(num_tactics),
32 set_tactics(set_tactics_fun),
33 inter_play_communication(inter_play_communication),
34 set_inter_play_communication_fun(set_inter_play_communication_fun)
35 {
36 }
37 // updated world
38 WorldPtr world_ptr;
39 // Number of tactics to set
40 unsigned int num_tactics;
41 // callback to return the next tactics
42 SetTacticsCallback set_tactics;
43 // inter-play communication
44 InterPlayCommunication inter_play_communication;
45 // callback to return inter-play communication
46 SetInterPlayCommunicationCallback set_inter_play_communication_fun;
47};
48
56#define DEFINE_PLAY_UPDATE_STRUCT_WITH_CONTROL_AND_COMMON_PARAMS \
57 struct Update \
58 { \
59 Update(const ControlParams& control_params, const PlayUpdate& common) \
60 : control_params(control_params), common(common) \
61 { \
62 } \
63 ControlParams control_params; \
64 PlayUpdate common; \
65 };
Definition play_fsm.h:15
Definition play_fsm.h:25