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)
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)
def plot(self, *args, **kwargs): """ Plot pose object as a coordinate frame (superclass method) :param `**kwargs`: plotting options - ``X.plot()`` displays the pose ``X`` as a coordinate frame in either 2D or 3D. There are many options, see the links below. Example:: >>> X = SE3.Rx(0.3) >>> X.plot(frame='A', color='green') :seealso: :func:`~spatialmath.base.transforms3d.trplot`, :func:`~spatialmath.base.transforms2d.trplot2` """ if self.N == 2: tr.trplot2(self.A, *args, **kwargs) else: tr.trplot(self.A, *args, **kwargs)
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)
def plot(self, *args, **kwargs): if self.N == 2: tr.trplot2(self.A, *args, **kwargs) else: tr.trplot(self.A, *args, **kwargs)