Example #1
0
    def getDeviceVector(self,sensorId, suppliedVector, offsetAsQuaternion):
        taredOrientationAsQuaternion =  self.__getTaredOrientationAsQuaternion(sensorId,needToReturnSensorId=False)
        #print "taredOrientationAsQuaternion"
        #print taredOrientationAsQuaternion

        vectorAndQuaternionCalculator = VectorAndQuaternionCalculator()
        vector = vectorAndQuaternionCalculator.getVectorOftheDeviceBasedOnSuppliedOrientation(suppliedVector,taredOrientationAsQuaternion,offsetAsQuaternion)
        return vector
Example #2
0
    def performOffsetOperation(self,sensorId):

        #we are trying to find offset here by getting gravity vector of device and gravity vector that we want it as
        northAndGravityVectors = self.__getNorthAndGravityVectorsInSensorFrame(sensorId)
        untaredOrientationAsQuaternion = self.__getUntaredOrientationAsQuaternion(sensorId,needToReturnSensorId=False)
        vectorAndQuaternionCalculator = VectorAndQuaternionCalculator()
        offsetAsQuaternion = vectorAndQuaternionCalculator.getOffsetOrientationAsQuaternion(northAndGravityVectors)

        #below two statements is to offset gd so that it is align with g
        taredData = vectorAndQuaternionCalculator.getMultiplicationOfQuaternion(untaredOrientationAsQuaternion,offsetAsQuaternion)
        self.__setTareOrientationAsSameAsSuppliedOrientationInQuaternionDomain(sensorId,tareData=taredData)

        return offsetAsQuaternion
Example #3
0
 def getAngleBetweenThreeVectors(self, vectorOne,vectorTwo,vectorthree):
     vectorAndQuaternionCalculator = VectorAndQuaternionCalculator()
     return vectorAndQuaternionCalculator.calculateAngle(vectorOne,vectorTwo,vectorthree)