-
Notifications
You must be signed in to change notification settings - Fork 160
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
ros2doctor: add topic check #341
Conversation
Signed-off-by: claireyywang <clairewang@openrobotics.org>
Signed-off-by: claireyywang <clairewang@openrobotics.org>
…2cli into claire/ros2doctor-topic Signed-off-by: claireyywang <clairewang@openrobotics.org>
89bc6c3
to
9095d55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide some steps to test this feature? I'm not sure what changes to expect in the output.
ros2doctor/ros2doctor/api/topic.py
Outdated
from ros2doctor.api import DoctorReport | ||
from ros2doctor.api import Report | ||
from ros2doctor.api import Result | ||
from ros2topic.api import get_topic_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should declare a dependency to ros2topic
in the package.xml
.
But, IMO, it would be nicer if we didn't have to depend on another CLI tool and instead call the rclpy
API directly.
ros2doctor/ros2doctor/api/topic.py
Outdated
result = Result() | ||
to_be_checked = _get_topics() | ||
for topic in to_be_checked: | ||
with DirectNode(topic) as node: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the overhead is for repeatedly creating and destroying DirectNode
, but in any case, it looks like we can safely use the same instance for the duration of the for-loop. I recommend restructuring like:
with DirecNode(topic) as node:
for topic in to_be_checked:
ros2doctor/ros2doctor/api/topic.py
Outdated
if not to_be_reported: | ||
report.add_to_report('topic', 'none') | ||
for topic in to_be_reported: | ||
with DirectNode(topic) as node: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. Consider changing the scope of the node context.
Signed-off-by: claireyywang <clairewang@openrobotics.org>
Signed-off-by: claireyywang <clairewang@openrobotics.org>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor comment, otherwise LGTM with green CI.
Signed-off-by: claireyywang <clairewang@openrobotics.org>
Check for cases like pub without sub or sub without pub using
ros2topic
andros2cli
API. Report contains same content asros2 topic info
outputs. Also adds unit tests forTopicCheck
andTopicReport
.