Skip to content

Commit

Permalink
add examples to trajectory generation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Oct 3, 2024
1 parent a33400b commit 6e704c4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/src/trajectory_planning.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@ These both have output connectors of type `RealOutput` called `q, qd, qdd` for p

See [Industrial robot](@ref) for an example making use of the [`point_to_point`](@ref) planner.


## Example

### Point-to-point trajectory
```@example TRAJ
using Multibody, Plots
Ts = 0.001
t = -1:Ts:3
q1 = [1, 1.2] # Final point (2 DOF)
qd_max = [0.7, 1.2] # Max velocity (2 DOF)
qdd_max = [0.9, 1.1] # Max acceleration (2 DOF)
q, qd, qdd = point_to_point(t; q1, qd_max, qdd_max)
plot(t, [q qd qdd], ylabel=["\$q\$" "\$\\dot{q}\$" "\$\\ddot{q}\$"], layout=(3,1), l=2, sp=[1 1 2 2 3 3], legend=false)
hline!([qd_max' qdd_max'], l=(2, :dash), sp=[2 2 3 3], c=[1 2 1 2], legend=false)
```

### 5:th order polynomial trajectory
```@example TRAJ
t = 0:Ts:3
q1 = 1
q, qd, qdd = traj5(t; q1)
plot(t, [q qd qdd], ylabel=["\$q\$" "\$\\dot{q}\$" "\$\\ddot{q}\$"], layout=(3,1), l=2, legend=false)
```



## Docstrings

```@index
Expand Down

0 comments on commit 6e704c4

Please sign in to comment.