Example #1
0
 def testSpotLockSE(self):
     """ Test spot loc SE """
     loc = LocationGlobalRelative(34.5, -20.8, 100)
     pitch = -70
     yaw = 135
     newloc = location_helpers.getSpotLock(loc, pitch, yaw)
     self.assertTrue(abs(newloc.lat - 34.499769) < ERROR_LOC)
     self.assertTrue(abs(newloc.lon - -20.799719) < ERROR_LOC)
     self.assertTrue(newloc.alt == 0.0)
Example #2
0
 def testSpotLockW(self):
     """ Test spot loc W at Shallow angle threshold """
     loc = LocationGlobalRelative(34.5, -20.8, 100)
     pitch = -6
     yaw = 270
     newloc = location_helpers.getSpotLock(loc, pitch, yaw)
     self.assertTrue(abs(newloc.lat - 34.5) < ERROR_LOC)
     self.assertTrue(abs(newloc.lon - -20.810382) < ERROR_LOC)
     self.assertTrue(newloc.alt == 0.0)
Example #3
0
 def testSpotLockN(self):
     """ Test spot loc North """
     loc = LocationGlobalRelative(34.5, -20.8, 100)
     pitch = -45
     yaw = 0
     newloc = location_helpers.getSpotLock(loc, pitch, yaw)
     self.assertTrue(abs(newloc.lat - 34.500899) < ERROR_LOC)
     self.assertTrue(abs(newloc.lon - -20.8) < ERROR_LOC)
     self.assertTrue(newloc.alt == 0.0)
Example #4
0
    def spotLock(self):
        '''take the angle of the copter and lock onto a ground level target'''
        logger.log("[Orbit] spotLock")

        # don't use a shallow angle resulting in massively distant ROIs
        pitch = min(camera.getPitch(self.vehicle), SHALLOW_ANGLE_THRESHOLD)

        # Get ROI for the vehicle to look at
        spotLock = location_helpers.getSpotLock(
            self.vehicle.location.global_relative_frame, pitch,
            camera.getYaw(self.vehicle))
        self.addLocation(spotLock)
Example #5
0
    def spotLock(self):
        '''take the angle of the copter and lock onto a ground level target'''
        if self.camPointing == SPOT_LOCK:
            return

        self.needsUpdate = True

        # don't use a shallow angle resulting in massively distant ROIs
        pitch = min(camera.getPitch(self.vehicle), SHALLOW_ANGLE_THRESHOLD)

        # Get ROI for the vehicle to look at
        spotLock = location_helpers.getSpotLock(
            self.vehicle.location.global_relative_frame, pitch,
            camera.getYaw(self.vehicle))
        self.addLocation(spotLock)