Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a non verbose (quiet) mode for rosnode info #809

Merged
merged 1 commit into from
May 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions tools/rosnode/src/rosnode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def get_node_connection_info_description(node_api, master):
raise ROSNodeIOException("Communication with node[%s] failed!"%(node_api))
return buff

def rosnode_info(node_name):
def rosnode_info(node_name, quiet=False):
"""
Print information about node, including subscriptions and other debugging information. This will query the node over the network.

Expand All @@ -578,10 +578,10 @@ def topic_type(t, pub_topics):
if not node_api:
print("cannot contact [%s]: unknown node"%node_name, file=sys.stderr)
return

print("\ncontacting node %s ..."%node_api)

print(get_node_connection_info_description(node_api, master))
if not quiet:
print("\ncontacting node %s ..." % node_api)
print(get_node_connection_info_description(node_api, master))

# backwards compatibility (deprecated)
rosnode_debugnode = rosnode_info
Expand Down Expand Up @@ -613,12 +613,17 @@ def _rosnode_cmd_info(argv):
Implements rosnode 'info' command.
"""
args = argv[2:]
parser = OptionParser(usage="usage: %prog info node1 [node2...]", prog=NAME)
parser = OptionParser(usage="usage: %prog info [options] node1 [node2...]",
prog=NAME)
parser.add_option("-q", "--quiet",
dest="quiet", default=False,
action="store_true",
help="Prints only basic information such as pubs/subs and does not contact nodes for more information")
(options, args) = parser.parse_args(args)
if not args:
parser.error("You must specify at least one node name")
for node in args:
rosnode_info(node)
rosnode_info(node, options.quiet)

def _rosnode_cmd_machine(argv):
"""
Expand Down