From 03e30e3156447badec50a9198945e93d3fac61c0 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 8 Dec 2022 17:39:25 +0900 Subject: [PATCH 01/11] add test to compile on 22.04, see #1770 --- .github/workflows/config.yml | 74 ++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 782b7943b..510c54d4d 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -84,3 +84,77 @@ jobs: TEST_PKGS : ${{ matrix.TEST_PKGS }} BEFORE_SCRIPT : ${{ matrix.BEFORE_SCRIPT }} EXTRA_DEB : ${{ matrix.EXTRA_DEB }} + + + ubuntu: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - DISTRO: ubuntu:22.04 + + container: ${{ matrix.DISTRO }} + + steps: + - name: Chcekout Source + uses: actions/checkout@v3.0.2 + + - name: Install Buildtools + run: | + set -x + echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + apt update -q + apt install -y -q -qq catkin git curl build-essential libboost-all-dev python3-pip python3-venv python3-rosdep2 + apt install -y -q -qq ros-desktop-dev rosbash + apt install -y -q -qq libself-test-dev libpcl-ros-dev + apt install -y -q -qq ros-core-dev ros-robot-dev + pip install vcstool + rosdep update + + - name: Setup rosinstall_generator + run: | + set -x + # install rosinstall_geneartor with --depend-type buildtool build, see https://github.com/ros-infrastructure/rosinstall_generator/pull/81 + git clone https://github.com/k-okada/rosinstall_generator -b add_depend_type + cd rosinstall_generator + python3 ./setup.py install + + - name: Setup Dependencies Workspace + run: | + set -x + # install dependencies + mkdir -p ~/ws_depend/src + cd ~/ws_depend/src + ROS_PACKAGE_PATH=/usr/share rosinstall_generator --rosdistro noetic --from-path $GITHUB_WORKSPACE --deps --exclude RPP --depend-type buildtool build | tee repos + vcs import --shallow < repos + # override to use latest development for 22.04 + rosinstall_generator laser_filters laser_assembler map_server --rosdistro noetic --upstream-development | vcs import --force + rosinstall_generator catkin_virtualenv --rosdistro noetic | vcs import --force + rm -fr jsk_common + curl -s -L -O https://patch-diff.githubusercontent.com/raw/locusrobotics/catkin_virtualenv/pull/89.diff + patch -p1 < 89.diff + rosdep install -qq -r -y --from-path . --ignore-src || echo "OK" + cd .. + catkin_make_isolated --cmake-args -DCATKIN_ENABLE_TESTING=OFF + + - name: Setup Workspace + run: | + set -x + # hack! + apt install -y -q -qq python-is-python3 + sed -i s/noetic/Debian/ $GITHUB_WORKSPACE/jsk_rosbag_tools/CMakeLists.txt + # setup workspace + mkdir -p ~/ws_current/src + cd ~/ws_current/src + ln -sf $GITHUB_WORKSPACE . + rosdep install -qq -r -y --from-path . --ignore-src || echo "OK" + + - name: Compile Packages + run: | + set -x + cd ~/ws_current/ + source ~/ws_depend/devel_isolated/setup.bash + catkin_make_isolated --cmake-args -DCATKIN_ENABLE_TESTING=OFF + shell: bash From 18e200ca51ac035af3e8ab5955cde2b76fc9c980 Mon Sep 17 00:00:00 2001 From: v4hn Date: Tue, 4 Oct 2022 14:08:09 +0200 Subject: [PATCH 02/11] do not specify c++ standard it break with current log4cxx which requires c++17. No, going forward it's no option to specify the standard anymore. And it's not necessary either. --- jsk_ros_patch/image_view2/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/jsk_ros_patch/image_view2/CMakeLists.txt b/jsk_ros_patch/image_view2/CMakeLists.txt index c9509c3c9..447840333 100644 --- a/jsk_ros_patch/image_view2/CMakeLists.txt +++ b/jsk_ros_patch/image_view2/CMakeLists.txt @@ -11,12 +11,6 @@ if (CMAKE_VERSION VERSION_LESS 3.4) endif(CCACHE_FOUND) endif() -if(NOT $ENV{ROS_DISTRO} STRLESS noetic) - add_compile_options(-std=c++14) -elseif(NOT $ENV{ROS_DISTRO} STRLESS kinetic) - add_compile_options(-std=c++11) -endif() - find_package(catkin REQUIRED COMPONENTS roscpp dynamic_reconfigure cv_bridge std_msgs sensor_msgs geometry_msgs image_transport tf image_geometry message_filters message_generation std_srvs pcl_ros) generate_dynamic_reconfigure_options( From bbf92efeb74a7e886db9bf0262d4937008f81f7b Mon Sep 17 00:00:00 2001 From: v4hn Date: Sat, 29 Oct 2022 17:06:11 +0200 Subject: [PATCH 03/11] update pluginlib includes the non-hpp headers are deprecated since kinetic --- jsk_topic_tools/src/block_nodelet.cpp | 2 +- jsk_topic_tools/src/deprecated_relay_nodelet.cpp | 2 +- jsk_topic_tools/src/hz_measure_nodelet.cpp | 2 +- jsk_topic_tools/src/lightweight_throttle_nodelet.cpp | 2 +- jsk_topic_tools/src/mux_nodelet.cpp | 2 +- jsk_topic_tools/src/passthrough_nodelet.cpp | 2 +- jsk_topic_tools/src/relay_nodelet.cpp | 2 +- jsk_topic_tools/src/snapshot_nodelet.cpp | 2 +- jsk_topic_tools/src/stealth_relay_nodelet.cpp | 2 +- jsk_topic_tools/src/string_relay_nodelet.cpp | 2 +- jsk_topic_tools/src/synchronized_throttle_nodelet.cpp | 2 +- jsk_topic_tools/src/tests/test_log_utils_nodelet.cpp | 2 +- jsk_topic_tools/src/vital_checker_nodelet.cpp | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/jsk_topic_tools/src/block_nodelet.cpp b/jsk_topic_tools/src/block_nodelet.cpp index cf5534c39..1f9e2a60b 100644 --- a/jsk_topic_tools/src/block_nodelet.cpp +++ b/jsk_topic_tools/src/block_nodelet.cpp @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ -#include +#include #include "jsk_topic_tools/block_nodelet.h" #include diff --git a/jsk_topic_tools/src/deprecated_relay_nodelet.cpp b/jsk_topic_tools/src/deprecated_relay_nodelet.cpp index ff66e106a..adfda15f2 100644 --- a/jsk_topic_tools/src/deprecated_relay_nodelet.cpp +++ b/jsk_topic_tools/src/deprecated_relay_nodelet.cpp @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ -#include +#include #include "jsk_topic_tools/deprecated_relay.h" #include "jsk_topic_tools/log_utils.h" namespace jsk_topic_tools diff --git a/jsk_topic_tools/src/hz_measure_nodelet.cpp b/jsk_topic_tools/src/hz_measure_nodelet.cpp index 2a378ce6d..bdc22f111 100644 --- a/jsk_topic_tools/src/hz_measure_nodelet.cpp +++ b/jsk_topic_tools/src/hz_measure_nodelet.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include "jsk_topic_tools/hz_measure_nodelet.h" #include "std_msgs/Float32.h" diff --git a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp index 1caf36c97..f68e0f263 100644 --- a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp @@ -120,6 +120,6 @@ namespace jsk_topic_tools } } -#include +#include typedef jsk_topic_tools::LightweightThrottle LightweightThrottle; PLUGINLIB_EXPORT_CLASS(LightweightThrottle, nodelet::Nodelet) diff --git a/jsk_topic_tools/src/mux_nodelet.cpp b/jsk_topic_tools/src/mux_nodelet.cpp index 3d2575c9a..c9a34fc51 100644 --- a/jsk_topic_tools/src/mux_nodelet.cpp +++ b/jsk_topic_tools/src/mux_nodelet.cpp @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ -#include +#include #include "jsk_topic_tools/mux_nodelet.h" #include #include "jsk_topic_tools/rosparam_utils.h" diff --git a/jsk_topic_tools/src/passthrough_nodelet.cpp b/jsk_topic_tools/src/passthrough_nodelet.cpp index ad7a4276f..0c8b5adee 100644 --- a/jsk_topic_tools/src/passthrough_nodelet.cpp +++ b/jsk_topic_tools/src/passthrough_nodelet.cpp @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ -#include +#include #include "jsk_topic_tools/passthrough_nodelet.h" namespace jsk_topic_tools diff --git a/jsk_topic_tools/src/relay_nodelet.cpp b/jsk_topic_tools/src/relay_nodelet.cpp index 4ff3fb8f7..c96f04a25 100644 --- a/jsk_topic_tools/src/relay_nodelet.cpp +++ b/jsk_topic_tools/src/relay_nodelet.cpp @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ -#include +#include #include "jsk_topic_tools/relay_nodelet.h" namespace jsk_topic_tools diff --git a/jsk_topic_tools/src/snapshot_nodelet.cpp b/jsk_topic_tools/src/snapshot_nodelet.cpp index 84770b786..e5ac57308 100644 --- a/jsk_topic_tools/src/snapshot_nodelet.cpp +++ b/jsk_topic_tools/src/snapshot_nodelet.cpp @@ -101,5 +101,5 @@ namespace jsk_topic_tools } -#include +#include PLUGINLIB_EXPORT_CLASS (jsk_topic_tools::Snapshot, nodelet::Nodelet); diff --git a/jsk_topic_tools/src/stealth_relay_nodelet.cpp b/jsk_topic_tools/src/stealth_relay_nodelet.cpp index 4a01d0915..9fc7c9866 100644 --- a/jsk_topic_tools/src/stealth_relay_nodelet.cpp +++ b/jsk_topic_tools/src/stealth_relay_nodelet.cpp @@ -197,6 +197,6 @@ namespace jsk_topic_tools } } -#include +#include typedef jsk_topic_tools::StealthRelay StealthRelay; PLUGINLIB_EXPORT_CLASS(StealthRelay, nodelet::Nodelet) diff --git a/jsk_topic_tools/src/string_relay_nodelet.cpp b/jsk_topic_tools/src/string_relay_nodelet.cpp index 1cf270797..fc3ac622d 100644 --- a/jsk_topic_tools/src/string_relay_nodelet.cpp +++ b/jsk_topic_tools/src/string_relay_nodelet.cpp @@ -60,6 +60,6 @@ namespace jsk_topic_tools } } -#include +#include typedef jsk_topic_tools::StringRelay StringRelay; PLUGINLIB_EXPORT_CLASS(StringRelay, nodelet::Nodelet) diff --git a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp index c58f93c54..282a98273 100644 --- a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp @@ -427,6 +427,6 @@ void SynchronizedThrottle::inputCallback( } // jsk_topic_tools -#include +#include typedef jsk_topic_tools::SynchronizedThrottle SynchronizedThrottle; PLUGINLIB_EXPORT_CLASS(SynchronizedThrottle, nodelet::Nodelet) diff --git a/jsk_topic_tools/src/tests/test_log_utils_nodelet.cpp b/jsk_topic_tools/src/tests/test_log_utils_nodelet.cpp index d789cb392..62a1bd909 100644 --- a/jsk_topic_tools/src/tests/test_log_utils_nodelet.cpp +++ b/jsk_topic_tools/src/tests/test_log_utils_nodelet.cpp @@ -45,5 +45,5 @@ class LogUtils : public nodelet::Nodelet } // namespace jsk_topic_tools -#include +#include PLUGINLIB_EXPORT_CLASS(jsk_topic_tools::test::LogUtils, nodelet::Nodelet) diff --git a/jsk_topic_tools/src/vital_checker_nodelet.cpp b/jsk_topic_tools/src/vital_checker_nodelet.cpp index d39a0c7cd..395a31e6b 100644 --- a/jsk_topic_tools/src/vital_checker_nodelet.cpp +++ b/jsk_topic_tools/src/vital_checker_nodelet.cpp @@ -86,6 +86,6 @@ namespace jsk_topic_tools } } -#include +#include typedef jsk_topic_tools::VitalCheckerNodelet VitalCheckerNodelet; PLUGINLIB_EXPORT_CLASS(VitalCheckerNodelet, nodelet::Nodelet) From 07997f522099ade7906d35cd8342be85b5c2af08 Mon Sep 17 00:00:00 2001 From: v4hn Date: Sat, 29 Oct 2022 17:12:04 +0200 Subject: [PATCH 04/11] avoid boost::bind (esp. global _1) it's deprecated to use global _1 from boost for a while now and the Debian ROS packages do not provide it anymore. --- jsk_ros_patch/image_view2/image_view2.cpp | 2 +- .../points_rectangle_extractor.cpp | 4 +-- jsk_tilt_laser/src/spin_laser_snapshotter.cpp | 4 +-- .../connection_based_nodelet.h | 22 +++++--------- jsk_topic_tools/src/diagnostic_nodelet.cpp | 5 +--- jsk_topic_tools/src/hz_measure_nodelet.cpp | 4 +-- .../src/lightweight_throttle_nodelet.cpp | 4 +-- jsk_topic_tools/src/mux_nodelet.cpp | 2 +- jsk_topic_tools/src/relay_nodelet.cpp | 3 +- jsk_topic_tools/src/stealth_relay_nodelet.cpp | 2 +- .../src/synchronized_throttle_nodelet.cpp | 29 ++++++++++++++----- .../src/timered_diagnostic_updater.cpp | 5 +--- jsk_topic_tools/src/topic_buffer_client.cpp | 3 +- jsk_topic_tools/src/topic_buffer_server.cpp | 2 +- 14 files changed, 46 insertions(+), 45 deletions(-) diff --git a/jsk_ros_patch/image_view2/image_view2.cpp b/jsk_ros_patch/image_view2/image_view2.cpp index 754672116..b6a76efb7 100644 --- a/jsk_ros_patch/image_view2/image_view2.cpp +++ b/jsk_ros_patch/image_view2/image_view2.cpp @@ -116,7 +116,7 @@ namespace image_view2{ srv_ = boost::make_shared >(local_nh); dynamic_reconfigure::Server::CallbackType f = - boost::bind(&ImageView2::config_callback, this, _1, _2); + [this](auto& config, auto level){ config_callback(config, level); }; srv_->setCallback(f); } diff --git a/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp b/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp index 89d4f13cc..8fb321236 100644 --- a/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp +++ b/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp @@ -43,11 +43,11 @@ class PointsRectExtractor sync_a_polygon_ = boost::make_shared < message_filters::Synchronizer< PolygonApproxSyncPolicy > > (queue_size); sync_a_polygon_->connectInput (points_sub_, rect_sub_); - sync_a_polygon_->registerCallback (boost::bind (&PointsRectExtractor::callback_polygon, this, _1, _2)); + sync_a_polygon_->registerCallback (boost::bind (&PointsRectExtractor::callback_polygon, this, boost::placeholders::_1, boost::placeholders::_2)); sync_a_point_ = boost::make_shared < message_filters::Synchronizer< PointApproxSyncPolicy > > (queue_size); sync_a_point_->connectInput (points_sub_, point_sub_); - sync_a_point_->registerCallback (boost::bind (&PointsRectExtractor::callback_point, this, _1, _2)); + sync_a_point_->registerCallback (boost::bind (&PointsRectExtractor::callback_point, this, boost::placeholders::_1, boost::placeholders::_2)); pub_ = pnode_.advertise< sensor_msgs::PointCloud2 > ("output", 1); } diff --git a/jsk_tilt_laser/src/spin_laser_snapshotter.cpp b/jsk_tilt_laser/src/spin_laser_snapshotter.cpp index d92bdb2c3..32b441d1a 100644 --- a/jsk_tilt_laser/src/spin_laser_snapshotter.cpp +++ b/jsk_tilt_laser/src/spin_laser_snapshotter.cpp @@ -103,8 +103,8 @@ class SpinLaserSnapshotter private_ns_.param("spindle_frame", spindle_frame_, std::string("multisense/spindle")); private_ns_.param("motor_frame", motor_frame_, std::string("multisense/motor")); timer_ = private_ns_.createTimer( - ros::Duration(1.0 / rate_), boost::bind( - &SpinLaserSnapshotter::timerCallback, this, _1)); + ros::Duration(1.0 / rate_), + [this](auto& event){ timerCallback(event); }); } } diff --git a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h index 0657d29d6..d48a8ad74 100644 --- a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h +++ b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h @@ -192,9 +192,9 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); ros::SubscriberStatusCallback connect_cb - = boost::bind(&ConnectionBasedNodelet::connectionCallback, this, _1); + = [this](auto& pub){ connectionCallback(pub); }; ros::SubscriberStatusCallback disconnect_cb - = boost::bind(&ConnectionBasedNodelet::connectionCallback, this, _1); + = [this](auto& pub){ connectionCallback(pub); }; ros::Publisher ret = nh.advertise(topic, queue_size, connect_cb, disconnect_cb, @@ -254,11 +254,9 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); image_transport::SubscriberStatusCallback connect_cb - = boost::bind(&ConnectionBasedNodelet::imageConnectionCallback, - this, _1); + = [this](auto& pub){ imageConnectionCallback(pub); }; image_transport::SubscriberStatusCallback disconnect_cb - = boost::bind(&ConnectionBasedNodelet::imageConnectionCallback, - this, _1); + = [this](auto& pub){ imageConnectionCallback(pub); }; image_transport::Publisher pub = image_transport::ImageTransport(nh).advertise( topic, 1, connect_cb, @@ -318,17 +316,13 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); image_transport::SubscriberStatusCallback connect_cb - = boost::bind(&ConnectionBasedNodelet::cameraConnectionCallback, - this, _1); + = [this](auto& pub){ cameraConnectionCallback(pub); }; image_transport::SubscriberStatusCallback disconnect_cb - = boost::bind(&ConnectionBasedNodelet::cameraConnectionCallback, - this, _1); + = [this](auto& pub){ cameraConnectionCallback(pub); }; ros::SubscriberStatusCallback info_connect_cb - = boost::bind(&ConnectionBasedNodelet::cameraInfoConnectionCallback, - this, _1); + = [this](auto& pub){ cameraInfoConnectionCallback(pub); }; ros::SubscriberStatusCallback info_disconnect_cb - = boost::bind(&ConnectionBasedNodelet::cameraInfoConnectionCallback, - this, _1); + = [this](auto& pub){ cameraInfoConnectionCallback(pub); }; image_transport::CameraPublisher pub = image_transport::ImageTransport(nh).advertiseCamera( topic, 1, diff --git a/jsk_topic_tools/src/diagnostic_nodelet.cpp b/jsk_topic_tools/src/diagnostic_nodelet.cpp index 14e5bd0ca..e95f83de5 100644 --- a/jsk_topic_tools/src/diagnostic_nodelet.cpp +++ b/jsk_topic_tools/src/diagnostic_nodelet.cpp @@ -56,10 +56,7 @@ namespace jsk_topic_tools diagnostic_updater_->setHardwareID(getName()); diagnostic_updater_->add( getName(), - boost::bind( - &DiagnosticNodelet::updateDiagnostic, - this, - _1)); + [this](auto& stat){ updateDiagnostic(stat); }); bool use_warn; nh_->param("/diagnostic_nodelet/use_warn", use_warn, false); diff --git a/jsk_topic_tools/src/hz_measure_nodelet.cpp b/jsk_topic_tools/src/hz_measure_nodelet.cpp index bdc22f111..7b0638666 100644 --- a/jsk_topic_tools/src/hz_measure_nodelet.cpp +++ b/jsk_topic_tools/src/hz_measure_nodelet.cpp @@ -78,9 +78,7 @@ namespace jsk_topic_tools diagnostic_updater_.reset(new TimeredDiagnosticUpdater(pnh_, ros::Duration(1.0))); diagnostic_updater_->setHardwareID(getName()); - diagnostic_updater_->add(getName(), - boost::bind(&HzMeasure::updateDiagnostic, - this, _1)); + diagnostic_updater_->add(getName(), [this](auto& stat){ updateDiagnostic(stat); }); diagnostic_updater_->start(); hz_pub_ = pnh_.advertise("output", 1); diff --git a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp index f68e0f263..4c29a69bb 100644 --- a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp @@ -45,7 +45,7 @@ namespace jsk_topic_tools srv_ = boost::make_shared >(pnh_); dynamic_reconfigure::Server::CallbackType f = - boost::bind(&LightweightThrottle::configCallback, this, _1, _2); + [this](auto& config, auto level){ configCallback(config, level); }; srv_->setCallback(f); // Subscribe input topic at first in order to decide @@ -95,7 +95,7 @@ namespace jsk_topic_tools // This section should be called once sub_->shutdown(); // Shutdown before advertising topic ros::SubscriberStatusCallback connect_cb - = boost::bind(&LightweightThrottle::connectionCallback, this, _1); + = [this](auto& pub){ connectionCallback(pub); }; ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), diff --git a/jsk_topic_tools/src/mux_nodelet.cpp b/jsk_topic_tools/src/mux_nodelet.cpp index c9a34fc51..b9da17acc 100644 --- a/jsk_topic_tools/src/mux_nodelet.cpp +++ b/jsk_topic_tools/src/mux_nodelet.cpp @@ -194,7 +194,7 @@ namespace jsk_topic_tools { if (!advertised_) { // first time ros::SubscriberStatusCallback connect_cb - = boost::bind(&MUX::connectCb, this, _1); + = [this](auto& pub){ connectCb(pub); }; ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), diff --git a/jsk_topic_tools/src/relay_nodelet.cpp b/jsk_topic_tools/src/relay_nodelet.cpp index c96f04a25..62a11f433 100644 --- a/jsk_topic_tools/src/relay_nodelet.cpp +++ b/jsk_topic_tools/src/relay_nodelet.cpp @@ -50,8 +50,7 @@ namespace jsk_topic_tools diagnostic_updater_->setHardwareID(getName()); diagnostic_updater_->add( getName() + "::Relay", - boost::bind( - &Relay::updateDiagnostic, this, _1)); + [this](auto& stat){ updateDiagnostic(stat); }); double vital_rate; pnh_.param("vital_rate", vital_rate, 1.0); vital_checker_.reset( diff --git a/jsk_topic_tools/src/stealth_relay_nodelet.cpp b/jsk_topic_tools/src/stealth_relay_nodelet.cpp index 9fc7c9866..c62ded51a 100644 --- a/jsk_topic_tools/src/stealth_relay_nodelet.cpp +++ b/jsk_topic_tools/src/stealth_relay_nodelet.cpp @@ -69,7 +69,7 @@ namespace jsk_topic_tools srv_ = boost::make_shared >(*pnh_); dynamic_reconfigure::Server::CallbackType f = - boost::bind(&StealthRelay::configCallback, this, _1, _2); + [this](auto& config, auto level){ configCallback(config, level); }; srv_->setCallback(f); /* To advertise output topic as the same type of input topic, diff --git a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp index 282a98273..83b228717 100644 --- a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp @@ -66,7 +66,7 @@ void SynchronizedThrottle::onInit() srv_ = boost::make_shared >(*pnh_); dynamic_reconfigure::Server::CallbackType f = - boost::bind(&SynchronizedThrottle::configCallback, this, _1, _2); + [this](auto& config, auto level){ configCallback(config, level); }; srv_->setCallback(f); // message_filter supports 2~8 input topics @@ -89,7 +89,7 @@ void SynchronizedThrottle::onInit() { check_sub_[i] = pnh_->subscribe( input_topics_[i], 1, - boost::bind(&SynchronizedThrottle::checkCallback, this, _1, i)); + [this,i](auto& msg){ checkCallback(msg, i); }); sub_[i].reset(new message_filters::Subscriber()); } @@ -178,7 +178,7 @@ void SynchronizedThrottle::subscribe() if (n_topics < MAX_SYNC_NUM) { sub_[0]->registerCallback( - boost::bind(&SynchronizedThrottle::fillNullMessage, this, _1)); + [this](auto& msg){ fillNullMessage(msg); }); } if (approximate_sync_) @@ -220,8 +220,16 @@ void SynchronizedThrottle::subscribe() return; } async_->registerCallback( - boost::bind(&SynchronizedThrottle::inputCallback, this, - _1, _2, _3, _4, _5, _6, _7, _8)); + boost::bind(&SynchronizedThrottle::inputCallback, this, + boost::placeholders::_1, + boost::placeholders::_2, + boost::placeholders::_3, + boost::placeholders::_4, + boost::placeholders::_5, + boost::placeholders::_6, + boost::placeholders::_7, + boost::placeholders::_8)); + } else { sync_ = boost::make_shared >(queue_size_); @@ -260,8 +268,15 @@ void SynchronizedThrottle::subscribe() return; } sync_->registerCallback( - boost::bind(&SynchronizedThrottle::inputCallback, this, - _1, _2, _3, _4, _5, _6, _7, _8)); + boost::bind(&SynchronizedThrottle::inputCallback, this, + boost::placeholders::_1, + boost::placeholders::_2, + boost::placeholders::_3, + boost::placeholders::_4, + boost::placeholders::_5, + boost::placeholders::_6, + boost::placeholders::_7, + boost::placeholders::_8)); } } diff --git a/jsk_topic_tools/src/timered_diagnostic_updater.cpp b/jsk_topic_tools/src/timered_diagnostic_updater.cpp index 93c07f9e7..bfa42ecd9 100644 --- a/jsk_topic_tools/src/timered_diagnostic_updater.cpp +++ b/jsk_topic_tools/src/timered_diagnostic_updater.cpp @@ -43,10 +43,7 @@ namespace jsk_topic_tools diagnostic_updater_(new diagnostic_updater::Updater) { timer_ = nh.createTimer( - timer_duration, boost::bind( - &TimeredDiagnosticUpdater::timerCallback, - this, - _1)); + timer_duration, [this](auto& event){ timerCallback(event); }); timer_.stop(); } diff --git a/jsk_topic_tools/src/topic_buffer_client.cpp b/jsk_topic_tools/src/topic_buffer_client.cpp index f4aaafacf..d5724c750 100644 --- a/jsk_topic_tools/src/topic_buffer_client.cpp +++ b/jsk_topic_tools/src/topic_buffer_client.cpp @@ -200,7 +200,8 @@ int main(int argc, char **argv) pub_info->advertised = false; pub_info->topic_with_header = false; ROS_INFO_STREAM("subscribe " << pub_info->topic_name+string("_update")); - pub_info->sub = new ros::Subscriber(n.subscribe(pub_info->topic_name+string("_update"), 10, boost::bind(in_cb, _1, pub_info))); + pub_info->sub = new ros::Subscriber(n.subscribe(pub_info->topic_name+string("_update"), 10, + [pub_info](auto& msg){ in_cb(msg, pub_info); })); g_pubs.push_back(pub_info); } diff --git a/jsk_topic_tools/src/topic_buffer_server.cpp b/jsk_topic_tools/src/topic_buffer_server.cpp index 4358e4ab2..f78b7f77b 100644 --- a/jsk_topic_tools/src/topic_buffer_server.cpp +++ b/jsk_topic_tools/src/topic_buffer_server.cpp @@ -219,7 +219,7 @@ int main(int argc, char **argv) sub_info->advertised = false; sub_info->periodic = false; ROS_INFO_STREAM("subscribe " << sub_info->topic_name); - sub_info->sub = new ros::Subscriber(n.subscribe(sub_info->topic_name, 10, boost::bind(in_cb, _1, sub_info))); + sub_info->sub = new ros::Subscriber(n.subscribe(sub_info->topic_name, 10, [sub_info](auto& msg){ in_cb(msg, sub_info); })); // waiting for all topics are publisherd while (sub_info->sub->getNumPublishers() == 0 ) { From beee45cf53c130d7d6761dadf3aefa7e6a8e9fd5 Mon Sep 17 00:00:00 2001 From: v4hn Date: Sat, 29 Oct 2022 17:14:51 +0200 Subject: [PATCH 05/11] fixup documentation this confused me when I looked through the code. --- .../include/jsk_topic_tools/connection_based_nodelet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h index d48a8ad74..bba9e4385 100644 --- a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h +++ b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h @@ -86,7 +86,7 @@ namespace jsk_topic_tools virtual void onInitPostProcess(); /** @brief - * callback function which is called when new subscriber come + * callback function which is called when new subscriber connects or disconnects */ virtual void connectionCallback(const ros::SingleSubscriberPublisher& pub); From f834c0a86a2d19013675e60ffbb2c26ba5b87e6c Mon Sep 17 00:00:00 2001 From: v4hn Date: Wed, 9 Nov 2022 13:47:07 +0100 Subject: [PATCH 06/11] use setuptools setup from distutils is deprecated and will be removed eventually. --- jsk_network_tools/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_network_tools/setup.py b/jsk_network_tools/setup.py index 7ffd6d804..844bbc07c 100755 --- a/jsk_network_tools/setup.py +++ b/jsk_network_tools/setup.py @@ -1,6 +1,6 @@ ## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD -from distutils.core import setup +from setuptools import setup from catkin_pkg.python_setup import generate_distutils_setup # fetch values from package.xml From 7fb8ffaba9cd958b49b0b5a820eff070fe425074 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 12 Dec 2022 20:14:29 +0900 Subject: [PATCH 07/11] do not specify c++ standard it break with current log4cxx which requires c++17. No, going forward it's no option to specify the standard anymore. And it's not necessary either. same fix as https://github.com/jsk-ros-pkg/jsk_common/pull/1773/commits/18e200ca51ac035af3e8ab5955cde2b76fc9c980 --- jsk_topic_tools/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/jsk_topic_tools/CMakeLists.txt b/jsk_topic_tools/CMakeLists.txt index 4699dea1f..7d4895d06 100644 --- a/jsk_topic_tools/CMakeLists.txt +++ b/jsk_topic_tools/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8.3) project(jsk_topic_tools) -add_compile_options(-std=c++11) - # Use ccache if installed to make it fast to generate object files if (CMAKE_VERSION VERSION_LESS 3.4) find_program(CCACHE_FOUND ccache) From 4973030c552e937566ccfaf182676478b508e439 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 12 Dec 2022 20:24:17 +0900 Subject: [PATCH 08/11] avoid boost::bind (esp. global _1) it's deprecated to use global _1 from boost for a while now and the Debian ROS packages do not provide it anymore. --- jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp b/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp index b0de6e9d1..6da3502d3 100644 --- a/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp @@ -11,7 +11,7 @@ namespace jsk_topic_tools msg_cached_ = boost::shared_ptr(new topic_tools::ShapeShifter()); srv_ = boost::make_shared >(pnh_); - dynamic_reconfigure::Server::CallbackType f = boost::bind(&ConstantRateThrottle::configCallback, this, _1, _2); + dynamic_reconfigure::Server::CallbackType f = [this](auto& config, auto level) {configCallback(config, level); }; srv_->setCallback(f); sub_.reset(new ros::Subscriber( @@ -62,7 +62,7 @@ namespace jsk_topic_tools boost::mutex::scoped_lock lock(mutex_); if (!advertised_) { sub_->shutdown(); - ros::SubscriberStatusCallback connect_cb = boost::bind(&ConstantRateThrottle::connectionCallback, this, _1); + ros::SubscriberStatusCallback connect_cb = [this](auto& pub){ connectionCallback(pub); }; ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), From 6fd594b5f5f382487dab8218d7c6433a0be2fb1a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 12 Dec 2022 13:45:10 +0000 Subject: [PATCH 09/11] requries -std=c++11 compile options, but it is not used in source tree --- .../include/jsk_topic_tools/constant_rate_throttle_nodelet.h | 1 - 1 file changed, 1 deletion(-) diff --git a/jsk_topic_tools/include/jsk_topic_tools/constant_rate_throttle_nodelet.h b/jsk_topic_tools/include/jsk_topic_tools/constant_rate_throttle_nodelet.h index d1ab8e775..4da299844 100644 --- a/jsk_topic_tools/include/jsk_topic_tools/constant_rate_throttle_nodelet.h +++ b/jsk_topic_tools/include/jsk_topic_tools/constant_rate_throttle_nodelet.h @@ -7,7 +7,6 @@ #include #include #include -#include namespace jsk_topic_tools { From a4e0d40d358348ee08ba7fb52f23b436f1531e4f Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 12 Dec 2022 13:46:47 +0000 Subject: [PATCH 10/11] revert code before C++11 --- jsk_ros_patch/image_view2/image_view2.cpp | 4 ++ .../points_rectangle_extractor.cpp | 21 ++++++++++ jsk_tilt_laser/src/spin_laser_snapshotter.cpp | 4 ++ .../connection_based_nodelet.h | 38 ++++++++++++++++++ .../src/constant_rate_throttle_nodelet.cpp | 14 ++++++- jsk_topic_tools/src/diagnostic_nodelet.cpp | 10 ++++- jsk_topic_tools/src/hz_measure_nodelet.cpp | 6 +++ .../src/lightweight_throttle_nodelet.cpp | 8 ++++ jsk_topic_tools/src/mux_nodelet.cpp | 4 ++ jsk_topic_tools/src/relay_nodelet.cpp | 5 +++ jsk_topic_tools/src/stealth_relay_nodelet.cpp | 4 ++ .../src/synchronized_throttle_nodelet.cpp | 39 ++++++++++++++++++- .../src/timered_diagnostic_updater.cpp | 8 +++- jsk_topic_tools/src/topic_buffer_client.cpp | 8 +++- jsk_topic_tools/src/topic_buffer_server.cpp | 9 ++++- 15 files changed, 172 insertions(+), 10 deletions(-) diff --git a/jsk_ros_patch/image_view2/image_view2.cpp b/jsk_ros_patch/image_view2/image_view2.cpp index b6a76efb7..f50b74f82 100644 --- a/jsk_ros_patch/image_view2/image_view2.cpp +++ b/jsk_ros_patch/image_view2/image_view2.cpp @@ -116,7 +116,11 @@ namespace image_view2{ srv_ = boost::make_shared >(local_nh); dynamic_reconfigure::Server::CallbackType f = +#if __cplusplus < 201100L + boost::bind(&ImageView2::config_callback, this, _1, _2); +#else [this](auto& config, auto level){ config_callback(config, level); }; +#endif srv_->setCallback(f); } diff --git a/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp b/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp index 8fb321236..7eac64e96 100644 --- a/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp +++ b/jsk_ros_patch/image_view2/points_rectangle_extractor.cpp @@ -13,6 +13,27 @@ #include #include +#if BOOST_VERSION < 106000 // since 1.60.0, boost uses placeholders namesapce for _1,_2... +#ifndef BOOST_PLAEHOLDERS +#define BOOST_PLAEHOLDERS +namespace boost +{ + namespace placeholders + { + extern boost::arg<1> _1; + extern boost::arg<2> _2; + extern boost::arg<3> _3; + extern boost::arg<4> _4; + extern boost::arg<5> _5; + extern boost::arg<6> _6; + extern boost::arg<7> _7; + extern boost::arg<8> _8; + extern boost::arg<9> _9; + } // namespace placeholders +} // namespace boost +#endif // BOOST_PLAEHOLDERS +#endif // BOOST_VERSION < 106000 + class PointsRectExtractor { typedef message_filters::sync_policies::ApproximateTime< sensor_msgs::PointCloud2, diff --git a/jsk_tilt_laser/src/spin_laser_snapshotter.cpp b/jsk_tilt_laser/src/spin_laser_snapshotter.cpp index 32b441d1a..e60164717 100644 --- a/jsk_tilt_laser/src/spin_laser_snapshotter.cpp +++ b/jsk_tilt_laser/src/spin_laser_snapshotter.cpp @@ -104,7 +104,11 @@ class SpinLaserSnapshotter private_ns_.param("motor_frame", motor_frame_, std::string("multisense/motor")); timer_ = private_ns_.createTimer( ros::Duration(1.0 / rate_), +#if __cplusplus < 201100L + boost::bind(&SpinLaserSnapshotter::timerCallback, this, _1)); +#else [this](auto& event){ timerCallback(event); }); +#endif } } diff --git a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h index bba9e4385..075ac3897 100644 --- a/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h +++ b/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h @@ -192,9 +192,17 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); ros::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::connectionCallback, this, _1); +#else = [this](auto& pub){ connectionCallback(pub); }; +#endif ros::SubscriberStatusCallback disconnect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::connectionCallback, this, _1); +#else = [this](auto& pub){ connectionCallback(pub); }; +#endif ros::Publisher ret = nh.advertise(topic, queue_size, connect_cb, disconnect_cb, @@ -254,9 +262,19 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); image_transport::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::imageConnectionCallback, + this, _1); +#else = [this](auto& pub){ imageConnectionCallback(pub); }; +#endif image_transport::SubscriberStatusCallback disconnect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::imageConnectionCallback, + this, _1); +#else = [this](auto& pub){ imageConnectionCallback(pub); }; +#endif image_transport::Publisher pub = image_transport::ImageTransport(nh).advertise( topic, 1, connect_cb, @@ -316,13 +334,33 @@ namespace jsk_topic_tools { boost::mutex::scoped_lock lock(connection_mutex_); image_transport::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::cameraConnectionCallback, + this, _1); +#else = [this](auto& pub){ cameraConnectionCallback(pub); }; +#endif image_transport::SubscriberStatusCallback disconnect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::cameraConnectionCallback, + this, _1); +#else = [this](auto& pub){ cameraConnectionCallback(pub); }; +#endif ros::SubscriberStatusCallback info_connect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::cameraInfoConnectionCallback, + this, _1); +#else = [this](auto& pub){ cameraInfoConnectionCallback(pub); }; +#endif ros::SubscriberStatusCallback info_disconnect_cb +#if __cplusplus < 201100L + = boost::bind(&ConnectionBasedNodelet::cameraInfoConnectionCallback, + this, _1); +#else = [this](auto& pub){ cameraInfoConnectionCallback(pub); }; +#endif image_transport::CameraPublisher pub = image_transport::ImageTransport(nh).advertiseCamera( topic, 1, diff --git a/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp b/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp index 6da3502d3..f43a4ac54 100644 --- a/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/constant_rate_throttle_nodelet.cpp @@ -11,7 +11,12 @@ namespace jsk_topic_tools msg_cached_ = boost::shared_ptr(new topic_tools::ShapeShifter()); srv_ = boost::make_shared >(pnh_); - dynamic_reconfigure::Server::CallbackType f = [this](auto& config, auto level) {configCallback(config, level); }; + dynamic_reconfigure::Server::CallbackType f +#if __cplusplus < 201100L + = boost::bind(&ConstantRateThrottle::configCallback, this, _1, _2); +#else + = [this](auto& config, auto level) {configCallback(config, level); }; +#endif srv_->setCallback(f); sub_.reset(new ros::Subscriber( @@ -62,7 +67,12 @@ namespace jsk_topic_tools boost::mutex::scoped_lock lock(mutex_); if (!advertised_) { sub_->shutdown(); - ros::SubscriberStatusCallback connect_cb = [this](auto& pub){ connectionCallback(pub); }; + ros::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&ConstantRateThrottle::connectionCallback, this, _1); +#else + = [this](auto& pub){ connectionCallback(pub); }; +#endif ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), diff --git a/jsk_topic_tools/src/diagnostic_nodelet.cpp b/jsk_topic_tools/src/diagnostic_nodelet.cpp index e95f83de5..365968ec0 100644 --- a/jsk_topic_tools/src/diagnostic_nodelet.cpp +++ b/jsk_topic_tools/src/diagnostic_nodelet.cpp @@ -56,7 +56,15 @@ namespace jsk_topic_tools diagnostic_updater_->setHardwareID(getName()); diagnostic_updater_->add( getName(), - [this](auto& stat){ updateDiagnostic(stat); }); +#if __cplusplus < 201100L + boost::bind( + &DiagnosticNodelet::updateDiagnostic, + this, + _1) +#else + [this](auto& stat){ updateDiagnostic(stat); } +#endif + ); bool use_warn; nh_->param("/diagnostic_nodelet/use_warn", use_warn, false); diff --git a/jsk_topic_tools/src/hz_measure_nodelet.cpp b/jsk_topic_tools/src/hz_measure_nodelet.cpp index 7b0638666..f859fe9b9 100644 --- a/jsk_topic_tools/src/hz_measure_nodelet.cpp +++ b/jsk_topic_tools/src/hz_measure_nodelet.cpp @@ -78,7 +78,13 @@ namespace jsk_topic_tools diagnostic_updater_.reset(new TimeredDiagnosticUpdater(pnh_, ros::Duration(1.0))); diagnostic_updater_->setHardwareID(getName()); +#if __cplusplus < 201100L + diagnostic_updater_->add(getName(), + boost::bind(&HzMeasure::updateDiagnostic, + this, _1)); +#else diagnostic_updater_->add(getName(), [this](auto& stat){ updateDiagnostic(stat); }); +#endif diagnostic_updater_->start(); hz_pub_ = pnh_.advertise("output", 1); diff --git a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp index 4c29a69bb..dd59d9551 100644 --- a/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/lightweight_throttle_nodelet.cpp @@ -45,7 +45,11 @@ namespace jsk_topic_tools srv_ = boost::make_shared >(pnh_); dynamic_reconfigure::Server::CallbackType f = +#if __cplusplus < 201100L + boost::bind(&LightweightThrottle::configCallback, this, _1, _2); +#else [this](auto& config, auto level){ configCallback(config, level); }; +#endif srv_->setCallback(f); // Subscribe input topic at first in order to decide @@ -95,7 +99,11 @@ namespace jsk_topic_tools // This section should be called once sub_->shutdown(); // Shutdown before advertising topic ros::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&LightweightThrottle::connectionCallback, this, _1); +#else = [this](auto& pub){ connectionCallback(pub); }; +#endif ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), diff --git a/jsk_topic_tools/src/mux_nodelet.cpp b/jsk_topic_tools/src/mux_nodelet.cpp index b9da17acc..fe27fcff2 100644 --- a/jsk_topic_tools/src/mux_nodelet.cpp +++ b/jsk_topic_tools/src/mux_nodelet.cpp @@ -194,7 +194,11 @@ namespace jsk_topic_tools { if (!advertised_) { // first time ros::SubscriberStatusCallback connect_cb +#if __cplusplus < 201100L + = boost::bind(&MUX::connectCb, this, _1); +#else = [this](auto& pub){ connectCb(pub); }; +#endif ros::AdvertiseOptions opts("output", 1, msg->getMD5Sum(), msg->getDataType(), diff --git a/jsk_topic_tools/src/relay_nodelet.cpp b/jsk_topic_tools/src/relay_nodelet.cpp index 62a11f433..d26bd254a 100644 --- a/jsk_topic_tools/src/relay_nodelet.cpp +++ b/jsk_topic_tools/src/relay_nodelet.cpp @@ -50,7 +50,12 @@ namespace jsk_topic_tools diagnostic_updater_->setHardwareID(getName()); diagnostic_updater_->add( getName() + "::Relay", +#if __cplusplus < 201100L + boost::bind( + &Relay::updateDiagnostic, this, _1)); +#else [this](auto& stat){ updateDiagnostic(stat); }); +#endif double vital_rate; pnh_.param("vital_rate", vital_rate, 1.0); vital_checker_.reset( diff --git a/jsk_topic_tools/src/stealth_relay_nodelet.cpp b/jsk_topic_tools/src/stealth_relay_nodelet.cpp index c62ded51a..7b309839e 100644 --- a/jsk_topic_tools/src/stealth_relay_nodelet.cpp +++ b/jsk_topic_tools/src/stealth_relay_nodelet.cpp @@ -69,7 +69,11 @@ namespace jsk_topic_tools srv_ = boost::make_shared >(*pnh_); dynamic_reconfigure::Server::CallbackType f = +#if __cplusplus < 201100L + boost::bind(&StealthRelay::configCallback, this, _1, _2); +#else [this](auto& config, auto level){ configCallback(config, level); }; +#endif srv_->setCallback(f); /* To advertise output topic as the same type of input topic, diff --git a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp index 83b228717..995a6db6b 100644 --- a/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp +++ b/jsk_topic_tools/src/synchronized_throttle_nodelet.cpp @@ -39,6 +39,27 @@ #include +#if BOOST_VERSION < 106000 // since 1.60.0, boost uses placeholders namesapce for _1,_2... +#ifndef BOOST_PLAEHOLDERS +#define BOOST_PLAEHOLDERS +namespace boost +{ + namespace placeholders + { + extern boost::arg<1> _1; + extern boost::arg<2> _2; + extern boost::arg<3> _3; + extern boost::arg<4> _4; + extern boost::arg<5> _5; + extern boost::arg<6> _6; + extern boost::arg<7> _7; + extern boost::arg<8> _8; + extern boost::arg<9> _9; + } // namespace placeholders +} // namespace boost +#endif // BOOST_PLAEHOLDERS +#endif // BOOST_VERSION < 106000 + namespace jsk_topic_tools { @@ -66,7 +87,11 @@ void SynchronizedThrottle::onInit() srv_ = boost::make_shared >(*pnh_); dynamic_reconfigure::Server::CallbackType f = +#if __cplusplus < 201100L + boost::bind(&SynchronizedThrottle::configCallback, this, _1, _2); +#else [this](auto& config, auto level){ configCallback(config, level); }; +#endif srv_->setCallback(f); // message_filter supports 2~8 input topics @@ -89,7 +114,12 @@ void SynchronizedThrottle::onInit() { check_sub_[i] = pnh_->subscribe( input_topics_[i], 1, - [this,i](auto& msg){ checkCallback(msg, i); }); +#if __cplusplus < 201100L + boost::bind(&SynchronizedThrottle::checkCallback, this, _1, i) +#else + [this,i](auto& msg){ checkCallback(msg, i); } +#endif + ); sub_[i].reset(new message_filters::Subscriber()); } @@ -178,7 +208,12 @@ void SynchronizedThrottle::subscribe() if (n_topics < MAX_SYNC_NUM) { sub_[0]->registerCallback( - [this](auto& msg){ fillNullMessage(msg); }); +#if __cplusplus < 201100L + boost::bind(&SynchronizedThrottle::fillNullMessage, this, _1) +#else + [this](auto& msg){ fillNullMessage(msg); } +#endif + ); } if (approximate_sync_) diff --git a/jsk_topic_tools/src/timered_diagnostic_updater.cpp b/jsk_topic_tools/src/timered_diagnostic_updater.cpp index bfa42ecd9..c3b384e9d 100644 --- a/jsk_topic_tools/src/timered_diagnostic_updater.cpp +++ b/jsk_topic_tools/src/timered_diagnostic_updater.cpp @@ -43,7 +43,13 @@ namespace jsk_topic_tools diagnostic_updater_(new diagnostic_updater::Updater) { timer_ = nh.createTimer( - timer_duration, [this](auto& event){ timerCallback(event); }); + timer_duration, +#if __cplusplus < 201100L + boost::bind(&TimeredDiagnosticUpdater::timerCallback,this,_1) +#else + [this](auto& event){ timerCallback(event); } +#endif + ); timer_.stop(); } diff --git a/jsk_topic_tools/src/topic_buffer_client.cpp b/jsk_topic_tools/src/topic_buffer_client.cpp index d5724c750..5ab8db2d3 100644 --- a/jsk_topic_tools/src/topic_buffer_client.cpp +++ b/jsk_topic_tools/src/topic_buffer_client.cpp @@ -201,8 +201,12 @@ int main(int argc, char **argv) pub_info->topic_with_header = false; ROS_INFO_STREAM("subscribe " << pub_info->topic_name+string("_update")); pub_info->sub = new ros::Subscriber(n.subscribe(pub_info->topic_name+string("_update"), 10, - [pub_info](auto& msg){ in_cb(msg, pub_info); })); - +#if __cplusplus < 201100L + boost::bind(in_cb, _1, pub_info) +#else + [pub_info](auto& msg){ in_cb(msg, pub_info); } +#endif + )); g_pubs.push_back(pub_info); } diff --git a/jsk_topic_tools/src/topic_buffer_server.cpp b/jsk_topic_tools/src/topic_buffer_server.cpp index f78b7f77b..b79b0f2a5 100644 --- a/jsk_topic_tools/src/topic_buffer_server.cpp +++ b/jsk_topic_tools/src/topic_buffer_server.cpp @@ -219,8 +219,13 @@ int main(int argc, char **argv) sub_info->advertised = false; sub_info->periodic = false; ROS_INFO_STREAM("subscribe " << sub_info->topic_name); - sub_info->sub = new ros::Subscriber(n.subscribe(sub_info->topic_name, 10, [sub_info](auto& msg){ in_cb(msg, sub_info); })); - + sub_info->sub = new ros::Subscriber(n.subscribe(sub_info->topic_name, 10, +#if __cplusplus < 201100L + boost::bind(in_cb, _1, sub_info) +#else + [sub_info](auto& msg){ in_cb(msg, sub_info); } +#endif + )); // waiting for all topics are publisherd while (sub_info->sub->getNumPublishers() == 0 ) { ros::Duration(1.0).sleep(); From 4dd2c68e18403f0e7705851a26ffab6ff5dfdbf9 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 13 Dec 2022 00:40:46 +0900 Subject: [PATCH 11/11] inidgo uses setuptools==44.1.1 for https://github.com/jsk-ros-pkg/jsk_common/pull/1773/commits/f834c0a86a2d19013675e60ffbb2c26ba5b87e6c --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 510c54d4d..d42f9826f 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -20,7 +20,7 @@ jobs: ROS_PARALLEL_TEST_JOBS: "-j8" # latest catkin_virtualenv with pip==21.0.1 is incompatible with python 2.x # https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/237 - BEFORE_SCRIPT : "sudo pip install virtualenv==15.1.0" + BEFORE_SCRIPT : "sudo pip install virtualenv==15.1.0 setuptools==44.1.1" - ROS_DISTRO: kinetic CONTAINER: ubuntu:16.04 ROS_PARALLEL_TEST_JOBS: "-j8"