Skip to content

Commit 44cccb0

Browse files
authored
Merge branch 'ros2' into bugfix/51-gh-pages-permissions
2 parents 4823050 + 58f6052 commit 44cccb0

File tree

8 files changed

+272
-53
lines changed

8 files changed

+272
-53
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ find_package(ament_cmake REQUIRED)
1919
find_package(grid_map_msgs REQUIRED)
2020
find_package(grid_map_ros REQUIRED)
2121
find_package(grid_map_core REQUIRED)
22+
find_package(tf2_ros REQUIRED)
2223
find_package(rclcpp REQUIRED)
2324

2425
find_package(Eigen3 REQUIRED)
@@ -49,6 +50,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen PRIVATE GDAL::GDAL)
4950
ament_target_dependencies(${PROJECT_NAME} PUBLIC
5051
grid_map_core
5152
grid_map_ros
53+
tf2_ros
5254
)
5355

5456
add_executable(test_tif_loader

include/grid_map_geo/grid_map_geo.hpp

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#include <grid_map_core/GridMap.hpp>
4040
#include <grid_map_core/iterators/GridMapIterator.hpp>
41+
#include "tf2_ros/transform_broadcaster.h"
4142

4243
#include <iostream>
4344
struct Location {
@@ -47,7 +48,7 @@ struct Location {
4748

4849
class GridMapGeo {
4950
public:
50-
GridMapGeo();
51+
GridMapGeo(const std::string& frame_id = "map");
5152
virtual ~GridMapGeo();
5253

5354
/**
@@ -84,32 +85,40 @@ class GridMapGeo {
8485
};
8586

8687
/**
87-
* @brief Set the Altitude Origin object
88-
*
89-
* @param altitude
88+
* @brief Get the name of the coordinate frame of the dataset
89+
*
90+
* @return std::string
9091
*/
91-
void setAltitudeOrigin(const double altitude) { localorigin_altitude_ = altitude; };
92+
std::string getCoordinateName() { return coordinate_name_; };
93+
94+
95+
/**
96+
* @brief Overloading terrain loading with only elevation
97+
*
98+
* @param map_path Path to dsm path (Supported formats are *.tif)
99+
*/
100+
bool Load(const std::string& map_path) {
101+
Load(map_path, "");
102+
}
92103

93104
/**
94105
* @brief Helper function for loading terrain from path
95106
*
96107
* @param map_path Path to dsm path (Supported formats are *.tif)
97-
* @param algin_terrain Geo align terrain
98108
* @param color_map_path Path to color raster files to visualize terrain texture (Supported formats are *.tif)
99109
* @return true Successfully loaded terrain
100110
* @return false Failed to load terrain
101111
*/
102-
bool Load(const std::string& map_path, bool algin_terrain, const std::string color_map_path = "");
112+
bool Load(const std::string& map_path, const std::string &color_map_path);
103113

104114
/**
105115
* @brief Initialize grid map from a geotiff file
106116
*
107117
* @param path Path to dsm path (Supported formats are *.tif)
108-
* @param align_terrain
109118
* @return true Successfully loaded terrain
110119
* @return false Failed to load terrain
111120
*/
112-
bool initializeFromGeotiff(const std::string& path, bool align_terrain = true);
121+
bool initializeFromGeotiff(const std::string& path);
113122

114123
/**
115124
* @brief Load a color layer from a geotiff file (orthomosaic)
@@ -171,11 +180,12 @@ class GridMapGeo {
171180
*/
172181
void AddLayerNormals(std::string reference_layer);
173182

183+
geometry_msgs::msg::TransformStamped static_transformStamped_;
184+
174185
protected:
175186
grid_map::GridMap grid_map_;
176-
double localorigin_e_{789823.93}; // duerrboden berghaus
177-
double localorigin_n_{177416.56};
178-
double localorigin_altitude_{0.0};
179187
Location maporigin_;
188+
std::string frame_id_{""};
189+
std::string coordinate_name_{""};
180190
};
181191
#endif
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<launch>
2+
<arg name="rviz" default="true"/>
3+
<node pkg="tf2_ros" exec="static_transform_publisher" name="world_map" args="--frame-id world --child-frame-id map"/>
4+
5+
<node pkg="grid_map_geo" exec="test_tif_loader" name="first_tif_loader" output="screen">
6+
<param name="frame_id" value="map"/>
7+
<param name="tif_path" value="$(find-pkg-share grid_map_geo)/resources/sargans.tif"/>
8+
<param name="tif_color_path" value="$(find-pkg-share grid_map_geo)/resources/sargans_color.tif"/>
9+
</node>
10+
11+
<node pkg="grid_map_geo" exec="test_tif_loader" name="second_tif_loader" output="screen">
12+
<param name="frame_id" value="dischma_valley"/>
13+
<param name="tif_path" value="$(find-pkg-share grid_map_geo)/resources/dischma_valley.tif"/>
14+
<param name="tif_color_path" value="$(find-pkg-share grid_map_geo)/resources/dischma_valley_color.tif"/>
15+
<remap from="elevation_map" to="second_elevation_map"/>
16+
</node>
17+
18+
19+
<group if="$(var rviz)">
20+
<node exec="rviz2" name="rviz2" pkg="rviz2" args="-d $(find-pkg-share grid_map_geo)/rviz/multi_config.rviz" />
21+
</group>
22+
</launch>

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<depend>eigen</depend>
1717
<depend>grid_map_core</depend>
1818
<depend>grid_map_ros</depend>
19+
<depend>tf2_ros</depend>
1920
<depend>libgdal-dev</depend>
2021
<depend>rclcpp</depend>
2122
<depend>yaml_cpp_vendor</depend>

rviz/config.rviz

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Panels:
88
- /Status1
99
- /GridMap1
1010
Splitter Ratio: 0.5
11-
Tree Height: 381
11+
Tree Height: 1106
1212
- Class: rviz_common/Selection
1313
Name: Selection
1414
- Class: rviz_common/Tool Properties
@@ -64,7 +64,7 @@ Visualization Manager:
6464
Min Color: 0; 0; 0
6565
Min Intensity: 0
6666
Name: GridMap
67-
Show Grid Lines: true
67+
Show Grid Lines: false
6868
Topic:
6969
Depth: 5
7070
Durability Policy: Volatile
@@ -143,10 +143,10 @@ Visualization Manager:
143143
Window Geometry:
144144
Displays:
145145
collapsed: false
146-
Height: 670
146+
Height: 1403
147147
Hide Left Dock: false
148148
Hide Right Dock: true
149-
QMainWindow State: 000000ff00000000fd0000000400000000000001630000021afc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006200fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002c0000021a000000e300fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000029afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000002c0000029a000000c600fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004280000003efc0100000002fb0000000800540069006d00650100000000000004280000023d00fffffffb0000000800540069006d00650100000000000004500000000000000000000002c40000021a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
149+
QMainWindow State: 000000ff00000000fd000000040000000000000163000004ddfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004dd000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000029afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000002c0000029a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000a000000003efc0100000002fb0000000800540069006d0065010000000000000a00000002fb00fffffffb0000000800540069006d0065010000000000000450000000000000000000000897000004dd00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
150150
Selection:
151151
collapsed: false
152152
Time:
@@ -155,6 +155,6 @@ Window Geometry:
155155
collapsed: false
156156
Views:
157157
collapsed: true
158-
Width: 1060
158+
Width: 2560
159159
X: 0
160160
Y: 0

rviz/multi_config.rviz

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
Panels:
2+
- Class: rviz_common/Displays
3+
Help Height: 78
4+
Name: Displays
5+
Property Tree Widget:
6+
Expanded:
7+
- /Global Options1
8+
- /Status1
9+
- /GridMap1
10+
- /GridMap2
11+
Splitter Ratio: 0.5
12+
Tree Height: 1106
13+
- Class: rviz_common/Selection
14+
Name: Selection
15+
- Class: rviz_common/Tool Properties
16+
Expanded:
17+
- /2D Goal Pose1
18+
- /Publish Point1
19+
Name: Tool Properties
20+
Splitter Ratio: 0.5886790156364441
21+
- Class: rviz_common/Views
22+
Expanded:
23+
- /Current View1
24+
Name: Views
25+
Splitter Ratio: 0.5
26+
- Class: rviz_common/Time
27+
Experimental: false
28+
Name: Time
29+
SyncMode: 0
30+
SyncSource: ""
31+
Visualization Manager:
32+
Class: ""
33+
Displays:
34+
- Alpha: 0.5
35+
Cell Size: 100
36+
Class: rviz_default_plugins/Grid
37+
Color: 160; 160; 164
38+
Enabled: true
39+
Line Style:
40+
Line Width: 0.029999999329447746
41+
Value: Lines
42+
Name: Grid
43+
Normal Cell Count: 0
44+
Offset:
45+
X: 0
46+
Y: 0
47+
Z: 0
48+
Plane: XY
49+
Plane Cell Count: 10
50+
Reference Frame: <Fixed Frame>
51+
Value: true
52+
- Alpha: 0.5
53+
Autocompute Intensity Bounds: true
54+
Class: grid_map_rviz_plugin/GridMap
55+
Color: 200; 200; 200
56+
Color Layer: color
57+
Color Transformer: ColorLayer
58+
Enabled: true
59+
Height Layer: elevation
60+
Height Transformer: GridMapLayer
61+
History Length: 1
62+
Invert Rainbow: false
63+
Max Color: 255; 255; 255
64+
Max Intensity: 10
65+
Min Color: 0; 0; 0
66+
Min Intensity: 0
67+
Name: GridMap
68+
Show Grid Lines: false
69+
Topic:
70+
Depth: 5
71+
Durability Policy: Volatile
72+
Filter size: 10
73+
History Policy: Keep Last
74+
Reliability Policy: Reliable
75+
Value: /elevation2
76+
Use Rainbow: true
77+
Value: true
78+
- Alpha: 1
79+
Autocompute Intensity Bounds: true
80+
Class: grid_map_rviz_plugin/GridMap
81+
Color: 200; 200; 200
82+
Color Layer: color
83+
Color Transformer: ColorLayer
84+
Enabled: true
85+
Height Layer: elevation
86+
Height Transformer: GridMapLayer
87+
History Length: 1
88+
Invert Rainbow: false
89+
Max Color: 255; 255; 255
90+
Max Intensity: 10
91+
Min Color: 0; 0; 0
92+
Min Intensity: 0
93+
Name: GridMap
94+
Show Grid Lines: false
95+
Topic:
96+
Depth: 5
97+
Durability Policy: Volatile
98+
Filter size: 10
99+
History Policy: Keep Last
100+
Reliability Policy: Reliable
101+
Value: /elevation_map
102+
Use Rainbow: true
103+
Value: true
104+
Enabled: true
105+
Global Options:
106+
Background Color: 255; 255; 255
107+
Fixed Frame: map
108+
Frame Rate: 30
109+
Name: root
110+
Tools:
111+
- Class: rviz_default_plugins/Interact
112+
Hide Inactive Objects: true
113+
- Class: rviz_default_plugins/MoveCamera
114+
- Class: rviz_default_plugins/Select
115+
- Class: rviz_default_plugins/FocusCamera
116+
- Class: rviz_default_plugins/Measure
117+
Line color: 128; 128; 0
118+
- Class: rviz_default_plugins/SetInitialPose
119+
Covariance x: 0.25
120+
Covariance y: 0.25
121+
Covariance yaw: 0.06853891909122467
122+
Topic:
123+
Depth: 5
124+
Durability Policy: Volatile
125+
History Policy: Keep Last
126+
Reliability Policy: Reliable
127+
Value: /initialpose
128+
- Class: rviz_default_plugins/SetGoal
129+
Topic:
130+
Depth: 5
131+
Durability Policy: Volatile
132+
History Policy: Keep Last
133+
Reliability Policy: Reliable
134+
Value: /goal_pose
135+
- Class: rviz_default_plugins/PublishPoint
136+
Single click: true
137+
Topic:
138+
Depth: 5
139+
Durability Policy: Volatile
140+
History Policy: Keep Last
141+
Reliability Policy: Reliable
142+
Value: /clicked_point
143+
Transformation:
144+
Current:
145+
Class: rviz_default_plugins/TF
146+
Value: true
147+
Views:
148+
Current:
149+
Class: rviz_default_plugins/Orbit
150+
Distance: 22312.625
151+
Enable Stereo Rendering:
152+
Stereo Eye Separation: 0.05999999865889549
153+
Stereo Focal Distance: 1
154+
Swap Stereo Eyes: false
155+
Value: false
156+
Focal Point:
157+
X: -469.88262939453125
158+
Y: 4805.85498046875
159+
Z: -1997.9356689453125
160+
Focal Shape Fixed Size: true
161+
Focal Shape Size: 0.05000000074505806
162+
Invert Z Axis: false
163+
Name: Current View
164+
Near Clip Distance: 0.009999999776482582
165+
Pitch: 0.8752031326293945
166+
Target Frame: <Fixed Frame>
167+
Value: Orbit (rviz)
168+
Yaw: 0.6453869342803955
169+
Saved: ~
170+
Window Geometry:
171+
Displays:
172+
collapsed: false
173+
Height: 1403
174+
Hide Left Dock: false
175+
Hide Right Dock: true
176+
QMainWindow State: 000000ff00000000fd000000040000000000000163000004ddfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004dd000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000029afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000002c0000029a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e1000001970000000300000a000000003efc0100000002fb0000000800540069006d0065010000000000000a00000002fb00fffffffb0000000800540069006d0065010000000000000450000000000000000000000897000004dd00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
177+
Selection:
178+
collapsed: false
179+
Time:
180+
collapsed: false
181+
Tool Properties:
182+
collapsed: false
183+
Views:
184+
collapsed: true
185+
Width: 2560
186+
X: 0
187+
Y: 0

0 commit comments

Comments
 (0)