|
| 1 | +# TrajOptPlots.jl |
| 2 | +This package provides methods for visualizing 2D and 3D systems, and is part of the [TrajectoryOptimization.jl](https://github.com/RoboticExplorationLab/TrajectoryOptimization.jl) |
| 3 | +ecosystem. This package depends heavily upon [MeshCat.jl](https://github.com/rdeits/MeshCat.jl), which is used as the visualization backend. This package |
| 4 | +is basically a simple wrapper around MeshCat, providing convenient methods for the types defined in |
| 5 | +[RobotDynamics.jl](https://github.com/RoboticExplorationLab/RobotDynamics.jl) and |
| 6 | +[TrajectoryOptimization.jl](https://github.com/RoboticExplorationLab/TrajectoryOptimization.jl). |
| 7 | + |
| 8 | +## Installation |
| 9 | +To install, use the Julia package manager: |
| 10 | +```julia |
| 11 | +julia> ] # activate package manager |
| 12 | +(@v1.5) pkg> add TrajOptPlots |
| 13 | +``` |
| 14 | + |
| 15 | +We also recommend using the package manager to add the following packages to your environment: |
| 16 | +* [MeshCat.jl](https://github.com/rdeits/MeshCat.jl): Provides visualization |
| 17 | +* [RobotDynamics.jl](https://github.com/RoboticExplorationLab/RobotDynamics.jl): Defines dynamical systems |
| 18 | +* [RobotZoo.jl](https://github.com/RoboticExplorationLab/RobotZoo.jl): Provides a handful of canoncial dynamical systems. All of these sytems can be visualized using TrajOptPlots |
| 19 | +* [TrajectoryOptimization.jl](https://github.com/RoboticExplorationLab/TrajectoryOptimization.jl): Defines trajectory optimization problems |
| 20 | +* [Altro.jl](https://github.com/RoboticExplorationLab/Altro.jl): Fast solver for trajectory optimization problems |
| 21 | +* [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl): Fast stack-allocated arrays |
| 22 | + |
| 23 | +## Quick Start |
| 24 | +Basic usage will usually follow something like this: |
| 25 | +```julia |
| 26 | +using TrajOptPlots |
| 27 | +using RobotZoo: Cartpole |
| 28 | +using MeshCat |
| 29 | +using StaticArrays |
| 30 | + |
| 31 | +# Start visualizer |
| 32 | +vis = Visualizer() |
| 33 | +open(vis) |
| 34 | + |
| 35 | +# Display the model |
| 36 | +model = Cartpole() |
| 37 | +TrajOptPlots.set_mesh!(vis, model) |
| 38 | + |
| 39 | +# Visualize a single state |
| 40 | +x = SA[0.5, pi/3, 0, 0] |
| 41 | +visualize!(vis, model, x) |
| 42 | + |
| 43 | +# Visualize a trajectory |
| 44 | +tf = 2.0 |
| 45 | +X = [SA[sin(t), cos(t), 0, 0] for t in range(0, 2.0, length=21)] |
| 46 | +visualize!(vis, model, tf, X) |
| 47 | +``` |
| 48 | + |
| 49 | +## Examples |
| 50 | +For more detailed examples, see the [notebooks](https://github.com/RoboticExplorationLab/TrajOptPlots.jl/tree/master/notebooks) |
0 commit comments