Skip to content

Commit 264165e

Browse files
committed
fix typos and add comments
1 parent 2f2c2f3 commit 264165e

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

docs/src/examples/pendulum.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Pendulum--The "Hello World of multi-body dynamics"
2-
This beginners tutorial will model a pendulum pivoted around the origin in the world frame. The world frame is a constant that lives inside the Multibody module, all multibody models are "grounded" in the same world, i.e., the `world` component must be included in all models.
2+
This beginners tutorial will start by modeling a pendulum pivoted around the origin in the world frame. The world frame is a constant that lives inside the Multibody module, all multibody models are "grounded" in the same world, i.e., the `world` component must be included in all models.
33

44
To start, we load the required packages
55
```@example pendulum
@@ -12,11 +12,11 @@ We then access the world frame and time variable from the Multibody module
1212
```@example pendulum
1313
t = Multibody.t
1414
world = Multibody.world
15-
show(stdout, MIME"text/plain"(), world)
15+
show(stdout, MIME"text/plain"(), world) # hide
1616
nothing # hide
1717
```
1818

19-
Unless otherwise specified, the world defaults to have a gravitational field pointing in the negative ``y`` direction and a gravitational acceleration of ``9.81``.
19+
Unless otherwise specified, the world defaults to having a gravitational field pointing in the negative ``y`` direction and a gravitational acceleration of ``9.81`` (See [Bodies in space](@ref) for more options).
2020

2121

2222
## Modeling the pendulum
@@ -50,12 +50,12 @@ Before we can simulate the system, we must perform model compilation using [`str
5050
```@example pendulum
5151
ssys = structural_simplify(IRSystem(model))
5252
```
53-
This results in a simplified model with the minimum required variables and equations to be able to simulate the system efficiently. This step rewrites all `connect` statements into the appropriate equations, and removes any redundant variables and equations.
53+
This results in a simplified model with the minimum required variables and equations to be able to simulate the system efficiently. This step rewrites all `connect` statements into the appropriate equations, and removes any redundant variables and equations. To simulate the pendulum, we require two state variables, one for angle and one for angular velocity, we can see above that these state variables have indeed been chosen.
5454

5555
We are now ready to create an `ODEProblem` and simulate it. We use the `Rodas4` solver from OrdinaryDiffEq.jl, and pass a dictionary for the initial conditions. We specify only initial condition for some variables, for those variables where no initial condition is specified, the default initial condition defined the model will be used.
5656
```@example pendulum
5757
D = Differential(t)
58-
defs = Dict(D(joint.phi) => 0, D(D(joint.phi)) => 0)
58+
defs = Dict(D(joint.phi) => 0, D(D(joint.phi)) => 0) # We may specify the initial condition here
5959
prob = ODEProblem(ssys, defs, (0, 3.35))
6060
6161
sol = solve(prob, Rodas4())

docs/src/examples/swing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ prob = ODEProblem(ssys, [
7070
sol = solve(prob, ImplicitEuler(autodiff=false), reltol=5e-3)
7171
@assert SciMLBase.successful_retcode(sol)
7272
```
73-
This makes for a rather interesting-looking springy pendulum!
7473

7574
```@example SWING
7675
import CairoMakie
7776
Multibody.render(model, sol; z = -5, filename = "simple_swing.gif") # Use "simple_swing.mp4" for a video file
7877
nothing # hide
7978
```
79+
![animation](simple_swing.gif)
80+
This makes for a rather interesting-looking springy pendulum!
81+
8082

8183
Next, we create the full swing assembly
8284

docs/src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ The following animations give a quick overview of simple mechanisms that can be
159159

160160
- The torque variable in Multibody.jl is typically called `tau` rather than `t` to not conflict with the often used independent variable `t` used to denote time.
161161
- Multibody.jl occasionally requires the user to specify which component should act as the root of the kinematic tree. This only occurs when bodies are connected directly to force components without a joint parallel to the force component.
162-
- In Multibody.jl, the orientation object of a [`Frame`](@ref) is accessed using he function [`ori`](@ref).
162+
- In Multibody.jl, the orientation object of a [`Frame`](@ref) is accessed using the function [`ori`](@ref).
163+
- Quaternions in Multibody.jl follow the order ``[s, i, j, k]``, i.e., scalar/real part first.
163164

164165

165166

src/joints.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ Note, that bodies such as [`Body`](@ref), [`BodyShape`](@ref), have potential st
673673
674674
The state of the FreeMotion object consits of:
675675
676-
The relative position vector `r_rel_a` from the origin of `frame_a` to the origin of `frame_b`, resolved in `frame_a` and the relative velocity `v_rel_a` of the origin of `frame_b` with respect to the origin of `frame_a`, resolved in `frame_a (= der(r_rel_a))`.
676+
The relative position vector `r_rel_a` from the origin of `frame_a` to the origin of `frame_b`, resolved in `frame_a` and the relative velocity `v_rel_a` of the origin of `frame_b` with respect to the origin of `frame_a`, resolved in `frame_a (= D(r_rel_a))`.
677677
678678
# Arguments
679679
@@ -722,9 +722,9 @@ The relative position vector `r_rel_a` from the origin of `frame_a` to the origi
722722
]
723723
(v_rel_a(t)[1:3] = v_rel_a),
724724
[
725-
description = "= der(r_rel_a), i.e., velocity of origin of frame_b with respect to origin of frame_a, resolved in frame_a",
725+
description = "= D(r_rel_a), i.e., velocity of origin of frame_b with respect to origin of frame_a, resolved in frame_a",
726726
]
727-
(a_rel_a(t)[1:3] = a_rel_a), [description = "= der(v_rel_a)"]
727+
(a_rel_a(t)[1:3] = a_rel_a), [description = "= D(v_rel_a)"]
728728
end
729729

730730
@named Rrel_f = Frame()

0 commit comments

Comments
 (0)