Hi, I have a node which serves primarily as a service, but I would like it to be able to subscribe to a publisher so that I can import an array before the service is called. I tried adding the subscriber to the same nodehandle that has the service, and tried creating a second nodehandle. Either way it seems unable to receive data. Can I not have multiple services/subscribers in a node? If not, what is the best way to do this?
Here is my code in the main function, for reference
ros::NodeHandle servNode;
ros::NodeHandle subNode;
SteeringCaller steerCall;
steerCall.haveX = false; steerCall.haveBoth = false;
ros::Subscriber sub = subNode.subscribe<std_msgs::Float64MultiArray>("path", 5000, &SteeringCaller::savePath, &steerCall);
ros::ServiceServer service = servNode.advertiseService("steering_control", &SteeringCaller::calcSteering, &steerCall);
Originally posted by explorerbot on ROS Answers with karma: 1 on 2013-07-18
Post score: 0
Original comments
Comment by Georg on 2013-07-18:
This is too few information. Actually you can have multple publishers, subscribers and services in the same node. If you look at nodes like camera1394, you will see that they do this a lot. Actually, since the source code for ROS is available you can just have a look at it and learn from it!