Skip to content

Commit dfb064d

Browse files
committed
Port grid_map_geo to ROS2
This commit ports the package into ROS2. Tested on ROS Humble
1 parent 64161b8 commit dfb064d

File tree

8 files changed

+185
-149
lines changed

8 files changed

+185
-149
lines changed

CMakeLists.txt

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
1-
cmake_minimum_required(VERSION 2.8.12)
1+
cmake_minimum_required(VERSION 3.8)
22
project(grid_map_geo)
3-
add_definitions(-std=c++11)
4-
5-
find_package(GDAL)
6-
find_package(catkin REQUIRED COMPONENTS
7-
roscpp
8-
eigen_catkin
9-
grid_map_core
10-
grid_map_ros
11-
)
123

13-
catkin_package(
14-
INCLUDE_DIRS include
15-
LIBRARIES grid_map_geo
16-
)
4+
5+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6+
add_compile_options(-Wall -Wextra -Wpedantic)
7+
endif()
8+
9+
# find dependencies
10+
find_package(GDAL REQUIRED)
11+
find_package(eigen3_cmake_module REQUIRED)
12+
find_package(Eigen3)
13+
14+
find_package(ament_cmake REQUIRED)
15+
find_package(rclcpp REQUIRED)
16+
find_package(std_msgs REQUIRED)
17+
find_package(geometry_msgs REQUIRED)
18+
find_package(grid_map_core REQUIRED)
19+
find_package(grid_map_ros REQUIRED)
20+
find_package(grid_map_msgs REQUIRED)
21+
1722

1823
include_directories(
1924
include
20-
${Boost_INCLUDE_DIR}
21-
${catkin_INCLUDE_DIRS}
22-
${Eigen_INCLUDE_DIRS}
2325
)
2426

2527
add_library(${PROJECT_NAME}
2628
src/grid_map_geo.cpp
2729
)
28-
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
29-
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${GeographicLib_LIBRARIES} ${GDAL_LIBRARY})
30+
ament_target_dependencies(${PROJECT_NAME} rclcpp std_msgs geometry_msgs grid_map_core grid_map_ros grid_map_msgs)
31+
target_include_directories(${PROJECT_NAME} PUBLIC "${Eigen3_INCLUDE_DIRS}")
32+
target_link_libraries(${PROJECT_NAME} ${GDAL_LIBRARY})
3033

3134
add_executable(test_tif_loader
3235
src/test_tif_loader.cpp
3336
)
34-
add_dependencies(test_tif_loader ${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${GDAL_LIBRARY})
35-
target_link_libraries(test_tif_loader ${PROJECT_NAME} ${catkin_LIBRARIES} ${GDAL_LIBRARY} ${OpenCV_LIBRARIES})
37+
ament_target_dependencies(test_tif_loader rclcpp std_msgs)
38+
target_include_directories(test_tif_loader PUBLIC "${Eigen3_INCLUDE_DIRS}")
39+
target_link_libraries(test_tif_loader ${PROJECT_NAME} ${GDAL_LIBRARY})
3640

37-
if(CATKIN_ENABLE_TESTING)
38-
# Add gtest based cpp test target and link libraries
39-
catkin_add_gtest(${PROJECT_NAME}-test test/main.cpp
40-
test/test_grid_map_geo.cpp)
41+
install(TARGETS
42+
test_tif_loader
43+
DESTINATION lib/${PROJECT_NAME})
4144

42-
if(TARGET ${PROJECT_NAME}-test)
43-
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}
44-
${catkin_LIBRARIES}
45-
${YAML_CPP_LIBRARIES} ${GDAL_LIBRARY} ${OpenCV_LIBRARIES})
46-
endif()
45+
install(DIRECTORY
46+
launch
47+
DESTINATION share/${PROJECT_NAME}/
48+
)
4749

50+
if(BUILD_TESTING)
51+
find_package(ament_lint_auto REQUIRED)
52+
# the following line skips the linter which checks for copyrights
53+
# comment the line when a copyright and license is added to all source files
54+
set(ament_cmake_copyright_FOUND TRUE)
55+
# the following line skips cpplint (only works in a git repo)
56+
# comment the line when this package is in a git repo and when
57+
# a copyright and license is added to all source files
58+
set(ament_cmake_cpplint_FOUND TRUE)
59+
ament_lint_auto_find_test_dependencies()
4860
endif()
61+
62+
ament_package()

Makefile

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

dependencies.rosinstall

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

