Skip to content

Commit

Permalink
mavpicviewer: handle arithmetic exception in image viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Oct 12, 2024
1 parent ecf8ab1 commit a81c11c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions MAVProxy/tools/mavpicviewer/mavpicviewer_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,15 @@ def update_map(self):
if self.sm is not None:
self.sm.set_center(self.lat, self.lon)

projection1 = self.cam1_projection.get_projection(self.lat, self.lon, self.alt_amsl, self.roll, self.pitch, self.yaw)
if projection1 is not None and self.sm is not None:
self.sm.add_object(mp_slipmap.SlipPolygon('projection1', projection1, layer=1, linewidth=2, colour=mpv.RGB_GREEN))
else:
print(prefix_str + "failed to add projection to map")
# calculate image outline polygon for map
try:
projection1 = self.cam1_projection.get_projection(self.lat, self.lon, self.alt_amsl, self.roll, self.pitch, self.yaw)
if projection1 is not None and self.sm is not None:
self.sm.add_object(mp_slipmap.SlipPolygon('projection1', projection1, layer=1, linewidth=2, colour=mpv.RGB_GREEN))
else:
print(prefix_str + "failed to add projection to map")
except ArithmeticError as e:
print(prefix_str + "failed to add projection to map due to arithmetic error: " + str(e))

# add a rectangle specified by two locations to the map
def add_rectangle_to_map(self, name, lat1, lon1, lat2, lon2):
Expand Down

0 comments on commit a81c11c

Please sign in to comment.