15 #ifndef ROS_IGN_BRIDGE__FACTORY_HPP_
16 #define ROS_IGN_BRIDGE__FACTORY_HPP_
22 #include <ignition/transport/Node.hh>
34 template<
typename ROS_T,
typename IGN_T>
39 const std::string & ros_type_name,
const std::string & ign_type_name)
47 const std::string & topic_name,
50 return node.
advertise<ROS_T>(topic_name, queue_size);
53 ignition::transport::Node::Publisher
55 std::shared_ptr<ignition::transport::Node> ign_node,
56 const std::string & topic_name,
59 return ign_node->Advertise<IGN_T>(topic_name);
65 const std::string & topic_name,
67 ignition::transport::Node::Publisher & ign_pub)
72 ops.
topic = topic_name;
74 ops.
md5sum = ros::message_traits::md5sum<ROS_T>();
75 ops.
datatype = ros::message_traits::datatype<ROS_T>();
87 std::shared_ptr<ignition::transport::Node> node,
88 const std::string & topic_name,
93 std::function<void(
const IGN_T&,
94 const ignition::transport::MessageInfo &)> subCb =
95 [
this, ros_pub](
const IGN_T &_msg,
96 const ignition::transport::MessageInfo &_info)
99 if (!_info.IntraProcess())
103 node->Subscribe(topic_name, subCb);
111 ignition::transport::Node::Publisher & ign_pub,
112 const std::string &ros_type_name,
113 const std::string &ign_type_name)
117 if (!connection_header) {
118 ROS_ERROR(
"Dropping message %s without connection header",
119 ros_type_name.c_str());
123 std::string key =
"callerid";
124 if (connection_header->find(key) != connection_header->end()) {
135 ign_pub.Publish(ign_msg);
136 ROS_INFO_ONCE(
"Passing message from ROS %s to Ignition %s (showing msg"\
137 " only once per type)", ros_type_name.c_str(), ign_type_name.c_str());
142 const IGN_T & ign_msg,
156 const ROS_T & ros_msg,
161 const IGN_T & ign_msg,
170 #endif // ROS_BRIDGE__FACTORY_HPP_