本文整理匯總了Python中Quaternion.q_mean方法的典型用法代碼示例。如果您正苦於以下問題:Python Quaternion.q_mean方法的具體用法?Python Quaternion.q_mean怎麽用?Python Quaternion.q_mean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Quaternion
的用法示例。
在下文中一共展示了Quaternion.q_mean方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: calibrateInertialTransform
# 需要導入模塊: import Quaternion [as 別名]
# 或者: from Quaternion import q_mean [as 別名]
def calibrateInertialTransform(self, pos1, att1, other, pos2, att2, B_r_BC, q_CB, calIDs=[0]):
posID1 = self.getColIDs(pos1)
attID1 = self.getColIDs(att1)
posID2 = other.getColIDs(pos2)
attID2 = other.getColIDs(att2)
# Make timing calculation
dt1 = self.getLastTime()-self.getFirstTime()
dt2 = other.getLastTime()-other.getFirstTime()
first = max(self.getFirstTime(),other.getFirstTime())
last = min(self.getLastTime(),other.getLastTime())
timeIncrement = min(dt1/(self.length()-1), dt2/(other.length()-1))
td1 = TimedData(8);
td2 = TimedData(8);
td1.initEmptyFromTimes(np.arange(first,last,timeIncrement))
td2.initEmptyFromTimes(np.arange(first,last,timeIncrement))
self.interpolateColumns(td1, posID1, [1,2,3])
other.interpolateColumns(td2, posID2, [1,2,3])
self.interpolateQuaternion(td1, attID1, [4,5,6,7])
other.interpolateQuaternion(td2, attID2, [4,5,6,7])
if(not calIDs):
calIDs = range(td1.length())
newIDs = np.arange(0,Utils.getLen(calIDs))
q_CB_vec = np.kron(np.ones([Utils.getLen(calIDs),1]),q_CB)
q_JC_vec = Quaternion.q_inverse(td2.D()[newIDs,4:8])
q_BI_vec = td1.D()[newIDs,4:8]
B_r_BC_vec = np.kron(np.ones([Utils.getLen(calIDs),1]),B_r_BC)
J_r_JC = td2.D()[newIDs,1:4];
J_r_BC = Quaternion.q_rotate(Quaternion.q_mult(q_JC_vec,q_CB_vec), B_r_BC_vec)
J_r_IB = Quaternion.q_rotate(Quaternion.q_mult(q_JC_vec,Quaternion.q_mult(q_CB_vec,q_BI_vec)),td1.D()[newIDs,1:4])
rotation = Quaternion.q_mean(Quaternion.q_inverse(Quaternion.q_mult(Quaternion.q_mult(q_JC_vec,q_CB_vec),q_BI_vec)))
translation = np.mean(J_r_JC-J_r_BC-J_r_IB, axis=0)
return translation.flatten(), rotation.flatten()