Skip to content

[Draft] Seed costmap with CanElevation data#111

Draft
ErikCald wants to merge 1 commit intomainfrom
erik-costmap-seeding
Draft

[Draft] Seed costmap with CanElevation data#111
ErikCald wants to merge 1 commit intomainfrom
erik-costmap-seeding

Conversation

@ErikCald
Copy link
Contributor

This PR introduces a costmap seeding package which downloads 1 meter resolution elevation data from CanElevation, generates PNG traversability files, then can load the traversability PNGs into the costmap live to give the rover insight into the terrain ahead.

Bug as of July 23, 2025: It is off by around 50 meters. My current best guess on why is because the CanElevation data is downloaded and stored in lat lon values in a world UTM standard, but when this is loaded into the global map using /fromLL and /toLL of the navsat transform node, it uses something else, like a dynamic datum and a different standard. Need to investigate that and correct for it.

@ErikCald ErikCald requested review from ConnorNeed and Copilot July 23, 2025 17:33
@ErikCald ErikCald self-assigned this Jul 23, 2025
@ErikCald
Copy link
Contributor Author

This PR is just a draft for now, I wanted to move it out of the lidar and autonomy changes to seperate them.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a costmap seeding package that downloads 1-meter resolution elevation data from CanElevation, generates PNG traversability files, and loads them into the costmap to provide terrain insights for rover navigation. The implementation includes downloading DTM files, calculating traversability costs based on slope and roughness metrics, and real-time map loading based on GPS position.

Key changes include:

  • Core elevation data downloading and processing functionality
  • Real-time costmap loading based on GPS coordinates with covariance filtering
  • Traversability cost calculation using slope and roughness analysis

Reviewed Changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/costmap_seeding/costmap_seeding/download_can_elevation_maps.py Main downloader node with DTM processing and traversability cost calculation
src/costmap_seeding/costmap_seeding/load_can_elevation_maps.py Map loader node for real-time costmap publishing based on GPS location
src/costmap_seeding/costmap_seeding/fake_gps_publisher.py Test utility for publishing fake GPS data
src/costmap_seeding/setup.py Package setup and entry point configuration
src/costmap_seeding/package.xml ROS package metadata and dependencies
src/costmap_seeding/config/can_elevation_downloader_params.yaml Configuration parameters for the downloader node
src/costmap_seeding/launch/download_can_elevation.launch.py Launch file for the elevation downloader
setup/install_nav_deps.sh Setup script updated to create required directories
Comments suppressed due to low confidence (2)

src/costmap_seeding/costmap_seeding/download_can_elevation_maps.py:2

  • Multiple imports should be on separate lines according to PEP 8 style guidelines.
from rclpy.node import Node

src/costmap_seeding/costmap_seeding/download_can_elevation_maps.py:726

  • Converting the scaling factor to int may cause precision loss. Consider using round() instead of int() to ensure proper rounding behavior.
            0,

<package format="3">
<name>costmap_seeding</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package description is still a TODO placeholder. It should provide a meaningful description of the costmap seeding functionality.

Suggested change
<description>TODO: Package description</description>
<description>Provides functionality for initializing and modifying costmaps used in robotic navigation systems.</description>

Copilot uses AI. Check for mistakes.
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="erikcaell@gmail.com">erik</maintainer>
<license>TODO: License declaration</license>
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license field contains a TODO placeholder and should specify the actual license for the package.

Suggested change
<license>TODO: License declaration</license>
<license>Apache-2.0</license>

Copilot uses AI. Check for mistakes.
maintainer="erik",
maintainer_email="erikcaell@gmail.com",
description="Seed the nav2 costmap with elevation data from a online elevation datasets",
license="TODO: License declaration",
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license field contains a TODO placeholder and should specify the actual license for the package.

Suggested change
license="TODO: License declaration",
license="MIT",

Copilot uses AI. Check for mistakes.
zip_safe=True,
maintainer="erik",
maintainer_email="erikcaell@gmail.com",
description="Seed the nav2 costmap with elevation data from a online elevation datasets",
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: 'a online' should be 'an online'.

Suggested change
description="Seed the nav2 costmap with elevation data from a online elevation datasets",
description="Seed the nav2 costmap with elevation data from an online elevation datasets",

Copilot uses AI. Check for mistakes.
self.map_publisher = self.create_publisher(
OccupancyGrid, "/blank_map", qos_profile_transient
)
self.get_logger().info("OccupancyGrid publisher created on /map_can_elevation.")
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message states the publisher is on '/map_can_elevation' but the actual topic is '/blank_map' (line 100). This inconsistency could confuse debugging.

Suggested change
self.get_logger().info("OccupancyGrid publisher created on /map_can_elevation.")
self.get_logger().info("OccupancyGrid publisher created on /blank_map.")

Copilot uses AI. Check for mistakes.
Altitude covariance is ignored as per user request.
"""
# Check if covariance type is known or approximated and variances are low
# msg.position_covariance_type = NavSatFix.COVARIANCE_TYPE_KNOWN # This line forces it, remove if not intended
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed rather than left in the codebase. If this is for debugging purposes, consider using a parameter or removing it entirely.

Suggested change
# msg.position_covariance_type = NavSatFix.COVARIANCE_TYPE_KNOWN # This line forces it, remove if not intended

Copilot uses AI. Check for mistakes.
msg.position_covariance_type = 3

self.publisher_.publish(msg)
# self.get_logger().info(f'Publishing GPS Fix at {msg.header.stamp.sec}.{msg.header.stamp.nanosec}')
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed rather than left in the codebase.

Suggested change
# self.get_logger().info(f'Publishing GPS Fix at {msg.header.stamp.sec}.{msg.header.stamp.nanosec}')

Copilot uses AI. Check for mistakes.
@ErikCald ErikCald changed the title Seed costmap with CanElevation data [Prototype] Seed costmap with CanElevation data Jul 24, 2025
@ErikCald ErikCald changed the title [Prototype] Seed costmap with CanElevation data [Draft] Seed costmap with CanElevation data Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants