9 #include <walk_and_kick/wak_common.h>
10 #include <walk_and_kick/wak_config.h>
11 #include <walk_and_kick/wak_utils.h>
12 #include <walk_and_kick/TeamCommsData.h>
13 #include <boost/shared_ptr.hpp>
17 #define DEFAULT_TCFRESH_TIME 5.0f
20 namespace walk_and_kick
29 typedef boost::shared_ptr<const TCRobotVars> TCRobotVarsConstPtr;
30 typedef std::map<unsigned int, TCRobotVarsConstPtr> TCRobotDataMap;
50 bool update(
const ros::Time& now,
const SensorVars* SV);
53 TCRobotDataMap robotDataMap;
58 typedef boost::shared_ptr<TCRobotVars> TCRobotVarsPtr;
59 typedef std::map<unsigned int, TCRobotVarsPtr> TCRobotDataMapInternal;
60 TCRobotDataMapInternal m_robotDataMap;
63 bool dataIsFresh(
const ros::Time& now,
const TeamCommsData& data)
const {
return (!data.timestamp.isZero() && (now - data.timestamp).toSec() <= (config ? config->tcFreshTime() : DEFAULT_TCFRESH_TIME)); }
69 plot_msgs::PlotManagerFS* PM;
87 RI_IS_PENALTY = 0x0001,
88 RI_FIELD_MISMATCH = 0x0002,
89 RI_INVALID_KICKOFF_TYPE = 0x0004,
90 RI_INVALID_BUTTON_STATE = 0x0008,
91 RI_INVALID_GAME_CMD = 0x0010,
92 RI_INVALID_GAME_ROLE = 0x0020,
93 RI_INVALID_PLAY_STATE = 0x0040,
94 RI_SAME_ROBOT_NUMBER = 0x0080,
95 RI_WRONG_DIRN_OF_PLAY = 0x0100,
97 RI_MISCELLANEOUS = 0x0400,
100 static const bool reasonInvalidIndexValid(
int reasonIndex) {
return (reasonIndex >= 0 && reasonIndex < RI_COUNT); }
101 static const std::string& reasonInvalidName(
int reasonIndex) {
if(reasonInvalidIndexValid(reasonIndex))
return ReasonInvalidName[reasonIndex];
else return ReasonInvalidName[RI_MISCELLANEOUS]; }
102 static const std::string& reasonInvalidFlagName(ReasonInvalid reason) {
if(ReasonInvalidMap.find(reason) != ReasonInvalidMap.end())
return ReasonInvalidMap.at(reason);
else return ReasonInvalidMap.at(RI_MISCELLANEOUS); }
103 static std::string reasonsInvalidString(
int reasonInvalid,
const std::string& separator =
" | ");
105 static const std::string ReasonInvalidName[RI_COUNT];
106 static const std::map<ReasonInvalid, std::string> ReasonInvalidMap;
107 static std::map<ReasonInvalid, std::string> reasonInvalidMap();
111 TCRobotVars(
WAKConfig* config,
const FieldDimensions& field,
const std::string& robot,
unsigned int robotUID) : config(config), field(field), robot(robot), robotUID(robotUID) { update(TeamCommsData(), NULL); dataValid =
false; }
112 TCRobotVars(
WAKConfig* config,
const FieldDimensions& field,
const std::string& robot,
unsigned int robotUID,
const TeamCommsData& newData) : config(config), field(field), robot(robot), robotUID(robotUID) { update(newData, NULL); }
121 const std::string robot;
122 const unsigned int robotUID;
125 void update(
const TeamCommsData& newData,
const SensorVars* SV);
132 FieldModel::FieldType fieldType;
133 KickoffType kickoffType;
134 ButtonState buttonState;
135 GameCommand gameCommand;
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
A class that encapsulates all of the team communications data received from one particular robot...
Definition: wak_tc_vars.h:80
Visualisation marker manager for the walk and kick node.
Definition: wak_vis.h:21
An interface class for encapsulating all of the ROS input data to the walk and kick node...
Definition: wak_sensor_vars.h:29
An interface class to the ROS world for team communications.
Definition: wak_tc_ros.h:30
A class that encapsulates all of the team communication input data to the walk and kick node...
Definition: wak_tc_vars.h:37
A simple class for abstracting away the source of the field dimensions.
Definition: wak_utils.h:216