Created public get_topic_list() function for use in other scripts.#1146
Created public get_topic_list() function for use in other scripts.#1146EliteMasterEric wants to merge 12 commits intoros:lunar-develfrom
Conversation
…sage, and removed an unnecessary import.
|
After extracting the print-agnostic part of the existing functionality as you did in the current patch please also update the existing code to use this new function (rather than duplicating this logic). Please also consider adding a test for the new function. |
e5f5ffb to
150114e
Compare
|
@dirk-thomas Changes have been made, removing redundancy and adding a test to the rostopic test script. |
dirk-thomas
left a comment
There was a problem hiding this comment.
Please make sure to run all code parts you have changed in all possible variations to make sure the patch actually works (which is currently not the case).
| topic_types = _master_get_topic_types(master) | ||
|
|
||
| pubs, subs, _ = state | ||
| publishers = [] |
There was a problem hiding this comment.
This line is overwriting the function parameter.
Same below for subscribers.
| publishers = [] | ||
| if publishers: | ||
| for topic, nodes in pubs: | ||
| publishers.append(topic, topic_type(topic, topic_types), len(nodes)) |
There was a problem hiding this comment.
list.append() only accepts a single argument.
Same below.
| topic_ns = rosgraph.names.make_global_ns(topic) | ||
| subs = (x for x in subs if x[0] == topic or x[0].startswith(topic_ns)) | ||
| pubs = (x for x in pubs if x[0] == topic or x[0].startswith(topic_ns)) | ||
| pubs, subs = get_topic_list() |
There was a problem hiding this comment.
The new function returns different information than getSystemState before. I doubt that all following code continues to work as is.
The existing rostopic_list functions output straight to print() calls, so they are only functional for the CLI. Resolves issue ros#946. Added new public function to tests. Updated functions to use new public function to remove redundancy.
150114e to
7685713
Compare
Resolves issue #946.
The only function in rostopic for listing the available topics is built exclusively for the command line interface; this adds a public function for other applications that want a list of topics.
Usage: