當前位置: 首頁>>代碼示例>>Python>>正文


Python quaternions.quat2mat方法代碼示例

本文整理匯總了Python中transforms3d.quaternions.quat2mat方法的典型用法代碼示例。如果您正苦於以下問題:Python quaternions.quat2mat方法的具體用法?Python quaternions.quat2mat怎麽用?Python quaternions.quat2mat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在transforms3d.quaternions的用法示例。


在下文中一共展示了quaternions.quat2mat方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _check_transform

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def _check_transform(self, translation: Optional[np.ndarray],
                         rotation: Optional[np.ndarray]):
        """Checks that the given translation and rotation are valid."""
        if translation is None:
            pass
        elif translation.shape != (3,):
            raise ValueError('Expected translation to have shape 3')
        else:
            translation = translation.copy()
        if rotation is None:
            pass
        elif rotation.shape == (4,):
            rotation = quat2mat(rotation)
        elif rotation.shape == (3, 3):
            rotation = rotation.copy()
        else:
            raise ValueError('Expected rotation to have shape (3, 3)')
        return translation, rotation 
開發者ID:google-research,項目名稱:robel,代碼行數:20,代碼來源:coordinate_system.py

示例2: poseToMatrix

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def poseToMatrix(self, pose):
        """Converts a pyBullet pose to a transformation matrix"""
        translation = pose[0]
        quaternion = pose[1]
        
        # NOTE: PyBullet quaternions are x, y, z, w
        rotation = quat2mat([quaternion[3], quaternion[0],
                             quaternion[1], quaternion[2]])

        m = np.identity(4)
        m[0:3, 0:3] = rotation
        m.T[3, 0:3] = translation

        return np.matrix(m) 
開發者ID:Rhoban,項目名稱:onshape-to-robot,代碼行數:16,代碼來源:simulation.py

示例3: tq2mat

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def tq2mat(tq): 
    """ transform translation-quaternion (tq) to (4x4) matrix
    """
    tq = np.array(tq)
    T = np.eye(4)
    T[:3,:3] = quaternions.quat2mat(np.roll(tq[3:], 1))
    T[:3, 3] = tq[:3]
    return T 
開發者ID:lvzhaoyang,項目名稱:DeeperInverseCompositionalAlgorithm,代碼行數:10,代碼來源:TUM_RGBD.py

示例4: move_forward

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def move_forward(self, forward=0.05):
        x, y, z, w = self.robot_body.get_orientation()
        self.move_by(quat2mat([w, x, y, z]).dot(np.array([forward, 0, 0]))) 
開發者ID:gkahn13,項目名稱:GtS,代碼行數:5,代碼來源:robot_locomotors.py

示例5: move_backward

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def move_backward(self, backward=0.05):
        x, y, z, w = self.robot_body.get_orientation()
        self.move_by(quat2mat([w, x, y, z]).dot(np.array([-backward, 0, 0]))) 
開發者ID:gkahn13,項目名稱:GtS,代碼行數:5,代碼來源:robot_locomotors.py

示例6: dist_to_semantic_pos

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def dist_to_semantic_pos(self):
        pos = self.robot.get_position()
        x, y, z, w = self.robot.get_orientation()
        #print(self.semantic_pos)
        #print(pos, orn)

        diff_pos = self.semantic_pos - pos
        dist_to_robot = np.sqrt(np.sum(diff_pos * diff_pos, axis = 1))
        diff_unit = (diff_pos.T / dist_to_robot).T

        #TODO: (hzyjerry) orientation is still buggy
        orn_unit = quat2mat([w, x, y, z]).dot(np.array([-1, 0, 0]))
        orn_to_robot = np.arccos(diff_unit.dot(orn_unit))
        return dist_to_robot, orn_to_robot 
開發者ID:gkahn13,項目名稱:GtS,代碼行數:16,代碼來源:env_modalities.py

示例7: _translateIntrinsic

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def _translateIntrinsic(self, pos_world_xyz, quat_world_xyzw):
        """ Add intrinsic translation to extrinsic
        Extrinsic translation = Intrinsic delta translation +
            Extrinsic translation

        Note: order doesn't matter
        """
        delta_objec_xyz = self.d_xyz
        quat_world_wxyz = PhysicsObject.quatXyzwToWxyz(quat_world_xyzw)
        delta_world_xyz = quaternions.quat2mat(quat_world_wxyz).dot(delta_objec_xyz)
        return pos_world_xyz + delta_world_xyz 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:13,代碼來源:physics_object.py

示例8: move_forward

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def move_forward(self, forward=0.10):
        x, y, z, w = self.robot_body.get_orientation()
        self.move_by(quat2mat([w, x, y, z]).dot(np.array([forward, 0, 0])))
        yaw = self.robot_body.bp_pose.rpy()[2]
        self.robot_body.reset_orientation(quatToXYZW(euler2quat(0, 0, yaw), 'wxyz')) 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:7,代碼來源:robot_locomotors.py

示例9: move_backward

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def move_backward(self, backward=0.14):
        x, y, z, w = self.robot_body.get_orientation()
        self.move_by(quat2mat([w, x, y, z]).dot(np.array([-backward, 0, 0]))) 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:5,代碼來源:robot_locomotors.py

示例10: get_rot

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def get_rot(self, sim_scene: SimScene) -> np.ndarray:
        """Returns the (3x3) rotation matrix of the element."""
        if self.qpos_indices is not None:
            qpos = sim_scene.data.qpos[self.qpos_indices[3:]]
            if self._is_euler:
                return euler2mat(*qpos, axes='rxyz')
            return quat2mat(qpos)
        return self.element_attr(sim_scene.data,
                                 'xmat')[self.element_id].reshape((3, 3)) 
開發者ID:google-research,項目名稱:robel,代碼行數:11,代碼來源:group_config.py

示例11: _get_raw_tracker_state

# 需要導入模塊: from transforms3d import quaternions [as 別名]
# 或者: from transforms3d.quaternions import quat2mat [as 別名]
def _get_raw_tracker_state(self, device_id: DeviceId):
        """Returns the tracker state."""
        try:
            rigid_data = self._poses.get_rigid(device_id)
            state = TrackerState(
                pos=rigid_data.position * self._position_scale,
                rot=quat2mat(rigid_data.rotation),
                vel=np.zeros(3),
                angular_vel=np.zeros(3))
            self._state_cache[device_id] = state
        except:
            if device_id not in self._state_cache:
                raise
            state = self._state_cache[device_id]
        return state 
開發者ID:google-research,項目名稱:robel,代碼行數:17,代碼來源:phasespace_tracker.py


注:本文中的transforms3d.quaternions.quat2mat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。