Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

[rostopic] Get multiple topics with rostopic hz#712

Closed
wkentaro wants to merge 6 commits intoros:indigo-develfrom
wkentaro:topic-hz-monitor
Closed

[rostopic] Get multiple topics with rostopic hz#712
wkentaro wants to merge 6 commits intoros:indigo-develfrom
wkentaro:topic-hz-monitor

Conversation

@wkentaro
Copy link
Copy Markdown
Contributor

@wkentaro wkentaro commented Dec 4, 2015

No description provided.

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Dec 4, 2015

it looks like
image

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Dec 4, 2015

This is designed to find bottleneck of topic node flow. So it supports --search-parent option which automatically detect parent topics of specified one.

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.

This line will fail if ret is None but not self.times.

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.

Thanks. fixed.

@wkentaro
Copy link
Copy Markdown
Contributor Author

Maybe this can be supported by rostopic hz by rostopic hz [topic1] [topic2] ....
What do you think about this?

@wkentaro
Copy link
Copy Markdown
Contributor Author

Now it looks like
image

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.

msg_class is only set in the previous loop (line 230) which doesn't seem to be what you want?

@dirk-thomas
Copy link
Copy Markdown
Member

Can you please describe what a parent topic is?

Also the two features (multiple topics for hz and parent topics) seem to be independent from each other (except that the later one needs the former one). Please use separate PRs or at least commits for this in the future since it simplifies the review significantly.

wkentaro added a commit to wkentaro/ros_comm that referenced this pull request Dec 15, 2015
Parent topics means that topics to which the specified topic subscribes to
Depends on ros#712
wkentaro added a commit to wkentaro/ros_comm that referenced this pull request Dec 15, 2015
Parent topics means that topics to which the specified topic subscribes to
Depends on ros#712
@wkentaro wkentaro changed the title topic_hz_monitor: Script to monitor multiple topic hz rate rostopic Jan 5, 2016
@wkentaro wkentaro changed the title rostopic rostopic hz: Get multiple topics' hz Jan 5, 2016
import threading
self.lock = threading.Lock()
self.last_printed_tn = 0
self.last_msg_tn = 0
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.

Please do not change the name of this variable. It is publically visible and it would break the API to rename it.

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Mar 2, 2016

I updated the commit aside from above comment.

@dirk-thomas
Copy link
Copy Markdown
Member

@ros-pull-request-builder retest this please

@dirk-thomas
Copy link
Copy Markdown
Member

Jenkins fails to build this branch. Please make sure it is rebased to the latest devel branch to avoid potential problems.

@dirk-thomas
Copy link
Copy Markdown
Member

The test still times out.

print the average publishing rate to screen
"""
if not self.times:
return
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.

If get_hz would distinguish this case with a different return value this extra check would not be necessary.

@dirk-thomas
Copy link
Copy Markdown
Member

Thanks for fixing the build and the tests. I added a few more comments inline but they should be fairly easy to address.

@wkentaro
Copy link
Copy Markdown
Contributor Author

Thanks, I applied changes according to your comments. Could you please check them again?

@wkentaro wkentaro changed the title rostopic hz: Get multiple topics' hz [rostopic] Get multiple topics with rostopic hz May 11, 2016
args = argv[2:]
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog hz /topic", prog=NAME)
parser = OptionParser(usage="usage: %prog hz [optioncs] /topic_0 [/topic_1 [[topic_2 [..]]]]", prog=NAME)
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.

Spelling.

The previous question remains:

What are the trailing two dots for?

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.

I mean topic_0 [/topic_1 [[topic_2 [topic_3 [topic_4 [topic_5 [..]]]]]]]

@wkentaro wkentaro force-pushed the topic-hz-monitor branch from b4c68c8 to f4d57a1 Compare May 19, 2016 09:24
@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented May 19, 2016

Fixed spelling, and fixed the breaking public api with default value for argument.

args = argv[2:]
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog hz /topic", prog=NAME)
parser = OptionParser(usage="usage: %prog hz [options] /topic_0 [/topic_1 [[topic_2 [..]]]]", prog=NAME)
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.

I will replace the double [[ with a single [ when cherry-picking the changes.

@dirk-thomas
Copy link
Copy Markdown
Member

Thank you for providing this enhancement. I have cherry-picked the changes to the kinetic-devel branch: a6a4e57

@wkentaro wkentaro deleted the topic-hz-monitor branch June 27, 2016 20:24
@wkentaro
Copy link
Copy Markdown
Contributor Author

Thank you!

@dirk-thomas
Copy link
Copy Markdown
Member

I just run into a problem with this new feature when testing #874. If you pass two topic names but only one of them has any activity the command only prints "no new messages" and doesn't show the information about the topic which does have data.

@wkentaro Can you please look into this problem and make a PR for it (the tests should probably also cover that case).

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Sep 3, 2016

I think #886 fixes the problem, but not sure how to test it.
Currently the testing is disabled, and enabling it leads test fails.
https://github.com/ros/ros_comm/blob/kinetic-devel/tools/rostopic/test/check_rostopic_command_line_online.py#L116-L127

@dirk-thomas
Copy link
Copy Markdown
Member

Since this PR changes the public API of ROSTopicHz it breaks downstream code which uses the class. E.g. it breaks rqt_topic. While this specific code can be updated to work with the old API (list) as well as the new API (dict) I am not sure if it is a good idea risking to break more downstream code. Maybe this PR (as well as all other ones building on top) should be reverted? Or this can be updated somehow to maintain backward compatibility?

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Sep 9, 2016

I agree that the code should be changed for the backward compatibility, but currently I don't have time to work on that, so it cannot be done soon.
So could you please revert this at this time, and open an issue for this? I will work for that later.
The better implementation seems using multiple ROSTopicHz class in rostopic_hz command and print hz with get_hz and _get_ascii_table, without changes on member variables of ROSTopicHz.

@dirk-thomas
Copy link
Copy Markdown
Member

Since we have already merged quite a bit of stuff on-top of this patch I rather spent time on actually fixing the API than trying to revert all the changes (knowing that I will have to reapply them in the near future again). Therefore I created #896 to restore API compatibility..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants