semio_ros  0.10.6
humanoid_sink_ros.h
Go to the documentation of this file.
1 #ifndef _SEMIO_ROS_HUMANOIDSINKROS_H_
2 #define _SEMIO_ROS_HUMANOIDSINKROS_H_
3 
5 #include <ros/node_handle.h>
6 #include <semio_msgs_ros/Humanoids.h>
7 
8 namespace semio
9 {
10 
11 namespace ros
12 {
13 
14 //! semio::HumanoidSink to sink humanoids to ROS
15 /**
16 @par ROS Topics
17 <table>
18 <tr><th>Topic</th><th>Type</th><th>Description</th></tr>
19 <tr><td colspan="3" align="center">@b Publications</td></tr>
20 <tr><td>variable; see @p topic param of @ref HumanoidSinkROS()</td><td>@ref semio_msgs_ros<a href=Humanoids_8msg_source.html><b>/Humanoids</b></a></td><td>#_HumanoidsMsg messages to convert to @c semio::HumanoidArray</td></tr>
21 </table>
22 */
24 {
25 public:
26  //! ROS message for a vector of humanoids
27  typedef semio_msgs_ros::Humanoids _HumanoidsMsg;
28  //! ROS message for a single humanoid
29  typedef semio_msgs_ros::Humanoid _HumanoidMsg;
30  //! ROS message for a humanoid joint
31  typedef semio_msgs_ros::HumanoidJoint _HumanoidJointMsg;
32 
33 protected:
34  //! NodeHandle copy for interfacing with ROS
35  ::ros::NodeHandle _nh_rel;
36  //! Publisher for humanoid messages
37  ::ros::Publisher _humanoids_pub;
38 
39 public:
40  /**
41  @param nh_rel @copybrief _nh_rel
42  @param topic ROS topic on which to publish humanoids
43  */
44  HumanoidSinkROS( ::ros::NodeHandle const & nh_rel, std::string const & topic = "humanoids" );
45 
46  //! Create a #_HumanoidJointMsg\::Ptr from a semio::HumanoidJoint
47  /**
48  @param joint The joint to use
49  @return A #_HumanoidJointMsg\::Ptr initialized from the data in @p joint
50  */
51  static _HumanoidJointMsg::Ptr toROSMsgPtr( HumanoidJoint const & joint );
52  //! Create a #_HumanoidJointMsg from a semio::HumanoidJoint
53  /**
54  @param joint The joint to use
55  @return A #_HumanoidJointMsg initialized from the data in @p joint
56  */
57  static _HumanoidJointMsg toROSMsg( HumanoidJoint const & joint );
58 
59  //! Create a #_HumanoidMsg\::Ptr from a semio::Humanoid
60  /**
61  @param humanoid The humanoid to use
62  @return A #_HumanoidMsg\::Ptr initialized from the data in @p humanoid
63  */
64  static _HumanoidMsg::Ptr toROSMsgPtr( Humanoid const & humanoid );
65  //! Create a #_HumanoidMsg from a semio::Humanoid
66  /**
67  @param humanoid The humanoid to use
68  @return A #_HumanoidMsg initialized from the data in @p humanoid
69  */
70  static _HumanoidMsg toROSMsg( Humanoid const & humanoid );
71 
72  //! Create a #_HumanoidsMsg\::Ptr from a semio::Humanoids
73  /**
74  @param humanoids The humanoid array to use
75  @return A #_HumanoidsMsg\::Ptr initialized from the data in @p humanoids
76  */
77  static _HumanoidsMsg::Ptr toROSMsgPtr( HumanoidArray const & humanoids );
78  //! Create a #_HumanoidsMsg from a semio::Humanoids
79  /**
80  @param humanoids The humanoid array to use
81  @return A #_HumanoidsMsg initialized from the data in @p humanoids
82  */
83  static _HumanoidsMsg toROSMsg( HumanoidArray const & humanoids );
84 
85 protected:
86  //! Convert @p humanoids to a ROS message and publish it to ROS
87  /**
88  @param humanoids The semio::HumanoidArray to convert and publish to ROS
89  */
90  virtual void publishToSink( HumanoidArray const & humanoids );
91 };
92 
93 }
94 
95 }
96 
97 #endif // _SEMIO_ROS_HUMANOIDSINKROS_H_
::ros::NodeHandle _nh_rel
NodeHandle copy for interfacing with ROS.
virtual void publishToSink(HumanoidArray const &humanoids)
Convert humanoids to a ROS message and publish it to ROS.
semio_msgs_ros::Humanoid _HumanoidMsg
ROS message for a single humanoid.
static _HumanoidJointMsg toROSMsg(HumanoidJoint const &joint)
Create a _HumanoidJointMsg from a semio::HumanoidJoint.
semio::HumanoidSink to sink humanoids to ROS
semio_msgs_ros::HumanoidJoint _HumanoidJointMsg
ROS message for a humanoid joint.
static _HumanoidJointMsg::Ptr toROSMsgPtr(HumanoidJoint const &joint)
Create a _HumanoidJointMsg::Ptr from a semio::HumanoidJoint.
semio_msgs_ros::Humanoids _HumanoidsMsg
ROS message for a vector of humanoids.
std::vector< semio::Humanoid > HumanoidArray
::ros::Publisher _humanoids_pub
Publisher for humanoid messages.
HumanoidSinkROS(::ros::NodeHandle const &nh_rel, std::string const &topic="humanoids")