Skip to content

Commit d87843e

Browse files
authored
Merge pull request #25 from jkk-research/ROS2
ROS 2 Humble support
2 parents 6f9b081 + bc5d5c2 commit d87843e

File tree

20 files changed

+706
-912
lines changed

20 files changed

+706
-912
lines changed

CMakeLists.txt

Lines changed: 65 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,85 @@
1-
option(BUILD_JSK_PKGS "Enable building of required components of jsk_recognition_msgs and jsk_rviz_plugins" ON)
2-
3-
if(BUILD_JSK_PKGS)
4-
add_subdirectory(include/jsk_recognition_msgs)
5-
# add_subdirectory(include/jsk_rviz_plugins) #TODO: allow building of rviz plugins as well
6-
endif()
7-
8-
cmake_minimum_required(VERSION 3.0.2)
1+
cmake_minimum_required(VERSION 3.5)
92
project(patchworkpp)
10-
113
add_compile_options(-std=c++17)
124
set(CMAKE_BUILD_TYPE "Release")
135

146
set(CMAKE_CXX_STANDARD 14)
157
set(CMAKE_CXX_STANDARD_REQUIRED ON)
168
set(CMAKE_CXX_EXTENSIONS OFF)
179

18-
find_package(catkin REQUIRED COMPONENTS
19-
roscpp
20-
rospy
21-
std_msgs
22-
roslaunch
23-
cv_bridge
24-
pcl_conversions
25-
pcl_ros
26-
geometry_msgs
27-
laser_geometry
28-
sensor_msgs
29-
message_generation
30-
jsk_recognition_msgs
31-
)
32-
33-
find_package(OpenCV REQUIRED)
34-
35-
generate_messages(
36-
DEPENDENCIES
37-
std_msgs
38-
geometry_msgs
39-
sensor_msgs
40-
)
41-
42-
find_package(PCL 1.7 REQUIRED)
10+
add_definitions(-DTARGET_ROS2)
11+
find_package(ament_cmake REQUIRED)
12+
find_package(rclcpp REQUIRED)
13+
find_package(pcl_ros REQUIRED)
14+
find_package(pcl_conversions REQUIRED)
15+
find_package(std_msgs REQUIRED)
16+
find_package(sensor_msgs REQUIRED)
17+
find_package(rclcpp_components REQUIRED)
4318
find_package(Boost 1.54 REQUIRED)
44-
find_package(OpenMP)
45-
if (OPENMP_FOUND)
46-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
47-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
48-
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
49-
endif()
5019

51-
catkin_package(
52-
INCLUDE_DIRS
53-
LIBRARIES
54-
CATKIN_DEPENDS roscpp rospy std_msgs
55-
)
56-
57-
include_directories(
58-
${catkin_INCLUDE_DIRS}
59-
${PCL_INCLUDE_DIRS}
60-
${OpenCV_INCLUDE_DIRS}
61-
include
62-
)
20+
set(INCLUDE_DIRS include
21+
${ament_cmake_INCLUDE_DIRS}
22+
${rclcpp_INCLUDE_DIRS}
23+
${pcl_ros_INCLUDE_DIRS}
24+
${pcl_conversions_INCLUDE_DIRS}
25+
${std_msgs_INCLUDE_DIRS}
26+
${sensor_msgs_INCLUDE_DIRS}
27+
${rclcpp_components_INCLUDE_DIRS})
28+
# Include
29+
include_directories(${INCLUDE_DIRS})
30+
31+
set(LIBRARY_DIRS
32+
${ament_cmake_LIBRARY_DIRS}
33+
${rclcpp_LIBRARY_DIRS}
34+
${pcl_ros_LIBRARY_DIRS}
35+
${pcl_conversions_LIBRARY_DIRS}
36+
${std_msgs_LIBRARY_DIRS}
37+
${sensor_msgs_LIBRARY_DIRS}
38+
${rclcpp_components_LIBRARY_DIRS})
39+
# Linking
40+
link_directories(${LIBRARY_DIRS})
41+
42+
set(LIBS
43+
${ament_cmake_LIBRARIES}
44+
${rclcpp_LIBRARIES}
45+
${pcl_ros_LIBRARIES}
46+
${pcl_conversions_LIBRARIES}
47+
${std_msgs_LIBRARIES}
48+
${sensor_msgs_LIBRARIES}
49+
${rclcpp_components_LIBRARIES})
6350

