ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In principle this is allowed. However, you are probably changing the subscriptions very fast. To successfully get a message through after the subscribe call, the nodes must arrange for a connection to be opened and a message must be sent. This usually takes some time.
As soon as one loop cycle ends your subscribers go out of scope and will be destroyed, so depended on the code after ..... this code won't do what you want it to do.