mux nodelets(topic tools)-how to use them ?
i am trying to use the mux_nodelets using the below launch file
1 <node pkg="nodelet" type="nodelet" name="pcl_manager" args="manager" output="screen" />
2 <!-- MUX the data onto one topic -->
3 <node pkg="nodelet" type="nodelet" name="data_mux" args="load pcl/NodeletMUX pcl_manager" output="screen">
4 <rosparam>
5 input_topics: [/camera/points, /camera/state]
6 </rosparam>
7 </node>
my idea was to mutiplex topics:camera/state and camera/points and read the data_mux output (topic)
but it gives an error as below
Client [/image_converter1] wants topic /data_mux/output to have datatype/md5sum [std_msgs/String/992ce8a1687cec8c8bd883ec73ca41d1], but our version has [sensor_msgs/PointCloud2/1158d486dd51d683ce2f1be655c3c181]. Dropping connection
i understand the message type for the mux_nodelet output is PointCloud2 format. how do i change this to a required messsage type ?
If i have 2 topics which are having custom message type as input to mux_nodelet. How do i define the the mux_out topic, should i define a message type which is a mix of both the inputs topics ?
PS:the idea of using a nodelet was to save communication time
I am really new to nodelets .Please help .
edit : 16 nov
update : I complied the below code snipped below in one of my header files used in a node
typedef nodelet::NodeletMUX<camera_test::combine, message_filters::Subscriber<camera_test::combine> > NodeletMUX;
PLUGINLIB_DECLARE_CLASS (pcl, NodeletMUX, NodeletMUX, nodelet::Nodelet);
combine is message type defined in the package camera_test (combine message time is a custom message with Header)
but when i run the launch file below and run one addition node which publishes topics /camera/state
and /camera/points
.
<launch>
<node pkg="nodelet" type="nodelet" name="pcl_manager" args="manager" output="screen" />
<!-- MUX the data onto one topic -->
<node pkg="nodelet" type="nodelet" name="data_mux" args="load pcl/NodeletMUX pcl_manager" output="screen">
<rosparam>
input_topics: [/camera/state, /camera/points]
</rosparam>
</node>
</launch>
I get the below warning
[WARN] [1542361466.932969]: Could not process inbound connection: topic types do not match: [sensor_msgs/PointCloud2] vs. [camera_test/combine]{'topic': '/camera/state', 'tcp_nodelay': '0', 'md5sum': '1158d486dd51d683ce2f1be655c3c181', 'type': 'sensor_msgs/PointCloud2', 'callerid': '/pcl_manager'}
it looks like even after calling the PLUGLIB _DECLARE
class with new message type,it still expects the message type PointCloud2
? and if i do a rostopic echo data_mux out
,i get no messages
I don`t understand what i am doing wrong .could someone please Help ?
edit 3 : Below is my header file where i have declared the PLUGINLIB_DECLARE class
can you please suggest what i should change here ?
#include <pluginlib/class_list_macros.h>
#include <nodelet/nodelet.h>
#include <nodelet_topic_tools/nodelet_mux.h>
#include <message_filters/subscriber.h>
#include "camera_test/combine.h"
#include <nodelet_topic_tools/nodelet_demux.h>
#include <sensor_msgs/PointCloud2.h>
typedef nodelet::NodeletMUX<camera_test::combine, message_filters::Subscriber<camera_test::combine> > NodeletMUX;
PLUGINLIB_DECLARE_CLASS (pcl, NodeletMUX, NodeletMUX, nodelet::Nodelet);
//typedef nodelet::NodeletDEMUX<sensor_msgs::PointCloud2> NodeletDEMUX;
btw I have not added an plugin.xml file for this nodelet ? could that be the problem ?
the mux out still shows PointCloud2 rostopic info /data_mux/output Type: sensor_msgs/PointCloud2 Publishers: * /pcl_manager Subscribers: * /image_converter1
Could I please ask you to format your question properly next time? When copy-pasting code or console output (ie: errors/warnings), always select the text you just pasted and click the Preformatted Text button (the one with
101010
on it).yes,yes . i am sorry for that