forked from UBC-Thunderbots/Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_play_fsm.h
More file actions
55 lines (43 loc) · 1.28 KB
/
example_play_fsm.h
File metadata and controls
55 lines (43 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "proto/parameters.pb.h"
#include "shared/constants.h"
#include "software/ai/hl/stp/play/play.h"
#include "software/ai/hl/stp/tactic/move/move_tactic.h"
#include "software/logger/logger.h"
/**
* An example play that moves the robots in a circle around the ball
*/
struct ExamplePlayFSM : PlayFSM<ExamplePlayFSM>
{
/**
* Control parameters for Example Play
*/
struct ControlParams
{
};
class MoveState;
/**
* Creates an example play FSM
*
* @param ai_config_ptr shared pointer to ai_config
*/
explicit ExamplePlayFSM(std::shared_ptr<const TbotsProto::AiConfig> ai_config_ptr);
/**
* Action that moves the robots to certain positions around the ball
*
* @param event the ExamplePlayFSM Update event
*/
void moveToPosition(const Update& event);
auto operator()()
{
using namespace boost::sml;
DEFINE_SML_STATE(MoveState)
DEFINE_SML_EVENT(Update)
DEFINE_SML_ACTION(moveToPosition)
return make_transition_table(
// src_state + event [guard] / action = dest_state
*MoveState_S + Update_E / moveToPosition_A = MoveState_S, X + Update_E = X);
}
private:
std::vector<std::shared_ptr<MoveTactic>> move_tactics;
};