Can 1 node subsrcibe MSG from a topic and publish MSG to other topic at the same time?
Hi all, I downloaded the face_recognition demo and pi_tracker demo, and I want to combine the two which means that I want the turtlebot recognized me at first and move as I wish. However, it means that I must publish MSG to contract with pi_tracker after being recognized, so in the face_rec_client.cpp, I added the code:
if(strcmp(feedback->names[0].c_str(),"David")==0)
{
ros::NodeHandle n1;
ros::Publisher chatter_pub = n1.advertise<std_msgs::String>("chatter1", 1000);
std_msgs::String msg;
std::stringstream ss;
ss << "You are Master!";'t
msg.data = ss.str();
ROS_INFO("%s", msg.data.c_str());
chatter_pub.publish(msg);
}
which means that if the turtlebot recognized me(David), it should publish a msg on topic "chatter1" as well as ROS_INFO the msg. NOW, THE QUESTION IS: it does print "You are Master" on screen, but I can't get it on topic "chatter1". so I think maybe I didn't publish the msg in the right way. anybody could help me? Thanks?