本文整理汇总了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()