5 #ifndef WAK_ROS_INTERFACE_H
6 #define WAK_ROS_INTERFACE_H
9 #include <walk_and_kick/wak_common.h>
10 #include <walk_and_kick/wak_config.h>
11 #include <walk_and_kick/wak_actuator_vars.h>
12 #include <walk_and_kick/wak_gc_ros.h>
13 #include <walk_and_kick/wak_tc_ros.h>
14 #include <walk_and_kick/wak_vis.h>
15 #include <walk_and_kick/BehaviourState.h>
16 #include <walk_and_kick/TeamCommsData.h>
17 #include <walk_and_kick/VisualiseDBH.h>
18 #include <walk_and_kick/VisualiseDbApp.h>
19 #include <geometry_msgs/PointStamped.h>
20 #include <geometry_msgs/PolygonStamped.h>
21 #include <nimbro_op_interface/LEDCommand.h>
22 #include <nimbro_op_interface/Button.h>
23 #include <vision_module/vision_outputs.h>
24 #include <head_control/LookAtTarget.h>
25 #include <robotcontrol/RobotHeading.h>
26 #include <robotcontrol/Diagnostics.h>
27 #include <robotcontrol/State.h>
28 #include <plot_msgs/plot_manager.h>
29 #include <tf/transform_broadcaster.h>
30 #include <gait_msgs/GaitCommand.h>
31 #include <boost/shared_ptr.hpp>
32 #include <gait/gait_common.h>
33 #include <std_msgs/String.h>
34 #include <std_srvs/Empty.h>
35 #include <std_msgs/Bool.h>
39 namespace walk_and_kick
42 using nimbro_op_interface::LEDCommand;
76 bool isFakeRobot()
const {
return m_isFakeRobot; }
79 void update(
const ros::Time& now,
bool LED4);
83 void writeNeutralHead();
85 void writeNeutral() { writeNeutralHead(); writeZeroGcv(); writeRGBLEDState(); }
88 void clearLEDState() { writeLEDCommand(0xFF, 0x00); }
89 void writeLEDCommand(
int mask,
int state);
90 void updateRGBLED(
bool blink);
91 void clearRGBLED()
const;
95 void publishTeamCommsPacket(
const TeamCommsData& packet)
const { m_pub_teamComms.publish(packet); }
98 bool stateRelaxed()
const {
return m_relaxed; }
99 bool stateIniting()
const {
return m_initing; }
100 bool stateStanding()
const {
return m_standing; }
101 bool stateWalking()
const {
return m_walking; }
102 bool stateKicking()
const {
return m_kicking; }
103 bool stateFallen()
const {
return m_fallen; }
121 GoalPostList goalPostList;
122 ros::Time goalPostTime;
125 ObstacleList obstacleList;
126 ros::Time obstacleTime;
131 ros::Time robotPoseTime;
135 ros::Time robotHeadingTime;
138 bool robotcontrolCommsOk;
141 DiveDirection diveDecision;
144 void sendTransform(
const Vec3f& RobotPose);
147 plot_msgs::PlotManagerFS* PM;
148 plot_msgs::PlotManagerFS& getPM()
const {
return *PM; }
158 tf::TransformBroadcaster m_tfBroadcaster;
159 tf::StampedTransform m_tfBehField;
162 void callbackPlotData();
165 void updateModeStateText() { MM->ModeStateText.setText((config.sListenToGC() ?
"Extern " :
"Local ") + m_buttonName); }
166 void handleBlockGCPackets() { GCRI.setEnabled(!config.debugBlockGCPackets()); }
170 ros::Publisher m_pub_gaitCmd;
171 ros::Publisher m_pub_headCmd;
172 ros::Publisher m_pub_leds;
173 ros::Publisher m_pub_state;
174 ros::Publisher m_pub_teamComms;
177 ros::Subscriber m_sub_button;
178 ros::Subscriber m_sub_robotState;
179 ros::Subscriber m_sub_robotHeading;
180 ros::Subscriber m_sub_stoppedGaitCmd;
181 ros::Subscriber m_sub_robotDiagnostics;
182 ros::Subscriber m_sub_visionOutput;
183 ros::Subscriber m_sub_diveDecision;
186 ros::ServiceServer m_srv_visualiseClear;
187 ros::ServiceServer m_srv_visualiseDBH;
188 ros::ServiceServer m_srv_visualiseDbApp;
189 ros::ServiceServer m_srv_visualiseGcvXY;
192 void handleButtonData(
const nimbro_op_interface::ButtonConstPtr& msg);
194 void handleRobotHeadingData(
const robotcontrol::RobotHeadingConstPtr& msg);
195 void handleStoppedGaitCommand(
const gait_msgs::GaitCommandConstPtr& msg);
196 void handleRobotDiagnosticsData(
const robotcontrol::DiagnosticsConstPtr& msg);
197 void handleVisionOutputData(
const vision_module::vision_outputsConstPtr& msg);
198 void handleDiveDecision(
const std_msgs::StringConstPtr& msg);
201 bool handleVisualiseClear(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
202 bool handleVisualiseDBH(walk_and_kick::VisualiseDBHRequest& req, walk_and_kick::VisualiseDBHResponse& resp);
203 bool handleVisualiseDbApp(walk_and_kick::VisualiseDbAppRequest& req, walk_and_kick::VisualiseDbAppResponse& resp);
204 bool handleVisualiseGcvXY(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
215 void writeRGBLEDState()
const;
220 ros::Time m_lastLEDTime;
225 ButtonState m_lastButton;
226 std::string m_buttonName;
228 head_control::LookAtTarget m_headCmd;
229 gait_msgs::GaitCommand m_stoppedGaitCmd;
230 BehaviourState m_behState;
231 bool m_publishedNeutral;
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
An interface class to the ROS world for getting game controller messages.
Definition: wak_gc_ros.h:21
Visualisation marker manager for the walk and kick node.
Definition: wak_vis.h:21
The main walk and kick behaviour class.
Definition: walk_and_kick.h:34
boost::shared_ptr< State const > StateConstPtr
Used to represent a Boost shared pointer to a constant State object.
Definition: state_controller.h:413
An interface class to the ROS world for team communications.
Definition: wak_tc_ros.h:30
The base class for all walk and kick game states.
Definition: wak_game_state.h:26
The base class for all walk and kick behaviour states.
Definition: wak_beh_state.h:27
Visualisation marker manager for visualisations that are intended for when playing behaviour bags...
Definition: wak_vis.h:98
void resetGaitCommand(gait_msgs::GaitCommand &cmd)
Reset a gait command to zero.
Definition: gait_common.h:115
An interface class between the walk and kick and ROS worlds.
Definition: wak_ros_interface.h:54
An interface class for encapsulating all of the data that the walk and kick behaviour states should c...
Definition: wak_actuator_vars.h:22