Skip to content

Commit 098ccfb

Browse files
committed
Handle edge cases related to map updates whan altitude agl is slightly below zero (starting position).
1 parent 323e07f commit 098ccfb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

gisnav/data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ def __post_init__(self):
579579
580580
:raise: DataValueError if a valid FixedCamera could not be initialized
581581
"""
582+
if self.image_pair is None:
583+
raise DataValueError('Please provide valid image pair.')
584+
582585
img = self.image_pair.qry
583586
if self.snapshot.terrain_altitude.amsl is not None and self.snapshot.terrain_altitude.ellipsoid is None or \
584587
self.snapshot.terrain_altitude.amsl is not None and self.snapshot.terrain_altitude.ellipsoid is None:

gisnav/nodes/base_node.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ def _map_update_timer_callback(self) -> None:
677677
if map_update_altitude is None:
678678
self.get_logger().warn('Cannot determine altitude AGL, skipping map update.')
679679
return None
680+
if map_update_altitude <= 0:
681+
self.get_logger().warn(f'Map update altitude {map_update_altitude} should be > 0, skipping map update.')
682+
return None
680683
map_radius = self._get_dynamic_map_radius(map_update_altitude)
681684
map_candidate = GeoSquare(projected_center if projected_center is not None else self._vehicle_position.xy,
682685
map_radius)
@@ -1124,6 +1127,9 @@ def _mock_map_data(self, origin: Position) -> Optional[MapData]:
11241127
if altitude is None:
11251128
self.get_logger().warn('Cannot determine altitude AGL, skipping mock map data.')
11261129
return
1130+
if altitude < 0:
1131+
self.get_logger().warn(f'Altitude AGL {altitude} was negative, skipping mock map data.')
1132+
return
11271133
radius = scaling * altitude
11281134

11291135
assert_type(origin.xy, GeoPoint)

0 commit comments

Comments
 (0)