Skip to content

Add ros2 node info verb#159

Merged
jacobperron merged 5 commits intoros2:masterfrom
ross-desmond:node_graph_impl
Dec 7, 2018
Merged

Add ros2 node info verb#159
jacobperron merged 5 commits intoros2:masterfrom
ross-desmond:node_graph_impl

Conversation

@ross-desmond
Copy link
Copy Markdown
Contributor

@ross-desmond ross-desmond commented Nov 16, 2018

Summary: Provide the info verb under the node command

ros2 node info /minimal_publisher

Example:

/minimal_publisher
  Subscribers:
    /parameter_events: rcl_interfaces/ParameterEvent
  Publishers:
    /parameter_events: rcl_interfaces/ParameterEvent
    /topic: std_msgs/String
  Services:
    /minimal_publisher/describe_parameters: rcl_interfaces/DescribeParameters
    /minimal_publisher/get_parameter_types: rcl_interfaces/GetParameterTypes
    /minimal_publisher/get_parameters: rcl_interfaces/GetParameters
    /minimal_publisher/list_parameters: rcl_interfaces/ListParameters
    /minimal_publisher/set_parameters: rcl_interfaces/SetParameters
    /minimal_publisher/set_parameters_atomically: rcl_interfaces/SetParametersAtomically

Connects to ros2/rcl#333

@tfoote tfoote added the in review Waiting for review (Kanban column) label Nov 16, 2018
@ross-desmond
Copy link
Copy Markdown
Contributor Author

Connected to rcl

@ross-desmond ross-desmond mentioned this pull request Nov 20, 2018
34 tasks
@thomas-moulard
Copy link
Copy Markdown

@ross-desmond PTAL at https://github.com/thomas-moulard/ros2cli/tree/node_graph_impl - this fixes issues with flake8
Confirmed tests are passing locally.

Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments, but once those are addressed, this will be ready with a green CI.

print('All nodes found:')
print(*[n.full_name for n in node_names], sep=', ')
print('Unable to find node ' + args.node_name)
return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fairly minor, but it looks like the return value from main is used to determine whether the command "succeeded" or "failed". In this else clause, we probably want to return 'Unable to find node' so that it is a failure case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up changing this again in eb3dc36 (sorry I wasn't more clear the first time). Two things: the command-line tools already print out whatever you return here, and the full list of node names is already available through ros2 node list -a. Thus, I simplified this to just a return error message.

Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code generally looks fine to me now. However, when I go to run it, I am always getting a Segmentation fault (where it is moves around, but I always get it):

ubuntu@ros2-bionic:~/ros2_ws$ ros2 node list
/cam2image
ubuntu@ros2-bionic:~/ros2_ws$ ros2 node info /cam2image
/cam2image
Segmentation fault (core dumped)

I'm going to hold off approving until we get that figured out.

Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code generally looks OK to me now. However, I'm always getting a segmentation fault when running it now:

ubuntu@ros2-bionic:~/ros2_ws$ ros2 node list
/cam2image
ubuntu@ros2-bionic:~/ros2_ws$ ros2 node info /cam2image
/cam2image
Segmentation fault (core dumped)

I'll note that this is in all likelihood not in this code, but I'm going to hold off approving until we get it figured out.

@clalancette clalancette dismissed their stale review December 6, 2018 15:25

New review now.

@clalancette
Copy link
Copy Markdown
Contributor

OK, I figured out the segfault and fixed it in ros2/rclpy@dc8edb3 . So I'll approve this now.


def parse_node_name(full_node_name):
tokens = full_node_name.split('/')
if 1 > len(tokens):
Copy link
Copy Markdown
Member

@jacobperron jacobperron Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a guard against cases for empty string or '/' instead? I think split will always return at least one element, even if it is the empty string.

],
'ros2node.verb': [
'list = ros2node.verb.list:ListVerb',
'info = ros2node.verb.info:InfoVerb',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps this should be alphabetized

Copy link
Copy Markdown
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments above are pretty minor and don't necessarily have to be addressed. LGTM!

@jacobperron jacobperron merged commit 8e9d718 into ros2:master Dec 7, 2018
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants