Skip to content

Commit 5b89f1a

Browse files
committed
include animation
1 parent 85ec708 commit 5b89f1a

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

docs/src/examples/suspension.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ rms(x) = sqrt(sum(abs2, x) / length(x))
178178
```@example suspension
179179
import GLMakie
180180
Multibody.render(model, sol, show_axis=false, x=-1, y=0.3, z=0.3, lookat=[0,0.3,0.3], timescale=3, filename="suspension.gif") # Video
181+
nothing # hide
181182
```
182183

183184
![suspension](suspension.gif)
@@ -262,8 +263,12 @@ sol = solve(prob, FBDF(autodiff=true), initializealg = ShampineCollocationInit()
262263

263264
```@example suspension
264265
Multibody.render(model, sol, show_axis=false, x=-1.5, y=0.3, z=0.0, lookat=[0,0.1,0.0], timescale=3, filename="suspension_halfcar.gif") # Video
266+
nothing # hide
265267
```
266268

269+
![suspension half-car](suspension_halfcar.gif)
270+
271+
267272
## Adding wheels
268273
The example below further extends the example from above by adding wheels to the suspension system. The excitation is not modeled as a time-varying surface profile, provided through the `surface` argument to the [`SlippingWheel`](@ref) component.
269274
The connection between the wheels and the ground form two kinematic loops together with the `body_upright` joint, we thus set both wheels to be cut joints using `iscut=true`.
@@ -368,9 +373,10 @@ defs = [
368373
display(sort(unknowns(ssys), by=string))
369374
370375
prob = ODEProblem(ssys, defs, (0, 4))
371-
sol = solve(prob, FBDF(autodiff=false), initializealg = ShampineCollocationInit())#, u0 = prob.u0 .+ 1e-6 .* randn.())
376+
sol = solve(prob, FBDF(autodiff=false), initializealg = ShampineCollocationInit())
372377
@test SciMLBase.successful_retcode(sol)
373378
Multibody.render(model, sol, show_axis=false, x=-1.5, y=0.3, z=0.0, lookat=[0,0.1,0.0], timescale=3, filename="suspension_halfcar_wheels.gif") # Video
379+
nothing # hide
374380
```
375381

376382
![suspension with wheels](suspension_halfcar_wheels.gif)

docs/src/examples/wheel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ prob = ODEProblem(ssys, defs, (0.0, 10.0))
265265
sol = solve(prob, Rodas5P())
266266
@test SciMLBase.successful_retcode(sol)
267267
render(model, sol, show_axis=true, x=1, y=-1.8, z=5, lookat=[1,-1.8,0], traces=[model.wheel1.frame_a, model.wheel2.frame_a], filename="drifting.gif")
268+
nothing # hide
268269
```
269270

271+
270272
![drifting animation](drifting.gif)
271273

272274
## Slip-based planar wheel

src/PlanarMechanics/components.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Body component with mass and inertia
9595
end
9696

9797
"""
98-
BodyShape(; name, r = [1,0], r_cm = 0.5*r, gy = -9.807)
98+
BodyShape(; name, r = [1,0], r_cm = 0.5*r, gy = -9.80665)
9999
100100
The `BodyShape` component is similar to a [`Body`](@ref), but it has two frames and a vector `r` that describes the translation between them, while the body has a single frame only.
101101
@@ -116,9 +116,9 @@ The `BodyShape` component is similar to a [`Body`](@ref), but it has two frames
116116
@structural_parameters begin
117117
r = [1,0]
118118
r_cm = 0.5*r
119-
gy = -9.807
120119
end
121120
@parameters begin
121+
gy = -9.80665
122122
# r[1:2] = [1,0], [description = "Fixed x,y-length of the rod resolved w.r.t to body frame_a at phi = 0"]
123123
# r_cm[1:2] = 0.5*r, [description = "Vector from frame_a to center of mass, resolved in frame_a"]
124124
m = 1, [description = "mass of the body"]

0 commit comments

Comments
 (0)