当前位置: 首页>>代码示例>>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;未经允许,请勿转载。