Skip to content

Commit eed633e

Browse files
committed
chore: Fixed ros2 jazzy compile error
1 parent 3dccdb9 commit eed633e

File tree

5 files changed

+54
-30
lines changed

5 files changed

+54
-30
lines changed

orbbec_camera/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ option(USE_NV_HW_DECODER "Use Nvidia hardware decoder" OFF)
1515
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1616
add_compile_options(-Wall -Wextra -Werror -Wno-pedantic -Wno-array-bounds)
1717
endif ()
18+
# Check if ROS Jazzy is installed
19+
if("$ENV{ROS_DISTRO}" STREQUAL "jazzy")
20+
add_compile_definitions(ROS_JAZZY)
21+
endif()
1822

1923
# find dependencies
2024
set(dependencies

orbbec_camera/include/orbbec_camera/ob_camera_node.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <vector>
2828
#include <atomic>
2929
#include <opencv2/opencv.hpp>
30-
#include <cv_bridge/cv_bridge.h>
3130
#include <sensor_msgs/msg/point_cloud2.hpp>
3231
#include <sensor_msgs/point_cloud2_iterator.hpp>
3332
#include <tf2_ros/static_transform_broadcaster.h>
@@ -64,6 +63,12 @@
6463
#include "jpeg_decoder.h"
6564
#include <std_msgs/msg/string.hpp>
6665

66+
#if defined(ROS_JAZZY)
67+
#include <cv_bridge/cv_bridge.hpp>
68+
#else
69+
#include <cv_bridge/cv_bridge.h>
70+
#endif
71+
6772
#define STREAM_NAME(sip) \
6873
(static_cast<std::ostringstream&&>(std::ostringstream() \
6974
<< _stream_name[sip.first] \

orbbec_camera/include/orbbec_camera/ros_param_backend.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023 Orbbec 3D Technology, Inc
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*******************************************************************************/
2+
* Copyright (c) 2023 Orbbec 3D Technology, Inc
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
1616

1717
#pragma once
1818
#include <rclcpp/rclcpp.hpp>
@@ -22,8 +22,13 @@ class ParametersBackend {
2222
public:
2323
explicit ParametersBackend(rclcpp::Node* node);
2424
~ParametersBackend();
25+
#if defined(ROS_JAZZY)
26+
void addOnSetParametersCallback(
27+
rclcpp::node_interfaces::NodeParametersInterface::OnSetParametersCallbackType callback);
28+
#else
2529
void addOnSetParametersCallback(
2630
rclcpp::node_interfaces::NodeParametersInterface::OnParametersSetCallbackType callback);
31+
#endif
2732

2833
private:
2934
rclcpp::Node* node_;

orbbec_camera/src/d2c_viewer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*******************************************************************************/
16+
#if defined(ROS_JAZZY)
17+
#include <cv_bridge/cv_bridge.hpp>
18+
#else
1619
#include <cv_bridge/cv_bridge.h>
20+
#endif
1721
#include <sensor_msgs/image_encodings.hpp>
1822

1923
#include <opencv2/opencv.hpp>
Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023 Orbbec 3D Technology, Inc
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*******************************************************************************/
2+
* Copyright (c) 2023 Orbbec 3D Technology, Inc
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
1616

1717
#include "orbbec_camera/ros_param_backend.h"
1818
namespace orbbec_camera {
@@ -26,10 +26,16 @@ ParametersBackend::~ParametersBackend() {
2626
ros_callback_.reset();
2727
}
2828
}
29-
29+
#if defined(ROS_JAZZY)
30+
void ParametersBackend::addOnSetParametersCallback(
31+
rclcpp::node_interfaces::NodeParametersInterface::OnSetParametersCallbackType callback) {
32+
ros_callback_ = node_->add_on_set_parameters_callback(callback);
33+
}
34+
#else
3035
void ParametersBackend::addOnSetParametersCallback(
3136
rclcpp::node_interfaces::NodeParametersInterface::OnParametersSetCallbackType callback) {
3237
ros_callback_ = node_->add_on_set_parameters_callback(callback);
3338
}
39+
#endif
3440

3541
} // namespace orbbec_camera

0 commit comments

Comments
 (0)