How to subscribe and publish to /points_map topic
Here's my code:
foreignTopic::foreignTopic() {
chat_= n.advertise<sensor_msgs::PointCloud2>("multimaster/chatter", 1000);
}
void foreignTopic::callback(const sensor_msgs::PointCloud2::ConstPtr& msg){
chat_.publish(msg);
}
void multimaster::init(ros::M_string remappings) {
ros::Rate loop_rate(msgsFrequency_Hz);
foreignTopic pc;
//Create subscribers in the host and connect them to the foreign topics
remappings["__master"] = host_master;
ros::master::init(remappings);
ros::Subscriber subscriberFeedback = nh.subscribe("/points_map", 1, &foreignTopic::callback, &pc);
remappings["__master"] = foreign_master;
ros::master::init(remappings);
while(ros::ok() && ros::master::check()==true){
ros::spinOnce();
loop_rate.sleep();
}
}
My problem here is that there's no message when i read the /multimaster/chatter topic.