Skip to content

Use DiagnosticNodelet instead of ConnectionBasedNodelet.#2712

Open
iory wants to merge 2 commits intojsk-ros-pkg:masterfrom
iory:diagnostics
Open

Use DiagnosticNodelet instead of ConnectionBasedNodelet.#2712
iory wants to merge 2 commits intojsk-ros-pkg:masterfrom
iory:diagnostics

Conversation

@iory
Copy link
Copy Markdown
Member

@iory iory commented Jul 11, 2022

Modified all ConnectionBasedNodelets in jsk_recognition to DiagnosticNodelet.

$ cd jsk_recognition
$ grep ConnectionBasedNodelet -l -r --include='*.h' . | wc
0       0       0
$ grep ConnectionBasedNodelet -l -r --include='*.hpp' . | wc
0       0       0

Also, DiagnosticsNodelet requires poke.
There are many PRs out there that add poke, and this PR also added poke for all nodelets that do not have poke.
#2690
#2710
#2203

$ cd jsk_recognition
$ grep 'DiagnosticNodelet::onInit' -r . -l | xargs grep -L poke | sort
./.git/logs/HEAD
./.git/logs/refs/heads/reset-sync-policy
./resized_image_transport/src/image_resizer_nodelet.cpp
./resized_image_transport/src/log_polar_nodelet.cpp

The nodes of resized_image_transport inherit from image_processing_nodelet, and poke is called inside image_processing_nodelet.

void ImageProcessing::info_cb(const sensor_msgs::CameraInfoConstPtr &msg) {
boost::mutex::scoped_lock lock(mutex_);
info_vital_->poke();
info_msg_ = msg;
}
void ImageProcessing::image_nonsync_cb(const sensor_msgs::ImageConstPtr& msg) {
{
boost::mutex::scoped_lock lock(mutex_);
image_vital_->poke();
if (!info_msg_) {
NODELET_WARN_THROTTLE(1, "camera info is not yet available");
return;
}
}
callback(msg, info_msg_);
}


#include <pcl_ros/publisher.h>
#include <jsk_topic_tools/connection_based_nodelet.h>
#include <jsk_topic_tools/diagnostic_nodelet.h>
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 this code depends on jsk_topic_tools >= x.x.x, I would recommend to write something like PR2/pr2_mechanism@c2d2d7e#diff-b32b543817fc81911592c454ab29c1d29f6ce7cd2ab6dcd3a374014568a2ee55R81-R85

instead of using -DJSK_TOPIC_TOOLS_X_X_XAPI , will we introduce jsk_topic_tools_version.h ???(https://github.com/jsk-ros-pkg/jsk_common/blob/714713378fb037c9670bf48118010f1899c10bd5/jsk_topic_tools/CMakeLists.txt#L30-L32)

}


class BilateralFilter: public jsk_topic_tools::ConnectionBasedNodelet
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.

how about

#if  defined(JSK_TOPIC_TOOLS_VERSION) and JKS_NODELET_VERSION_MINIMUM(2,2,13))
    #define jsk_topic_tools::NODLET jsk_topic_tools::ConnectionBasedNodelet
#else
    #define jsk_topic_tools::NODLET jsk_topic_tools::DiagnosticNodelet
#endif

@iory
Copy link
Copy Markdown
Member Author

iory commented Aug 26, 2022

@k-okada
Thanks for your feedback.

I have changed to use ConnectionBasedNodelet if the version of jsk_topic_tools is lower than 2.2.13 and Diagnostic Nodelet otherwise.

#include <jsk_recognition_utils/jsk_topic_tools_version.h>
#if JSK_TOPIC_TOOLS_VERSION_MINIMUM(2,2,13)
  #include <jsk_topic_tools/diagnostic_nodelet.h>
  namespace jsk_topic_tools {
    #define NODELET DiagnosticNodelet
  }
#else
  #include <jsk_topic_tools/connection_based_nodelet.h>
  namespace jsk_topic_tools {
    #define NODELET ConnectionBasedNodelet
  }
#endif

The released 2.2.12 does not include some bug fixes.
jsk-ros-pkg/jsk_common#1752 jsk-ros-pkg/jsk_common#1735

Because DiagnosticNodelet has those bugs, it is enabled only after jsk_topic_tools 2.2.13.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants