diff --git a/dronekit/__init__.py b/dronekit/__init__.py index 4f3613906..bc2cf89ef 100644 --- a/dronekit/__init__.py +++ b/dronekit/__init__.py @@ -2643,10 +2643,10 @@ def target_location(self, roi): if isinstance(roi, LocationGlobalRelative): alt = roi.alt elif isinstance(roi, LocationGlobal): - if not self.home_location: - self.commands.download() - self.commands.wait_ready() - alt = roi.alt - self.home_location.alt + if not self._vehicle.home_location: + self._vehicle.commands.download() + self._vehicle.commands.wait_ready() + alt = roi.alt - self._vehicle.home_location.alt else: raise ValueError('Expecting location to be LocationGlobal or LocationGlobalRelative.')