示例#1
0
    def trplot2(self, end, start=None, **kwargs):
        """
        Define the transform to animate

        :param end: the final pose SO(2) or SE(2) to display as a coordinate frame
        :type end: numpy.ndarray, shape=(2,2) or (3,3)
        :param start: the initial pose SO(2) or SE(2) to display as a coordinate frame, defaults to null
        :type start: numpy.ndarray, shape=(2,2) or (3,3)

        Is polymorphic with ``base.trplot`` and accepts the same parameters.
        This sets up the animation but doesn't execute it.

        :seealso: :func:`run`

        """
        # stash the final value
        if tr.isrot2(end):
            self.end = tr.r2t(end)
        else:
            self.end = end

        if start is None:
            self.start = np.identity(3)
        else:
            if tr.isrot2(start):
                self.start = tr.r2t(start)
            else:
                self.start = start

        # draw axes at the origin
        tr.trplot2(self.start, axes=self, block=False, **kwargs)
示例#2
0
    def trplot2(self, Tf, T0=None, **kwargs):
        """
        Define the transform to animate

        :param T: an SO(3) or SE(3) pose to be displayed as coordinate frame
        :type: numpy.ndarray, shape=(3,3) or (4,4)

        Is polymorphic with ``base.trplot`` and accepts the same parameters.
        This sets up the animation but doesn't execute it.

        :seealso: :func:`run`

        """
        # stash the final value

        if tr.isrot2(Tf):
            self.Tf = tr.r2t(Tf)
            if T0 is None:
                self.T0 = np.eye(3)
            else:
                self.T0 = tr.r2t(T0)
        else:
            self.Tf = Tf
            if T0 is None:
                self.T0 = np.eye(3)
            else:
                self.T0 = T0
        # draw axes at the origin
        tr.trplot2(np.eye(3), axes=self, **kwargs)
示例#3
0
    def isvalid(x, check=True):
        """
        Test if matrix is valid SO(2)

        :param x: matrix to test
        :type x: numpy.ndarray
        :return: True if the matrix is a valid element of SO(2), ie. it is a 2x2
            orthonormal matrix with determinant of +1.
        :rtype: bool

        :seealso: :func:`~spatialmath.base.transform3d.isrot`
        """
        return not check or tr.isrot2(x, check=True)
示例#4
0
    def trplot2(self, end, start=None, **kwargs):
        """
        Define the transform to animate

        :param end: the final pose SE(2) or SO(2) to display as a coordinate frame
        :type end: ndarray(3,3) or ndarray(2,2)
        :param start: the initial pose SE(2) or SO(2) to display as a coordinate frame, defaults to null
        :type start: ndarray(3,3) or ndarray(2,2)

        Is polymorphic with ``base.trplot`` and accepts the same parameters.
        This sets up the animation but doesn't execute it.

        :seealso: :func:`run`

        """
        if not isinstance(end, (np.ndarray, np.generic)) and isinstance(
                end, Iterable):
            if len(end) == 1:
                end = end[0]
            elif len(end) >= 2:
                self.trajectory = end

        # stash the final value
        if base.isrot2(end):
            self.end = base.r2t(end)
        else:
            self.end = end

        if start is None:
            self.start = np.identity(3)
        else:
            if base.isrot2(start):
                self.start = base.r2t(start)
            else:
                self.start = start

        # draw axes at the origin
        base.trplot2(self.start, axes=self, block=False, **kwargs)
示例#5
0
 def isvalid(x):
     return tr.isrot2(x, check=True)