You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/examples/kinematic_loops.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,4 +143,43 @@ Multibody.render(fourbar2, sol; x=-2, y = 2, z = 3, filename = "fourbar2.gif") #
143
143
nothing # hide
144
144
```
145
145
146
-

146
+

147
+
148
+
## Using a joint assembly
149
+
This example models a mechanism similar to the previous one, but replaces several joints and bodies with the aggregate [`UniversalSpherical`](@ref) joint. This joint is a combination of a universal joint and a spherical joint, with a bar in-between. A benefit of using this joint assembly in a kinematic loop is that some nonlinear equations are solved analytically, and the solver will thus see fewer nonlinear equations. This can lead to a faster simulation.
150
+
151
+
```@example kinloop
152
+
systems = @named begin
153
+
j1 = Revolute(n = [1, 0, 0], w0 = 5.235987755983, state_priority=12.0, radius=0.1f0) # Increase state priority to ensure that this joint coordinate is chosen as state variable
sol2 = solve(prob, FBDF(autodiff=true)) # about 4x faster than the simulation above
175
+
plot!(sol2, idxs=[j2.s]) # Plot the same coordinate as above
176
+
```
177
+
In practice, the two simulations are not exactly identical since we haven't modeled any mass attached to the rod in the joint assembly. We could add such mass to the rod by attaching to the `joint_us.frame_ia` connector.
178
+
179
+
```@example kinloop
180
+
import GLMakie
181
+
Multibody.render(fourbar_analytic, sol2; x=-2, y = 2, z = 3, filename = "fourbar_analytic.gif")
0 commit comments