Fawkes API Fawkes Development Version
|
GameStateInterface Fawkes BlackBoard Interface. More...
#include <>>
Classes | |
struct | GameStateInterface_data_t |
Internal data storage, do NOT modify! | |
class | SetKickoffMessage |
SetKickoffMessage Fawkes BlackBoard Interface Message. More... | |
class | SetStateTeamMessage |
SetStateTeamMessage Fawkes BlackBoard Interface Message. More... | |
class | SetTeamColorMessage |
SetTeamColorMessage Fawkes BlackBoard Interface Message. More... | |
Public Types | |
enum | if_gamestate_team_t { TEAM_NONE, TEAM_CYAN, TEAM_MAGENTA, TEAM_BOTH } |
Enumeration defining the different teams. More... | |
enum | if_gamestate_goalcolor_t { GOAL_BLUE, GOAL_YELLOW } |
Enumeration defining the different teams. More... | |
enum | if_gamestate_half_t { HALF_FIRST, HALF_SECOND } |
Enumeration defining the different teams. More... | |
enum | if_gamestate_role_t { ROLE_GOALIE, ROLE_DEFENDER, ROLE_MID_LEFT, ROLE_MID_RIGHT, ROLE_ATTACKER } |
Enumeration defining the different robot roles. More... | |
Public Member Functions | |
const char * | tostring_if_gamestate_team_t (if_gamestate_team_t value) const |
Convert if_gamestate_team_t constant to string. | |
const char * | tostring_if_gamestate_goalcolor_t (if_gamestate_goalcolor_t value) const |
Convert if_gamestate_goalcolor_t constant to string. | |
const char * | tostring_if_gamestate_half_t (if_gamestate_half_t value) const |
Convert if_gamestate_half_t constant to string. | |
const char * | tostring_if_gamestate_role_t (if_gamestate_role_t value) const |
Convert if_gamestate_role_t constant to string. | |
virtual bool | message_valid (const Message *message) const |
Check if message is valid and can be enqueued. | |
uint32_t | game_state () const |
Get game_state value. | |
void | set_game_state (const uint32_t new_game_state) |
Set game_state value. | |
size_t | maxlenof_game_state () const |
Get maximum length of game_state value. | |
if_gamestate_team_t | state_team () const |
Get state_team value. | |
void | set_state_team (const if_gamestate_team_t new_state_team) |
Set state_team value. | |
size_t | maxlenof_state_team () const |
Get maximum length of state_team value. | |
if_gamestate_team_t | our_team () const |
Get our_team value. | |
void | set_our_team (const if_gamestate_team_t new_our_team) |
Set our_team value. | |
size_t | maxlenof_our_team () const |
Get maximum length of our_team value. | |
if_gamestate_goalcolor_t | our_goal_color () const |
Get our_goal_color value. | |
void | set_our_goal_color (const if_gamestate_goalcolor_t new_our_goal_color) |
Set our_goal_color value. | |
size_t | maxlenof_our_goal_color () const |
Get maximum length of our_goal_color value. | |
if_gamestate_half_t | half () const |
Get half value. | |
void | set_half (const if_gamestate_half_t new_half) |
Set half value. | |
size_t | maxlenof_half () const |
Get maximum length of half value. | |
bool | is_kickoff () const |
Get kickoff value. | |
void | set_kickoff (const bool new_kickoff) |
Set kickoff value. | |
size_t | maxlenof_kickoff () const |
Get maximum length of kickoff value. | |
if_gamestate_role_t | role () const |
Get role value. | |
void | set_role (const if_gamestate_role_t new_role) |
Set role value. | |
size_t | maxlenof_role () const |
Get maximum length of role value. | |
uint32_t | score_cyan () const |
Get score_cyan value. | |
void | set_score_cyan (const uint32_t new_score_cyan) |
Set score_cyan value. | |
size_t | maxlenof_score_cyan () const |
Get maximum length of score_cyan value. | |
uint32_t | score_magenta () const |
Get score_magenta value. | |
void | set_score_magenta (const uint32_t new_score_magenta) |
Set score_magenta value. | |
size_t | maxlenof_score_magenta () const |
Get maximum length of score_magenta value. | |
virtual Message * | create_message (const char *type) const |
Create message based on type name. | |
virtual void | copy_values (const Interface *other) |
Copy values from other interface. | |
virtual const char * | enum_tostring (const char *enumtype, int val) const |
Convert arbitrary enum value to string. | |
Static Public Attributes | |
static const uint32_t | GS_FROZEN = 0u |
GS_FROZEN constant. | |
static const uint32_t | GS_PLAY = 1u |
GS_PLAY constant. | |
static const uint32_t | GS_KICK_OFF = 2u |
GS_KICK_OFF constant. | |
static const uint32_t | GS_DROP_BALL = 3u |
GS_DROP_BALL constant. | |
static const uint32_t | GS_PENALTY = 4u |
GS_PENALTY constant. | |
static const uint32_t | GS_CORNER_KICK = 5u |
GS_CORNER_KICK constant. | |
static const uint32_t | GS_THROW_IN = 6u |
GS_THROW_IN constant. | |
static const uint32_t | GS_FREE_KICK = 7u |
GS_FREE_KICK constant. | |
static const uint32_t | GS_GOAL_KICK = 8u |
GS_GOAL_KICK constant. | |
static const uint32_t | GS_HALF_TIME = 9u |
GS_HALF_TIME constant. | |
static const uint32_t | GS_SPL_INITIAL = 0u |
GS_SPL_INITIAL constant. | |
static const uint32_t | GS_SPL_READY = 1u |
GS_SPL_READY constant. | |
static const uint32_t | GS_SPL_SET = 2u |
GS_SPL_SET constant. | |
static const uint32_t | GS_SPL_PLAY = 3u |
GS_SPL_PLAY constant. | |
static const uint32_t | GS_SPL_FINISHED = 4u |
GS_SPL_FINISHED constant. |
GameStateInterface Fawkes BlackBoard Interface.
This interface provides access to the current game state. It is closely related to the WorldInfo network protocol.
Definition at line 33 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_goalcolor_t.
Definition at line 72 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_half_t.
Definition at line 82 of file GameStateInterface.h.
Enumeration defining the different robot roles.
Keep in sync with worldinfo_gamestate_role_t.
ROLE_GOALIE |
Goalie. |
ROLE_DEFENDER |
Defender. |
ROLE_MID_LEFT |
Midfield left. |
ROLE_MID_RIGHT |
Midfield right. |
ROLE_ATTACKER |
Attacker. |
Definition at line 92 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_team_t.
TEAM_NONE |
No team, not team-specific. |
TEAM_CYAN |
Cyan team. |
TEAM_MAGENTA |
Magenta team. |
TEAM_BOTH |
Both teams. |
Definition at line 60 of file GameStateInterface.h.
void fawkes::GameStateInterface::copy_values | ( | const Interface * | other | ) | [virtual] |
Copy values from other interface.
other | other interface to copy values from |
Implements fawkes::Interface.
Definition at line 462 of file GameStateInterface.cpp.
References fawkes::Interface::type().
Message * fawkes::GameStateInterface::create_message | ( | const char * | type | ) | const [virtual] |
Create message based on type name.
This will create a new message of the given type. The type must be given without the InterfaceName:: prefix but just the plain class name of the message.
type | message type |
UnknownTypeException | thrown if this interface cannot create a message of the given type. |
Implements fawkes::Interface.
Definition at line 443 of file GameStateInterface.cpp.
const char * fawkes::GameStateInterface::enum_tostring | ( | const char * | enumtype, |
int | val | ||
) | const [virtual] |
Convert arbitrary enum value to string.
Given the string representation of the enum type and the value this method returns the string representation of the specific value, or the string UNKNOWN if the value is not defined. An exception is thrown if the enum type is invalid.
enumtype | enum type as string |
val | value to convert |
UnknownTypeException | thrown if enumtype is not specified for interface. |
Implements fawkes::Interface.
Definition at line 473 of file GameStateInterface.cpp.
uint32_t fawkes::GameStateInterface::game_state | ( | ) | const |
Get game_state value.
Current game state
Definition at line 167 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
GameStateInterface::if_gamestate_half_t fawkes::GameStateInterface::half | ( | ) | const |
Get half value.
Current game half
Definition at line 291 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
bool fawkes::GameStateInterface::is_kickoff | ( | ) | const |
Get kickoff value.
Whether we have kickoff
Definition at line 322 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
size_t fawkes::GameStateInterface::maxlenof_game_state | ( | ) | const |
Get maximum length of game_state value.
Definition at line 177 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_half | ( | ) | const |
Get maximum length of half value.
Definition at line 301 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_kickoff | ( | ) | const |
Get maximum length of kickoff value.
Definition at line 332 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_our_goal_color | ( | ) | const |
Get maximum length of our_goal_color value.
Definition at line 270 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_our_team | ( | ) | const |
Get maximum length of our_team value.
Definition at line 239 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_role | ( | ) | const |
Get maximum length of role value.
Definition at line 363 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_score_cyan | ( | ) | const |
Get maximum length of score_cyan value.
Definition at line 394 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_score_magenta | ( | ) | const |
Get maximum length of score_magenta value.
Definition at line 425 of file GameStateInterface.cpp.
size_t fawkes::GameStateInterface::maxlenof_state_team | ( | ) | const |
Get maximum length of state_team value.
Definition at line 208 of file GameStateInterface.cpp.
bool fawkes::GameStateInterface::message_valid | ( | const Message * | message | ) | const [virtual] |
Check if message is valid and can be enqueued.
message | Message to check |
Implements fawkes::Interface.
Definition at line 766 of file GameStateInterface.cpp.
GameStateInterface::if_gamestate_goalcolor_t fawkes::GameStateInterface::our_goal_color | ( | ) | const |
Get our_goal_color value.
Our own goal color
Definition at line 260 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
GameStateInterface::if_gamestate_team_t fawkes::GameStateInterface::our_team | ( | ) | const |
Get our_team value.
Our team color
Definition at line 229 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
GameStateInterface::if_gamestate_role_t fawkes::GameStateInterface::role | ( | ) | const |
Get role value.
Current role of this robot
Definition at line 353 of file GameStateInterface.cpp.
uint32_t fawkes::GameStateInterface::score_cyan | ( | ) | const |
Get score_cyan value.
Score of team cyan
Definition at line 384 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process(), and RefBoxStateBBWriter::send().
uint32_t fawkes::GameStateInterface::score_magenta | ( | ) | const |
Get score_magenta value.
Score of team magenta
Definition at line 415 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
void fawkes::GameStateInterface::set_game_state | ( | const uint32_t | new_game_state | ) |
Set game_state value.
Current game state
new_game_state | new game_state value |
Definition at line 187 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxStateBBWriter::set_gamestate(), and RefBoxCommThread::set_gamestate().
void fawkes::GameStateInterface::set_half | ( | const if_gamestate_half_t | new_half | ) |
Set half value.
Current game half
new_half | new half value |
Definition at line 311 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxStateBBWriter::set_half(), and RefBoxCommThread::set_half().
void fawkes::GameStateInterface::set_kickoff | ( | const bool | new_kickoff | ) |
Set kickoff value.
Whether we have kickoff
new_kickoff | new kickoff value |
Definition at line 342 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by RefBoxCommThread::loop(), and RefBoxCommThread::set_half().
void fawkes::GameStateInterface::set_our_goal_color | ( | const if_gamestate_goalcolor_t | new_our_goal_color | ) |
Set our_goal_color value.
Our own goal color
new_our_goal_color | new our_goal_color value |
Definition at line 280 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxStateBBWriter::set_team_goal(), and RefBoxCommThread::set_team_goal().
void fawkes::GameStateInterface::set_our_team | ( | const if_gamestate_team_t | new_our_team | ) |
Set our_team value.
Our team color
new_our_team | new our_team value |
Definition at line 249 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxCommThread::loop(), RefBoxStateBBWriter::set_team_goal(), and RefBoxCommThread::set_team_goal().
void fawkes::GameStateInterface::set_role | ( | const if_gamestate_role_t | new_role | ) |
Set role value.
Current role of this robot
new_role | new role value |
Definition at line 373 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
void fawkes::GameStateInterface::set_score_cyan | ( | const uint32_t | new_score_cyan | ) |
Set score_cyan value.
Score of team cyan
new_score_cyan | new score_cyan value |
Definition at line 404 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxStateBBWriter::send(), RefBoxStateBBWriter::set_score(), and RefBoxCommThread::set_score().
void fawkes::GameStateInterface::set_score_magenta | ( | const uint32_t | new_score_magenta | ) |
Set score_magenta value.
Score of team magenta
new_score_magenta | new score_magenta value |
Definition at line 435 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxStateBBWriter::set_score(), and RefBoxCommThread::set_score().
void fawkes::GameStateInterface::set_state_team | ( | const if_gamestate_team_t | new_state_team | ) |
Set state_team value.
Team referred to by game state
new_state_team | new state_team value |
Definition at line 218 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by WorldModelNetworkThread::gamestate_rcvd(), RefBoxCommThread::loop(), RefBoxStateBBWriter::set_gamestate(), and RefBoxCommThread::set_gamestate().
GameStateInterface::if_gamestate_team_t fawkes::GameStateInterface::state_team | ( | ) | const |
Get state_team value.
Team referred to by game state
Definition at line 198 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
const char * fawkes::GameStateInterface::tostring_if_gamestate_goalcolor_t | ( | if_gamestate_goalcolor_t | value | ) | const |
Convert if_gamestate_goalcolor_t constant to string.
value | value to convert to string |
Definition at line 124 of file GameStateInterface.cpp.
References fawkes::GOAL_BLUE, and fawkes::GOAL_YELLOW.
const char * fawkes::GameStateInterface::tostring_if_gamestate_half_t | ( | if_gamestate_half_t | value | ) | const |
Convert if_gamestate_half_t constant to string.
value | value to convert to string |
Definition at line 137 of file GameStateInterface.cpp.
References fawkes::HALF_FIRST, and fawkes::HALF_SECOND.
const char * fawkes::GameStateInterface::tostring_if_gamestate_role_t | ( | if_gamestate_role_t | value | ) | const |
Convert if_gamestate_role_t constant to string.
value | value to convert to string |
Definition at line 150 of file GameStateInterface.cpp.
const char * fawkes::GameStateInterface::tostring_if_gamestate_team_t | ( | if_gamestate_team_t | value | ) | const |
Convert if_gamestate_team_t constant to string.
value | value to convert to string |
Definition at line 109 of file GameStateInterface.cpp.
References fawkes::TEAM_BOTH, fawkes::TEAM_CYAN, fawkes::TEAM_MAGENTA, and fawkes::TEAM_NONE.
const uint32_t fawkes::GameStateInterface::GS_CORNER_KICK = 5u [static] |
GS_CORNER_KICK constant.
Definition at line 45 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_DROP_BALL = 3u [static] |
GS_DROP_BALL constant.
Definition at line 43 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_FREE_KICK = 7u [static] |
GS_FREE_KICK constant.
Definition at line 47 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_FROZEN = 0u [static] |
GS_FROZEN constant.
Definition at line 40 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_GOAL_KICK = 8u [static] |
GS_GOAL_KICK constant.
Definition at line 48 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_HALF_TIME = 9u [static] |
GS_HALF_TIME constant.
Definition at line 49 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_KICK_OFF = 2u [static] |
GS_KICK_OFF constant.
Definition at line 42 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_PENALTY = 4u [static] |
GS_PENALTY constant.
Definition at line 44 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_PLAY = 1u [static] |
GS_PLAY constant.
Definition at line 41 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_SPL_FINISHED = 4u [static] |
GS_SPL_FINISHED constant.
Definition at line 54 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_SPL_INITIAL = 0u [static] |
GS_SPL_INITIAL constant.
Definition at line 50 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_SPL_PLAY = 3u [static] |
GS_SPL_PLAY constant.
Definition at line 53 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_SPL_READY = 1u [static] |
GS_SPL_READY constant.
Definition at line 51 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_SPL_SET = 2u [static] |
GS_SPL_SET constant.
Definition at line 52 of file GameStateInterface.h.
const uint32_t fawkes::GameStateInterface::GS_THROW_IN = 6u [static] |
GS_THROW_IN constant.
Definition at line 46 of file GameStateInterface.h.