Skip to content

Commit

Permalink
Attempt loading sargans color over SRTM1 DEM
Browse files Browse the repository at this point in the history
* Doesn't work, documented the limitation

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Jan 15, 2024
1 parent f6599d1 commit 9738ba8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,22 @@ ros2 launch grid_map_geo load_vrt_launch.xml

**Note:** `grid_map_geo` uses asserts to catch coding errors; they are enabled by default when
building in debug mode, and removed from release mode.

## Mixing data from different datums, resolutions, and raster sizes

`grid_map_geo` does not yet support automatically overlaying color data over elevation data from
different sources. Currently, color data must be the same datum, resolution and size for both the
DEM raster and the color raster.

As an example, `sertig_color.tif` color data can be requested loaded on the SRTM1 DEM at sertig:

```bash
ros2 launch grid_map_geo load_tif.launch.py params_file:=config/sargans_color_over_srtm1.yaml
# OR
ros2 run --prefix 'gdb -ex run --args' grid_map_geo map_publisher --ros-args --params-file config/sargans_color_over_srtm1.yaml
```

These datasets are different sizes, different resultions, and use different datums.

Either of these ways of launching cause a floating point crash in `grid_map::getIndexFromLinearIndex`.
This limitation may be addressed in a future version.
8 changes: 8 additions & 0 deletions config/sargans_color_over_srtm1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
map_publisher:
ros__parameters:
gdal_dataset_path: /vsizip/vsicurl/https://terrain.ardupilot.org/SRTM1/N09E047.hgt.zip/N09E047.hgt
gdal_dataset_color_path: "resources/sargans_color.tif"
max_map_width: 3601
max_map_height: 3601
map_origin_latitude: 47.033333
map_origin_longitude: 9.433333
29 changes: 28 additions & 1 deletion launch/load_tif.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.conditions import IfCondition, LaunchConfigurationEquals, LaunchConfigurationNotEquals
from launch.substitutions import LaunchConfiguration

from launch_ros.actions import Node
Expand Down Expand Up @@ -40,6 +40,19 @@ def generate_launch_description():
],
output="screen",
emulate_tty=True,
condition=LaunchConfigurationEquals(LaunchConfiguration("params_file"), "")
)

# map publisher node with params file
map_publisher_with_param_file = Node(
package="grid_map_geo",
namespace="grid_map_geo",
executable="map_publisher",
name="map_publisher",
parameters=[LaunchConfiguration("params_file")],
output="screen",
emulate_tty=True,
condition=LaunchConfigurationNotEquals(LaunchConfiguration("params_file"), "")
)

# rviz node
Expand Down Expand Up @@ -77,8 +90,22 @@ def generate_launch_description():
),
description="Full path to the elevation texture file.",
),
DeclareLaunchArgument(
"gdal_dataset_color_path",
default_value=os.path.join(
pkg_grid_map_geo, "resources", default_gdal_color_dataset
),
description="Full path to the elevation texture file.",
),
DeclareLaunchArgument(
"params_file",
default_value="",
description="YAML parameter file path.",
),

static_transform_publisher,
map_publisher,
map_publisher_with_param_file,
rviz,
]
)
Expand Down

0 comments on commit 9738ba8

Please sign in to comment.