Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-existent cached _orthoimage error #78

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions gisnav/gisnav/core/gis_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class GISNode(Node):
ROS_D_TIMEOUT = 10
"""Default WMS GetMap request timeout in seconds"""

ROS_D_PUBLISH_RATE = 1
ROS_D_PUBLISH_RATE = 1.0
"""Default publish rate for :class:`.OrthoImage3D` messages in Hz"""

ROS_D_WMS_POLL_RATE = 0.1
Expand Down Expand Up @@ -461,11 +461,11 @@ def max_map_radius(self) -> Optional[int]:

@property
@ROS.parameter(ROS_D_PUBLISH_RATE, descriptor=_ROS_PARAM_DESCRIPTOR_READ_ONLY)
def publish_rate(self) -> Optional[int]:
def publish_rate(self) -> Optional[float]:
"""Publish rate in Hz for the :attr:`.orthoimage` :term:`message`"""

@narrow_types
def _create_publish_timer(self, publish_rate: int) -> Timer:
def _create_publish_timer(self, publish_rate: float) -> Timer:
"""
Returns a timer to publish :attr:`.orthoimage` to ROS

Expand Down Expand Up @@ -1338,8 +1338,10 @@ def _is_latlon_inside_bounding_box(

# Use cached orthoimage if available, do not try to recompute to avoid
# circular dependencies
dem_height_meters_at_latlon = _dem_elevation_meters_at_latlon(
latitude, longitude, self._orthoimage
dem_height_meters_at_latlon = (
_dem_elevation_meters_at_latlon(latitude, longitude, self._orthoimage)
if hasattr(self, "_orthoimage")
else None
)
if dem_height_meters_at_latlon is None:
dem_height_meters_at_latlon = self._dem_elevation_meters_at_latlon_wms(
Expand Down