launch/config.rviz

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,40 @@
11
Panels:
2-
- Class: rviz/Displays
2+
- Class: rviz_common/Displays
33
Help Height: 78
44
Name: Displays
55
Property Tree Widget:
66
Expanded:
77
- /Global Options1
88
- /Status1
99
- /GridMap1
10+
- /GridMap1/Status1
11+
- /GridMap1/Topic1
1012
Splitter Ratio: 0.5
11-
Tree Height: 848
12-
- Class: rviz/Selection
13+
Tree Height: 1106
14+
- Class: rviz_common/Selection
1315
Name: Selection
14-
- Class: rviz/Tool Properties
16+
- Class: rviz_common/Tool Properties
1517
Expanded:
16-
- /2D Pose Estimate1
17-
- /2D Nav Goal1
18+
- /2D Goal Pose1
1819
- /Publish Point1
1920
Name: Tool Properties
2021
Splitter Ratio: 0.5886790156364441
21-
- Class: rviz/Views
22+
- Class: rviz_common/Views
2223
Expanded:
2324
- /Current View1
2425
Name: Views
2526
Splitter Ratio: 0.5
26-
- Class: rviz/Time
27+
- Class: rviz_common/Time
2728
Experimental: false
2829
Name: Time
2930
SyncMode: 0
3031
SyncSource: ""
31-
Preferences:
32-
PromptSaveOnExit: true
33-
Toolbars:
34-
toolButtonStyle: 2
3532
Visualization Manager:
3633
Class: ""
3734
Displays:
3835
- Alpha: 0.5
39-
Cell Size: 1
40-
Class: rviz/Grid
36+
Cell Size: 100
37+
Class: rviz_default_plugins/Grid
4138
Color: 160; 160; 164
4239
Enabled: true
4340
Line Style:
@@ -70,65 +67,88 @@ Visualization Manager:
7067
Min Intensity: 0
7168
Name: GridMap
7269
Show Grid Lines: false
73-
Topic: /elevation_map
74-
Unreliable: false
70+
Topic:
71+
Depth: 5
72+
Durability Policy: System Default
73+
Filter size: 10
74+
History Policy: System Default
75+
Reliability Policy: System Default
76+
Value: /grid_map_geo/elevation_map
7577
Use Rainbow: true
7678
Value: true
7779
Enabled: true
7880
Global Options:
7981
Background Color: 255; 255; 255
80-
Default Light: true
8182
Fixed Frame: map
8283
Frame Rate: 30
8384
Name: root
8485
Tools:
85-
- Class: rviz/Interact
86+
- Class: rviz_default_plugins/Interact
8687
Hide Inactive Objects: true
87-
- Class: rviz/MoveCamera
88-
- Class: rviz/Select
89-
- Class: rviz/FocusCamera
90-
- Class: rviz/Measure
91-
- Class: rviz/SetInitialPose
92-
Theta std deviation: 0.2617993950843811
93-
Topic: /initialpose
94-
X std deviation: 0.5
95-
Y std deviation: 0.5
96-
- Class: rviz/SetGoal
97-
Topic: /move_base_simple/goal
98-
- Class: rviz/PublishPoint
88+
- Class: rviz_default_plugins/MoveCamera
89+
- Class: rviz_default_plugins/Select
90+
- Class: rviz_default_plugins/FocusCamera
91+
- Class: rviz_default_plugins/Measure
92+
Line color: 128; 128; 0
93+
- Class: rviz_default_plugins/SetInitialPose
94+
Covariance x: 0.25
95+
Covariance y: 0.25
96+
Covariance yaw: 0.06853891909122467
97+
Topic:
98+
Depth: 5
99+
Durability Policy: Volatile
100+
History Policy: Keep Last
101+
Reliability Policy: Reliable
102+
Value: /initialpose
103+
- Class: rviz_default_plugins/SetGoal
104+
Topic:
105+
Depth: 5
106+
Durability Policy: Volatile
107+
History Policy: Keep Last
108+
Reliability Policy: Reliable
109+
Value: /goal_pose
110+
- Class: rviz_default_plugins/PublishPoint
99111
Single click: true
100-
Topic: /clicked_point
112+
Topic:
113+
Depth: 5
114+
Durability Policy: Volatile
115+
History Policy: Keep Last
116+
Reliability Policy: Reliable
117+
Value: /clicked_point
118+
Transformation:
119+
Current:
120+
Class: rviz_default_plugins/TF
101121
Value: true
102122
Views:
103123
Current:
104-
Class: rviz/Orbit
105-
Distance: 2959.1279296875
124+
Class: rviz_default_plugins/Orbit
125+
Distance: 1285.9224853515625
106126
Enable Stereo Rendering:
107127
Stereo Eye Separation: 0.05999999865889549
108128
Stereo Focal Distance: 1
109129
Swap Stereo Eyes: false
110130
Value: false
111131
Focal Point:
112-
X: 11.737425804138184
113-
Y: -95.61576843261719
114-
Z: 43.985958099365234
132+
X: -122.6202392578125
133+
Y: -74.37590026855469
134+
Z: 250.5304718017578
115135
Focal Shape Fixed Size: true
116136
Focal Shape Size: 0.05000000074505806
117137
Invert Z Axis: false
118138
Name: Current View
119139
Near Clip Distance: 0.009999999776482582
120-
Pitch: 0.8253984451293945
140+
Pitch: 0.7802029252052307
121141
Target Frame: <Fixed Frame>
122142
Value: Orbit (rviz)
123-
Yaw: 0.6203981637954712
143+
Yaw: 0.7153979539871216
124144
Saved: ~
125145
Window Geometry:
126146
Displays:
127147
collapsed: false
128-
Height: 1145
148+
Height: 1403
129149
Hide Left Dock: false
130150
Hide Right Dock: false
131-
QMainWindow State: 000000ff00000000fd000000040000000000000156000003dbfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000003db000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000003dbfc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000003db000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073d0000003efc0100000002fb0000000800540069006d006501000000000000073d000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000004cc000003db00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
151+
QMainWindow State: 000000ff00000000fd000000040000000000000156000004ddfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004dd000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000004ddfc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000004dd000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000a000000003efc0100000002fb0000000800540069006d0065010000000000000a00000002fb00fffffffb0000000800540069006d006501000000000000045000000000000000000000078f000004dd00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
132152
Selection:
133153
collapsed: false
134154
Time:
@@ -137,6 +157,6 @@ Window Geometry:
137157
collapsed: false
138158
Views:
139159
collapsed: false
140-
Width: 1853
141-
X: 67
142-
Y: 27
160+
Width: 2560
161+
X: 0
162+
Y: 0