64-
add_executable(offline_kitti src/offline_kitti.cpp)
65-
target_link_libraries(offline_kitti ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
66-
add_dependencies(offline_kitti patchworkpp_generate_messages_cpp)
6751

6852
add_executable(demo src/demo.cpp)
69-
target_link_libraries(demo ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
70-
add_dependencies(demo patchworkpp_generate_messages_cpp)
53+
target_link_libraries(demo ${LIBS} ${PCL_LIBRARIES} )
7154

72-
add_executable(video src/video.cpp)
73-
target_link_libraries(video ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
74-
add_dependencies(video patchworkpp_generate_messages_cpp)
55+
add_library(patchworkpp SHARED src/patchworkpp.cpp)
56+
target_compile_definitions(patchworkpp PUBLIC "PATCHWORKPP_COMPOSITION_BUILDING_DLL")
57+
target_link_libraries(patchworkpp ${LIBS})
7558

59+
install(TARGETS
60+
patchworkpp
61+
ARCHIVE DESTINATION lib
62+
LIBRARY DESTINATION lib
63+
RUNTIME DESTINATION bin
64+
)
7665

7766
# ==== Install ====
7867
install(TARGETS demo
79-
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
80-
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
81-
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
82-
)
68+
ARCHIVE
69+
LIBRARY
70+
RUNTIME
71+
DESTINATION lib/${PROJECT_NAME})
8372

8473
install(DIRECTORY include/${PROJECT_NAME}/
85-
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
86-
87-
install(DIRECTORY launch config
88-
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
89-
)
74+
DESTINATION include/${PROJECT_NAME})
75+
76+
install(DIRECTORY launch config rviz DESTINATION share/${PROJECT_NAME})
77+
78+
ament_export_dependencies(ament_cmake)
79+
ament_export_dependencies(rclcpp)
80+
ament_export_dependencies(pcl_ros)
81+
ament_export_dependencies(pcl_conversions)
82+
ament_export_dependencies(std_msgs)
83+
ament_export_dependencies(sensor_msgs)
84+
ament_export_include_directories(${INCLUDE_DIRS})
85+
ament_package()

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,21 @@ You may need to install ROS, PCL, Eigen, ...
2525
To build Patchwork++, you can follow below codes.
2626

2727
```bash
28-
$ mkdir -p ~/catkin_ws/src
29-
$ cd ~/catkin_ws
30-
$ catkin build # or catkin_make
28+
$ mkdir -p ~/ros2_ws/src
29+
$ cd ~/ros2_ws
30+
$ colcon build --packages-select patchworkpp --symlink-install
3131
```
3232

3333
## :runner: To run the demo codes
3434
There is a demo which executes Patchwork++ with sample rosbag file. You can download a sample file with the following command.
35-
36-
> For the sample rosbag data, I utilizes [semantickitti2bag](https://github.com/amslabtech/semantickitti2bag) package.
37-
38-
```bash
39-
$ wget https://urserver.kaist.ac.kr/publicdata/patchwork++/kitti_00_sample.bag
40-
```
41-
> If you have any trouble to download the file by the above command, please click [here][kitti_sample_link] to download the file directly.
42-
43-
[kitti_sample_link]: https://urserver.kaist.ac.kr/publicdata/patchwork++/kitti_00_sample.bag
44-
45-
> The rosbag file is based on the [KITTI][kittilink] dataset. The bin files are merged into the rosbag file format.
46-
47-
> The sample file contains LiDAR sensor data only.
48-
49-
[kittilink]: http://www.cvlibs.net/datasets/kitti/raw_data.php
35+
> download Kitti dataset for ros2 [kittiRos2link]: https://github.com/umtclskn/ros2_kitti_publishers/tree/main
5036
5137
Then, you can run demo as follows.
52-
5338
```bash
5439
# Start Patchwork++
55-
$ roslaunch patchworkpp demo.launch
40+
$ ros2 launch patchworkpp demo.launch
5641
# Start the bag file
57-
$ rosbag play kitti_00_sample.bag
42+
$ ros2 bag play kitti_00_sample.db3
5843
```
5944

6045
## :pushpin: TODO List

config/params.yaml

Lines changed: 0 additions & 36 deletions
This file was deleted.

config/params_ros2.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default parameters for Patchwork PlusPlus ROS2 package
2+
# my_param1: 0.0

include/jsk_recognition_msgs/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

include/jsk_recognition_msgs/msg/PolygonArray.msg

Lines changed: 0 additions & 6 deletions
This file was deleted.

include/jsk_recognition_msgs/package.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)