Skip to content

Commit

Permalink
docs rendering updates
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Oct 28, 2023
1 parent 39ba81c commit a326d05
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ makedocs(;
# strict = [:example_block, :setup_block, :eval_block],
sitename = "Multibody.jl",
warnonly = [:missing_docs, :cross_references, :example_block, :docs_block],
pagesonly = true,
format = Documenter.HTML(;
prettyurls = get(ENV, "CI", nothing) == "true",
edit_link = nothing),
Expand Down
6 changes: 3 additions & 3 deletions docs/src/examples/pendulum.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ The solution `sol` can be plotted directly if the Plots package is loaded. The f
## 3d Animation
Multibody.jl supports automatic 3D rendering of mechanisms, we use this feature to illustrate the result of the simulation below:

```@example spring_mass_system
```@example pendulum
import CairoMakie # GLMakie is another alternative, suitable for interactive plots
Multibody.render(model, sol; z = -5, filename = "pendulum.gif") # Use "pendulum.mp4" for a video file
nothing # hide
```

![animation](spherical.gif)
![animation](pendulum.gif)

By default, the world frame is indicated using the convention x: red, y: green, z: blue.

Expand Down Expand Up @@ -214,7 +214,7 @@ sol = solve(prob, Rodas4())
plot(sol, layout=4)
```

```@example spring_mass_system
```@example pendulum
import CairoMakie
Multibody.render(model, sol, z=-5, R = Rotations.RotXYZ(-0.8,0.3,0)', filename = "furuta.gif")
nothing # hide
Expand Down
5 changes: 4 additions & 1 deletion docs/src/examples/spherical_pendulum.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ connections = [connect(world.frame_b, joint.frame_a)
@named model = ODESystem(connections, t, systems = [world; systems])
ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys, [], (0, 10))
prob = ODEProblem(ssys, [
D.(joint.phi) .=> 0;
D.(D.(joint.phi)) .=> 0;
], (0, 10))
sol = solve(prob, Rodas4())
@assert SciMLBase.successful_retcode(sol)
Expand Down
6 changes: 5 additions & 1 deletion docs/src/examples/spring_damper_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys,
[D.(body1.phi) .=> 0;
D.(D.(body1.phi)) .=> 0;
D.(body1.phid) .=> 0;
D(p2.s) => 0;
D(D(p2.s)) => 0;
damper1.d => 2], (0, 10))
Expand All @@ -81,5 +82,8 @@ Multibody.jl supports automatic 3D rendering of mechanisms, we use this feature

```@example spring_damper_system
import CairoMakie
Multibody.render(model, sol; z = -5, filename = "springdamper.mp4")
Multibody.render(model, sol; z = -5, filename = "springdamper.gif")
nothing # hide
```

![animation](springdamper.gif)
5 changes: 4 additions & 1 deletion docs/src/examples/spring_mass_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@ Multibody.jl supports automatic 3D rendering of mechanisms, we use this feature

```@example spring_mass_system
import CairoMakie
Multibody.render(model, sol; z = -5, filename = "springmass.mp4")
Multibody.render(model, sol; z = -5, filename = "springmass.gif")
nothing # hide
```

![animation](springmass.gif)
4 changes: 3 additions & 1 deletion docs/src/examples/three_springs.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ eqs = [connect(world.frame_b, bar1.frame_a)
@named model = ODESystem(eqs, t, systems = [world; systems])
ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys, [], (0, 10))
prob = ODEProblem(ssys, [
D.(spring3.lineForce.r_rel_0) .=> 0;
], (0, 10))
sol = solve(prob, Rodas4(), u0=prob.u0 .+ 1e-1*randn(length(prob.u0)))
@assert SciMLBase.successful_retcode(sol)
Expand Down

0 comments on commit a326d05

Please sign in to comment.