How to use the pytransform3d.plot_utils.Trajectory function in pytransform3d

To help you get started, we’ve selected a few pytransform3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rock-learning / pytransform3d / pytransform3d / plot_utils.py View on Github external
def draw(self, renderer, *args, **kwargs):
            """Draw the artist."""
            self.trajectory.draw(renderer, *args, **kwargs)
            for key_frame in self.key_frames:
                key_frame.draw(renderer, *args, **kwargs)
            if self.show_direction:
                self.direction_arrow.draw(renderer)
            super(Trajectory, self).draw(renderer, *args, **kwargs)
github rock-learning / pytransform3d / pytransform3d / trajectories.py View on Github external
kwargs : dict, optional (default: {})
        Additional arguments for the plotting functions, e.g. alpha

    Returns
    -------
    ax : Matplotlib 3d axis
        New or old axis
    """
    if P is None or len(P) == 0:
        raise ValueError("Trajectory does not contain any elements.")

    if ax is None:
        ax = make_3d_axis(ax_s)

    H = matrices_from_pos_quat(P)
    trajectory = Trajectory(H, show_direction, n_frames, s, **kwargs)
    trajectory.add_trajectory(ax)

    return ax
github rock-learning / pytransform3d / examples / animate_trajectory.py View on Github external
if __name__ == "__main__":
    n_frames = 200

    fig = plt.figure(figsize=(5, 5))

    ax = fig.add_subplot(111, projection="3d")
    ax.set_xlim((-1, 1))
    ax.set_ylim((-1, 1))
    ax.set_zlim((-1, 1))
    ax.set_xlabel("X")
    ax.set_ylabel("Y")
    ax.set_zlabel("Z")

    H = np.zeros((100, 4, 4))
    H[:] = np.eye(4)
    trajectory = Trajectory(H, show_direction=False, s=0.2, c="k")
    trajectory.add_trajectory(ax)

    anim = animation.FuncAnimation(
        fig, update_trajectory, n_frames, fargs=(n_frames, trajectory),
        interval=50, blit=False)

    plt.show()