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

[jsk_topic_tools][connection_based_nodelet] warn if onInitPostProcess is not called #1513

Merged
merged 1 commit into from
Mar 30, 2017

Conversation

furushchev
Copy link
Member

@wkentaro
Copy link
Member

wkentaro commented Mar 29, 2017

Nice feature. Why we need the param no_warn_on_init_post_process?
Is it not good of warning always?

@furushchev
Copy link
Member Author

@wkentaro I'd like to, but the current implementation does not monitor exact end of onInit execution, but only wait 5 seconds and check if it is done, so if we have some process that takes more than 5 seconds, it always warns if onInit is called. I mean the option is advanced one for that case.

@wkentaro
Copy link
Member

Ok, so it depends on the implementation of the nodelet and there are few reasons why we use rosparam for that option, right?
Maybe you can set the duration of the timer as the data field.

@furushchev
Copy link
Member Author

@wkentaro I think if we could mind about the duration, we already could notice that we forgot onInitPostProcess, so I don't think we want to change duration but just on / off.
If you prefer not to use rosparam, how about calling like: onInitProcess(/*warnOnInitPostProcess=*/ false) ? (None the less, I prefer rosparam because we can't know how long it takes on onInit beforehand.)

@wkentaro
Copy link
Member

wkentaro commented Mar 29, 2017

But if you want to change on/off, you already notice that you forget onInitPostProcess, right?
And if you know the duration is around 10s, in standard PC or Robots, you set duration as 10s. This is the reason why I suggest the param of duration.
I'm not so particular about the use of rosparam and configurable duration, but not sure why you need the flag ~no_warn_on_init_post_process.

void ConnectionBasedNodelet::warnOnInitPostProcessCalledCallback(const ros::WallTimerEvent& event)
{
if (!on_init_post_process_called_) {
NODELET_WARN("[%s] onInitPostProcess is not yet called.", nodelet::Nodelet::getName().c_str());
Copy link
Member

Choose a reason for hiding this comment

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

[%s] should be set using ROSCONSOLE_FORMAT.
http://wiki.ros.org/rosconsole

export ROSCONSOLE_FORMAT='[${severity}] [${time}]: ${message}'


// timer to warn when onInitProcess is not called
pnh_->param("no_warn_on_init_post_process", on_init_post_process_called_, false);
if (!on_init_post_process_called_) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure exactly why you need this.

@furushchev
Copy link
Member Author

But if you want to change on/off, you already notice that you forget onInitPostProcess, right?

Right, but even if you remember and write onInitPostProcess at the end of onInit, this warning will be shown if onInit takes longer than 5 secs.
If reconfigurable parameter is confusing, I think it's also good idea to pass it like:

void HogeNodelet::onInit() {
  DiagnosticNodelet::onInit(/*warn onInitPostProcess = */ false);
  // PROCESS may take more than 5 seconds
  onInitPostProcess();
}

But I thought that non-advanced developers may copy & paste the first line, so I chose to use parameter.

@wkentaro
Copy link
Member

Yeah. So I thought configurable duration was better.

But I thought that non-advanced developers may copy & paste the first line, so I chose to use parameter.
Add your review

I think non-advanced developers won't notice the rosparam, either.
And +1 for warn_on_init_post_process flag, and +10 for expected_duration_of_on_init and use it also for timer_warn_never_subscribed_ which also use 5s for the duration.

@furushchev
Copy link
Member Author

@k-okada Any comment? If timedout I'll change as @wkentaro says.

@k-okada k-okada merged commit e5b9ebe into jsk-ros-pkg:master Mar 30, 2017
@furushchev furushchev deleted the warn-no-init-post-process branch March 30, 2017 09:11
@wkentaro
Copy link
Member

?

@k-okada
Copy link
Member

k-okada commented Mar 30, 2017

sorry, I did not catch the discussion,

warn_on_init_post_process flag: true
expected_duration_of_on_init : 5

and

+      NODELET_WARN("[%s] onInitPostProcess is not yet called. You are forgetting to call this in the end of onInit or onInit takes more than ~d seconds", nodelet::Nodelet::getName().c_str(), expected_duration_of_on_init  );

@wkentaro
Copy link
Member

yeah, there may be some better param names like on_init_duration.

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.

3 participants