diff --git a/pps_wiki/faq.md b/pps_wiki/faq.md index cb8e93d976c27989c4c61121cd39d517ec9f8136..9616a8e948c2716ba0b7e25352e75042a7be7408 100644 --- a/pps_wiki/faq.md +++ b/pps_wiki/faq.md @@ -270,6 +270,7 @@ if (true) ros::Subscriber my_subscriber = nodeHandle.subscribe("/fortytwo",1,fortytwoCallback); } ``` + then the subscriber only exists while the code between the ``{}`` is being exectuted and it is removed after the ``if`` statement has finished executing. To make the subscriber persist, then you need to declare the subscriber varaible outside of the ``if`` statement's context, i.e., ``` ros::Subscriber my_subscriber;