Fawkes API
Fawkes Development Version
|
#include <>>
Classes | |
class | SetKickoffMessage |
class | SetStateTeamMessage |
class | SetTeamColorMessage |
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. More... | |
const char * | tostring_if_gamestate_goalcolor_t (if_gamestate_goalcolor_t value) const |
Convert if_gamestate_goalcolor_t constant to string. More... | |
const char * | tostring_if_gamestate_half_t (if_gamestate_half_t value) const |
Convert if_gamestate_half_t constant to string. More... | |
const char * | tostring_if_gamestate_role_t (if_gamestate_role_t value) const |
Convert if_gamestate_role_t constant to string. More... | |
virtual bool | message_valid (const Message *message) const |
Check if message is valid and can be enqueued. More... | |
uint32_t | game_state () const |
Get game_state value. More... | |
void | set_game_state (const uint32_t new_game_state) |
Set game_state value. More... | |
size_t | maxlenof_game_state () const |
Get maximum length of game_state value. More... | |
if_gamestate_team_t | state_team () const |
Get state_team value. More... | |
void | set_state_team (const if_gamestate_team_t new_state_team) |
Set state_team value. More... | |
size_t | maxlenof_state_team () const |
Get maximum length of state_team value. More... | |
if_gamestate_team_t | our_team () const |
Get our_team value. More... | |
void | set_our_team (const if_gamestate_team_t new_our_team) |
Set our_team value. More... | |
size_t | maxlenof_our_team () const |
Get maximum length of our_team value. More... | |
if_gamestate_goalcolor_t | our_goal_color () const |
Get our_goal_color value. More... | |
void | set_our_goal_color (const if_gamestate_goalcolor_t new_our_goal_color) |
Set our_goal_color value. More... | |
size_t | maxlenof_our_goal_color () const |
Get maximum length of our_goal_color value. More... | |
if_gamestate_half_t | half () const |
Get half value. More... | |
void | set_half (const if_gamestate_half_t new_half) |
Set half value. More... | |
size_t | maxlenof_half () const |
Get maximum length of half value. More... | |
bool | is_kickoff () const |
Get kickoff value. More... | |
void | set_kickoff (const bool new_kickoff) |
Set kickoff value. More... | |
size_t | maxlenof_kickoff () const |
Get maximum length of kickoff value. More... | |
if_gamestate_role_t | role () const |
Get role value. More... | |
void | set_role (const if_gamestate_role_t new_role) |
Set role value. More... | |
size_t | maxlenof_role () const |
Get maximum length of role value. More... | |
uint32_t | score_cyan () const |
Get score_cyan value. More... | |
void | set_score_cyan (const uint32_t new_score_cyan) |
Set score_cyan value. More... | |
size_t | maxlenof_score_cyan () const |
Get maximum length of score_cyan value. More... | |
uint32_t | score_magenta () const |
Get score_magenta value. More... | |
void | set_score_magenta (const uint32_t new_score_magenta) |
Set score_magenta value. More... | |
size_t | maxlenof_score_magenta () const |
Get maximum length of score_magenta value. More... | |
virtual Message * | create_message (const char *type) const |
virtual void | copy_values (const Interface *other) |
Copy values from other interface. More... | |
virtual const char * | enum_tostring (const char *enumtype, int val) const |
![]() | |
virtual | ~Interface () |
Destructor. More... | |
bool | oftype (const char *interface_type) const |
Check if interface is of given type. More... | |
const void * | datachunk () const |
Get data chunk. More... | |
unsigned int | datasize () const |
Get data size. More... | |
const char * | type () const |
Get type of interface. More... | |
const char * | id () const |
Get identifier of interface. More... | |
const char * | uid () const |
Get unique identifier of interface. More... | |
unsigned short | serial () const |
Get instance serial of interface. More... | |
unsigned int | mem_serial () const |
Get memory serial of interface. More... | |
bool | operator== (Interface &comp) const |
Check equality of two interfaces. More... | |
const unsigned char * | hash () const |
Get interface hash. More... | |
size_t | hash_size () const |
Get size of interface hash. More... | |
const char * | hash_printable () const |
Get printable interface hash. More... | |
bool | is_writer () const |
Check if this is a writing instance. More... | |
void | set_validity (bool valid) |
Mark this interface invalid. More... | |
bool | is_valid () const |
Check validity of interface. More... | |
const char * | owner () const |
Get owner of interface. More... | |
void | set_from_chunk (void *chunk) |
Set from a raw data chunk. More... | |
void | resize_buffers (unsigned int num_buffers) |
Resize buffer array. More... | |
unsigned int | num_buffers () const |
Get number of buffers. More... | |
void | copy_shared_to_buffer (unsigned int buffer) |
Copy data from private memory to buffer. More... | |
void | copy_private_to_buffer (unsigned int buffer) |
Copy data from private memory to buffer. More... | |
void | read_from_buffer (unsigned int buffer) |
Copy data from buffer to private memory. More... | |
int | compare_buffers (unsigned int buffer) |
Compare buffer to private memory. More... | |
Time | buffer_timestamp (unsigned int buffer) |
Get time of a buffer. More... | |
void | buffer_timestamp (unsigned int buffer, Time *timestamp) |
Get time of a buffer. More... | |
void | read () |
Read from BlackBoard into local copy. More... | |
void | write () |
Write from local copy into BlackBoard memory. More... | |
bool | has_writer () const |
Check if there is a writer for the interface. More... | |
unsigned int | num_readers () const |
Get the number of readers. More... | |
std::string | writer () const |
Get owner name of writing interface instance. More... | |
std::list< std::string > | readers () const |
Get owner names of reading interface instances. More... | |
bool | changed () const |
Check if data has been changed. More... | |
const Time * | timestamp () const |
Get timestamp of last write. More... | |
void | set_auto_timestamping (bool enabled) |
Enable or disable automated timestamping. More... | |
void | set_timestamp (const Time *t=NULL) |
Set timestamp. More... | |
void | set_clock (Clock *clock) |
Set clock to use for timestamping. More... | |
void | mark_data_changed () |
Mark data as changed. More... | |
std::list< const char * > | get_message_types () |
Obtain a list of textual representations of the message types available for this interface. More... | |
unsigned int | msgq_enqueue (Message *message) |
Enqueue message at end of queue. More... | |
unsigned int | msgq_enqueue_copy (Message *message) |
Enqueue copy of message at end of queue. More... | |
void | msgq_remove (Message *message) |
Remove message from queue. More... | |
void | msgq_remove (unsigned int message_id) |
Remove message from queue. More... | |
unsigned int | msgq_size () |
Get size of message queue. More... | |
void | msgq_flush () |
Flush all messages. More... | |
void | msgq_lock () |
Lock message queue. More... | |
bool | msgq_try_lock () |
Try to lock message queue. More... | |
void | msgq_unlock () |
Unlock message queue. More... | |
void | msgq_pop () |
Erase first message from queue. More... | |
Message * | msgq_first () |
Get the first message from the message queue. More... | |
bool | msgq_empty () |
Check if queue is empty. More... | |
void | msgq_append (Message *message) |
Enqueue message. More... | |
template<class MessageType > | |
bool | msgq_first_is () |
Check if first message has desired type. More... | |
template<class MessageType > | |
MessageType * | msgq_first () |
Get first message casted to the desired type. More... | |
template<class MessageType > | |
MessageType * | msgq_first (MessageType *&msg) |
Get first message casted to the desired type. More... | |
template<class MessageType > | |
MessageType * | msgq_first_safe (MessageType *&msg) throw () |
Get first message casted to the desired type without exceptions. More... | |
MessageQueue::MessageIterator | msgq_begin () |
Get start iterator for message queue. More... | |
MessageQueue::MessageIterator | msgq_end () |
Get end iterator for message queue. More... | |
InterfaceFieldIterator | fields () |
Get iterator over all fields of this interface instance. More... | |
InterfaceFieldIterator | fields_end () |
Invalid iterator. More... | |
unsigned int | num_fields () |
Get the number of fields in the interface. More... | |
Static Public Attributes | |
static const uint32_t | GS_FROZEN = 0u |
GS_FROZEN constant. More... | |
static const uint32_t | GS_PLAY = 1u |
GS_PLAY constant. More... | |
static const uint32_t | GS_KICK_OFF = 2u |
GS_KICK_OFF constant. More... | |
static const uint32_t | GS_DROP_BALL = 3u |
GS_DROP_BALL constant. More... | |
static const uint32_t | GS_PENALTY = 4u |
GS_PENALTY constant. More... | |
static const uint32_t | GS_CORNER_KICK = 5u |
GS_CORNER_KICK constant. More... | |
static const uint32_t | GS_THROW_IN = 6u |
GS_THROW_IN constant. More... | |
static const uint32_t | GS_FREE_KICK = 7u |
GS_FREE_KICK constant. More... | |
static const uint32_t | GS_GOAL_KICK = 8u |
GS_GOAL_KICK constant. More... | |
static const uint32_t | GS_HALF_TIME = 9u |
GS_HALF_TIME constant. More... | |
static const uint32_t | GS_SPL_INITIAL = 0u |
GS_SPL_INITIAL constant. More... | |
static const uint32_t | GS_SPL_READY = 1u |
GS_SPL_READY constant. More... | |
static const uint32_t | GS_SPL_SET = 2u |
GS_SPL_SET constant. More... | |
static const uint32_t | GS_SPL_PLAY = 3u |
GS_SPL_PLAY constant. More... | |
static const uint32_t | GS_SPL_FINISHED = 4u |
GS_SPL_FINISHED constant. More... | |
Additional Inherited Members | |
![]() | |
static void | parse_uid (const char *uid, std::string &type, std::string &id) |
Parse UID to type and ID strings. More... | |
![]() | |
Interface () | |
Constructor. More... | |
void | set_hash (unsigned char *ihash) |
Set hash. More... | |
void | add_fieldinfo (interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0) |
Add an entry to the field info list. More... | |
void | add_messageinfo (const char *name) |
Add an entry to the message info list. More... | |
![]() | |
void * | data_ptr |
unsigned int | data_size |
bool | data_changed |
interface_data_ts_t * | data_ts |
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 37 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_goalcolor_t.
Enumerator | |
---|---|
GOAL_BLUE | Blue goal. |
GOAL_YELLOW | Yellow goal. |
Definition at line 81 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_half_t.
Enumerator | |
---|---|
HALF_FIRST | First half. |
HALF_SECOND | Second half. |
Definition at line 91 of file GameStateInterface.h.
Enumeration defining the different robot roles.
Keep in sync with worldinfo_gamestate_role_t.
Enumerator | |
---|---|
ROLE_GOALIE | Goalie. |
ROLE_DEFENDER | Defender. |
ROLE_MID_LEFT | Midfield left. |
ROLE_MID_RIGHT | Midfield right. |
ROLE_ATTACKER | Attacker. |
Definition at line 101 of file GameStateInterface.h.
Enumeration defining the different teams.
Keep in sync with worldinfo_gamestate_team_t.
Enumerator | |
---|---|
TEAM_NONE | No team, not team-specific. |
TEAM_CYAN | Cyan team. |
TEAM_MAGENTA | Magenta team. |
TEAM_BOTH | Both teams. |
Definition at line 69 of file GameStateInterface.h.
|
virtual |
Copy values from other interface.
other | other interface to copy values from |
Implements fawkes::Interface.
Definition at line 481 of file GameStateInterface.cpp.
|
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 462 of file GameStateInterface.cpp.
|
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 492 of file GameStateInterface.cpp.
uint32_t fawkes::GameStateInterface::game_state | ( | ) | const |
Get game_state value.
Current game state
Definition at line 186 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 310 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 341 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 196 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_half | ( | ) | const |
Get maximum length of half value.
Definition at line 320 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_kickoff | ( | ) | const |
Get maximum length of kickoff value.
Definition at line 351 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_our_goal_color | ( | ) | const |
Get maximum length of our_goal_color value.
Definition at line 289 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_our_team | ( | ) | const |
Get maximum length of our_team value.
Definition at line 258 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_role | ( | ) | const |
Get maximum length of role value.
Definition at line 382 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_score_cyan | ( | ) | const |
Get maximum length of score_cyan value.
Definition at line 413 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_score_magenta | ( | ) | const |
Get maximum length of score_magenta value.
Definition at line 444 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
size_t fawkes::GameStateInterface::maxlenof_state_team | ( | ) | const |
Get maximum length of state_team value.
Definition at line 227 of file GameStateInterface.cpp.
References fawkes::Interface::data_changed.
|
virtual |
Check if message is valid and can be enqueued.
message | Message to check |
Implements fawkes::Interface.
Definition at line 863 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 279 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 248 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 372 of file GameStateInterface.cpp.
uint32_t fawkes::GameStateInterface::score_cyan | ( | ) | const |
Get score_cyan value.
Score of team cyan
Definition at line 403 of file GameStateInterface.cpp.
Referenced by RemoteBlackBoardRefBoxProcessor::refbox_process().
uint32_t fawkes::GameStateInterface::score_magenta | ( | ) | const |
Get score_magenta value.
Score of team magenta
Definition at line 434 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 206 of file GameStateInterface.cpp.
Referenced by 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 330 of file GameStateInterface.cpp.
Referenced by 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 361 of file GameStateInterface.cpp.
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 299 of file GameStateInterface.cpp.
Referenced by 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 268 of file GameStateInterface.cpp.
Referenced by RefBoxCommThread::loop(), 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 392 of file GameStateInterface.cpp.
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 423 of file GameStateInterface.cpp.
Referenced by 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 454 of file GameStateInterface.cpp.
Referenced by 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 237 of file GameStateInterface.cpp.
Referenced by RefBoxCommThread::loop(), 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 217 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 143 of file GameStateInterface.cpp.
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 156 of file GameStateInterface.cpp.
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 169 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 128 of file GameStateInterface.cpp.
|
static |
GS_CORNER_KICK constant.
Definition at line 54 of file GameStateInterface.h.
|
static |
GS_DROP_BALL constant.
Definition at line 52 of file GameStateInterface.h.
|
static |
GS_FREE_KICK constant.
Definition at line 56 of file GameStateInterface.h.
|
static |
GS_FROZEN constant.
Definition at line 49 of file GameStateInterface.h.
|
static |
GS_GOAL_KICK constant.
Definition at line 57 of file GameStateInterface.h.
|
static |
GS_HALF_TIME constant.
Definition at line 58 of file GameStateInterface.h.
|
static |
GS_KICK_OFF constant.
Definition at line 51 of file GameStateInterface.h.
|
static |
GS_PENALTY constant.
Definition at line 53 of file GameStateInterface.h.
|
static |
GS_PLAY constant.
Definition at line 50 of file GameStateInterface.h.
|
static |
GS_SPL_FINISHED constant.
Definition at line 63 of file GameStateInterface.h.
|
static |
GS_SPL_INITIAL constant.
Definition at line 59 of file GameStateInterface.h.
|
static |
GS_SPL_PLAY constant.
Definition at line 62 of file GameStateInterface.h.
|
static |
GS_SPL_READY constant.
Definition at line 60 of file GameStateInterface.h.
|
static |
GS_SPL_SET constant.
Definition at line 61 of file GameStateInterface.h.
|
static |
GS_THROW_IN constant.
Definition at line 55 of file GameStateInterface.h.