ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
2022-01-03 00:43:04 -0500 | received badge | ● Stellar Question (source) |
2020-04-11 16:57:21 -0500 | received badge | ● Favorite Question (source) |
2019-05-26 22:35:39 -0500 | received badge | ● Great Question (source) |
2018-05-15 22:30:22 -0500 | received badge | ● Good Question (source) |
2017-04-11 12:07:00 -0500 | marked best answer | Publishing to a topic via subscriber callback function Hello, I am wondering if anybody could help me with this problem. I have a listener that just publishes to a topic when another topic is published data, so basically the topic it is listening on gets data published. I have tried putting global variable in the code whose change can map into the main function but ros is not allowing global variables. I also tried to define the nodehandle as global but ros is not allowing this either. (I think before rosinit no ros components will be recognized). My code is in C++. Any help as to what could be done would be really appreciated. I am including a basic skeleton of the code I am trying: |