launch/load_tif.launch

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

launch/run.launch.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from launch import LaunchDescription
2+
from launch_ros.actions import Node
3+
from ament_index_python.packages import get_package_share_directory
4+
import os
5+
6+
def generate_launch_description():
7+
package_dir = get_package_share_directory('grid_map_geo')
8+
tif_loader = Node(
9+
package='grid_map_geo',
10+
namespace='grid_map_geo',
11+
executable='test_tif_loader',
12+
name='tif_loader',
13+
output="screen",
14+
emulate_tty=True,
15+
parameters=[
16+
{"tif_path": "/home/jaeyoung/dev/terrain-models/models/hinwil.tif"},
17+
{"tif_color_path": "/home/jaeyoung/dev/terrain-models/models/hinwil_color.tif"},
18+
]
19+
)
20+
rviz = Node(
21+
package='rviz2',
22+
namespace='',
23+
executable='rviz2',
24+
name='rviz2',
25+
arguments=['-d', [os.path.join(package_dir, 'launch/config.rviz')]]
26+
)
27+
return LaunchDescription([
28+
tif_loader,
29+
rviz
30+
])

package.xml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
<package>
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
24
<name>grid_map_geo</name>
3-
<version>0.0.1</version>
4-
<description>Georeferenced grid map</description>
5+
<version>0.0.0</version>
6+
<description>TODO: Package description</description>
7+
<maintainer email="[email protected]">jaeyoung</maintainer>
8+
<license>TODO: License declaration</license>
59

6-
<maintainer email="[email protected]">Jaeyoung Lim</maintainer>
10+
<buildtool_depend>ament_cmake</buildtool_depend>
711

8-
<author>Jaeyoung Lim</author>
9-
10-
<license>BSD-3</license>
11-
12-
<url type="website">https://github.com/Jaeyoung-Lim/grid_map_geo</url>
13-
<url type="bugtracker">https://github.com/Jaeyoung-Lim/grid_map_geo/issues</url>
14-
15-
<!-- Dependencies which this package needs to build itself. -->
16-
<buildtool_depend>catkin</buildtool_depend>
17-
<build_depend>eigen_catkin</build_depend>
18-
<build_depend>grid_map_core</build_depend>
19-
<build_depend>grid_map_ros</build_depend>
20-
<run_depend>eigen_catkin</run_depend>
12+
<test_depend>ament_lint_auto</test_depend>
13+
<test_depend>ament_lint_common</test_depend>
14+
<depend>rclcpp</depend>
15+
<depend>grid_map_core</depend>
2116
<export>
17+
<build_type>ament_cmake</build_type>
2218
</export>
2319
</package>

0 commit comments

Comments
 (0)