예제 #1
0
파일: object.py 프로젝트: zhangkehua/PyRep
    def get_position(self, relative_to=None) -> List[float]:
        """Gets the position of this object.

        :param relative_to: Indicates relative to which reference frame we want
            the position. Specify None to retrieve the absolute position, or an
            Object relative to whose reference frame we want the position.
        :return: A list containing the x, y, z position of the object.
        """
        relto = -1 if relative_to is None else relative_to.get_handle()
        return vrep.simGetObjectPosition(self._handle, relto)
예제 #2
0
파일: object.py 프로젝트: zhangkehua/PyRep
    def rotate(self, rotation: List[float]) -> None:
        """Rotates a transformation matrix.

        :param rotation: The x, y, z rotation to perform (in radians).
        """
        m = vrep.simGetObjectMatrix(self._handle, -1)
        x_axis = [m[0], m[4], m[8]]
        y_axis = [m[1], m[5], m[9]]
        z_axis = [m[2], m[6], m[10]]
        axis_pos = vrep.simGetObjectPosition(self._handle, -1)
        m = vrep.simRotateAroundAxis(m, z_axis, axis_pos, rotation[2])
        m = vrep.simRotateAroundAxis(m, y_axis, axis_pos, rotation[1])
        m = vrep.simRotateAroundAxis(m, x_axis, axis_pos, rotation[0])
        vrep.simSetObjectMatrix(self._handle, -1, m)
예제 #3
0
 def get_object_position(self, object_handle):
     return vrep.simGetObjectPosition(object_handle, self.world_handle)
예제 #4
0
 def get_human_position(self):
     return vrep.simGetObjectPosition(self.human_handle, self.world_handle)