Skip to content

Commit

Permalink
Use NodeStrategy instead of DirectNode for showing topic list.
Browse files Browse the repository at this point in the history
We also need to register functions for NodeStrategy: count_publishers and
count_subscribers.

Signed-off-by: evshary <[email protected]>
  • Loading branch information
evshary authored and claireyywang committed Oct 25, 2019
1 parent 0d6c6e8 commit 2c848ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ros2cli/ros2cli/daemon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def main(*, script_name='_ros2_daemon', argv=None):
_print_invoked_function_name(node.get_topic_names_and_types))
server.register_function(
_print_invoked_function_name(node.get_service_names_and_types))
server.register_function(node.count_publishers)
server.register_function(node.count_subscribers)

shutdown = False

Expand Down
4 changes: 2 additions & 2 deletions ros2topic/ros2topic/verb/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from ros2cli.node.direct import DirectNode
from ros2cli.node.strategy import add_arguments
from ros2cli.node.strategy import NodeStrategy
from ros2topic.api import get_topic_names_and_types
from ros2topic.verb import VerbExtension

Expand Down Expand Up @@ -51,7 +51,7 @@ def add_arguments(self, parser, cli_name):

def main(self, *, args):
topic_info = []
with DirectNode(args) as node:
with NodeStrategy(args) as node:
topic_names_and_types = get_topic_names_and_types(
node=node,
include_hidden_topics=args.include_hidden_topics)
Expand Down

0 comments on commit 2c848ef

Please sign in to comment.