9 #include <walk_and_kick/wak_common.h>
10 #include <walk_and_kick/TeamCommsData.h>
11 #include <boost/shared_ptr.hpp>
16 namespace walk_and_kick
19 class TCRobotListener;
22 typedef boost::shared_ptr<const TCRobotListener> TCRobotListenerConstPtr;
23 typedef std::vector<TCRobotListenerConstPtr> TCRobotListenerList;
41 void startListening(
bool listenToSelf =
false);
45 const TCRobotListenerList& teamComms()
const {
return m_teamComms; }
46 unsigned int nextRobotUID()
const {
return m_teamComms.size(); }
53 typedef boost::shared_ptr<TCRobotListener> TCRobotListenerPtr;
54 typedef std::vector<TCRobotListenerPtr> TCRobotListenerListInternal;
55 TCRobotListenerListInternal m_teamCommsInternal;
56 TCRobotListenerList m_teamComms;
68 TCRobotListener(ros::NodeHandle& nh,
const std::string& robot,
unsigned int robotUID) : robot(robot), robotUID(robotUID), m_lastEmbeddedStamp(0, 0) { m_subscriber = nh.subscribe(
"/remote/" + robot +
"/walk_and_kick/teamPacket", 1, &TCRobotListener::handleTeamPacket,
this); }
72 void resetData() { m_data = TeamCommsData(); m_lastEmbeddedStamp = ros::Time(); }
75 const std::string robot;
76 const unsigned int robotUID;
79 const TeamCommsData& data()
const {
return m_data; }
86 ros::Subscriber m_subscriber;
87 void handleTeamPacket(
const TeamCommsDataConstPtr& msg);
90 ros::Time m_lastEmbeddedStamp;
An interface class to the ROS world for team communications.
Definition: wak_tc_ros.h:30
A class that listens to the team communications data of one particular robot.
Definition: wak_tc_ros.h:64