5 #ifndef WAK_SENSOR_VARS_H
6 #define WAK_SENSOR_VARS_H
9 #include <walk_and_kick/wak_common.h>
10 #include <walk_and_kick/wak_config.h>
11 #include <walk_and_kick/wak_ros_interface.h>
12 #include <walk_and_kick/wak_gc_vars.h>
13 #include <walk_and_kick/wak_tc_vars.h>
14 #include <walk_and_kick/wak_utils.h>
15 #include <rc_utils/math_funcs.h>
16 #include <rc_utils/ros_time.h>
19 namespace walk_and_kick
46 void update(
const ros::Time& now);
61 bool GCExtraDataFresh;
67 KickoffType kickoffType;
73 GameCommand gameCommand;
74 bool gameCommandIsNew;
85 float robotPoseTimeAgo;
102 float ballPoseTimeAgo;
108 GoalPostList goalPosts;
111 ObstacleList obstacles;
112 Obstacle obstClosest;
117 bool directGoalAllowed;
121 bool TCDataAvailable;
125 DiveDirection diveDecision;
132 bool isInvalidRole()
const {
return !gameRoleValid(gameRole); }
133 bool isFieldPlayer()
const {
return gameRoleIsFieldPlayer(gameRole); }
134 bool isGoalie()
const {
return gameRoleIsGoalie(gameRole); }
137 bool isRelaxed()
const {
return RI.stateRelaxed(); }
138 bool isIniting()
const {
return RI.stateIniting(); }
139 bool isStanding()
const {
return RI.stateStanding(); }
140 bool isWalking()
const {
return RI.stateWalking(); }
141 bool isKicking()
const {
return RI.stateKicking(); }
142 bool isFallen()
const {
return RI.stateFallen(); }
149 void setPlayState(PlayState state,
const ros::Time& toldTime = ros::Time());
152 void clearPlayStateTimeout() { rc_utils::zeroRosTime(m_playStateTimeout); }
153 void setPlayStateTimeout(
const ros::Time& timeout) { m_playStateTimeout = timeout; }
154 bool havePlayStateTimeout()
const {
return !m_playStateTimeout.isZero(); }
155 bool playStateWouldTimeOut(
const ros::Time& timeout)
const {
return (!timeout.isZero() && now >= timeout); }
156 bool playStateTimedOut()
const {
return playStateWouldTimeOut(m_playStateTimeout); }
159 bool timeoutTimeout(
float timeSinceLastTold)
const {
return (timeSinceLastTold >= config.gcTimeoutTimeoutLast()); }
160 bool timeoutReady()
const {
return (kickoffType == KT_MANUAL || !havePlayStateTimeout() || playStateTimedOut()); }
161 bool timeoutSet(
float timeSinceFirstIn,
float timeSinceFirstTold,
float timeSinceLastTold)
const;
162 bool timeoutBeginPlay(
float timeSinceFirstTold)
const {
return (listenToGC || kickoffType == KT_MANUAL || timeSinceFirstTold >= rc_utils::coerceMin(config.sWaitTime() - config.waitTimeReduction(), 0.0f)); }
165 ros::Time m_playStateFirstIn;
166 ros::Time m_playStateFirstTold;
167 ros::Time m_playStateLastTold;
168 ros::Time m_playStateTimeout;
169 ros::Time m_lastTimeNotPlaying;
172 ros::Time m_robotPoseTimeFirst;
173 ros::Time m_robotPoseTimeLast;
176 ros::Time m_ballTimeFirst;
177 ros::Time m_ballTimeLast;
178 ros::Time m_ballPoseTimeFirst;
179 ros::Time m_ballPoseTimeLast;
188 cycle_t m_updateCycle;
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
An interface class for encapsulating all of the ROS input data to the walk and kick node...
Definition: wak_sensor_vars.h:29
A class that encapsulates all of the game controller input data to the walk and kick node...
Definition: wak_gc_vars.h:29
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
An interface class between the walk and kick and ROS worlds.
Definition: wak_ros_interface.h:54
A class that implements the worm, for making a live decision between two opposites.
Definition: wak_utils.h:83