Skip to content

Commit 1f314b4

Browse files
committed
cleanup dzhanibekov viz
1 parent 017d3ef commit 1f314b4

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

docs/src/define_simulation.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,37 @@ Load the `Dojo` package.
1010
using Dojo
1111
```
1212

13-
Define the simulation timestep, and other parameters like the gravity.
13+
Define the simulation time step, and other parameters like the gravity.
1414
```julia
1515
timestep=0.01
1616
gravity=0.0
1717
```
1818

19-
We want to simulate the
19+
We use the mechanism called `:dzhanibekov`.
2020
```julia
2121
mech = get_mechanism(:dzhanibekov,
2222
timestep=timestep,
2323
gravity=gravity);
24+
```
2425

25-
# ## Simulate
26+
We initialize the system with a given initial angular velocity.
27+
```julia
2628
initialize_dzhanibekov!(mech,
2729
angular_velocity=[15.0; 0.01; 0.0])
28-
storage = simulate!(mech, 4.65,
30+
```
31+
32+
We simulate this system for 4 seconds, we record the resulting trajectory in `storage`,
33+
```julia
34+
storage = simulate!(mech, 4.00,
2935
record=true,
3036
verbose=false)
37+
```
3138

32-
# ## Visualizers
33-
vis=visualizer()
34-
render(vis)
35-
visualize(mech, storage,
36-
vis=vis)
39+
We visualize the trajectory in the browser,
40+
```julia
41+
vis = Visualizer()
42+
open(vis)
43+
visualize(mech, storage, vis=vis)
3744
```
3845

3946
And voila! You should see something like this;

environments/dzhanibekov/methods/initialize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function get_dzhanibekov(;
22
timestep=0.01,
33
gravity=-9.81,
4-
color=magenta) where T
4+
color=RGBA(0.9,0.9,0.9,1)) where T
55

66
radius = 0.1
77
body_length = 1.0
@@ -34,6 +34,6 @@ function initialize_dzhanibekov!(mechanism::Mechanism{T,Nn,Ne,Nb};
3434

3535
zero_velocity!(mechanism)
3636
set_minimal_coordinates_velocities!(mechanism, get_joint(mechanism, :floating);
37-
xmin=[szeros(6); linear_velocity; angular_velocity])
37+
xmin=[0;0;1;0;0;0; linear_velocity; angular_velocity])
3838
set_minimal_coordinates_velocities!(mechanism, get_joint(mechanism, :fixed))
3939
end

examples/animations/dzhanibekov.gif

6.83 MB
Loading

examples/animations/dzhanibekov.mp4

282 KB
Binary file not shown.

examples/simulation/dzhanibekov.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ mech = get_mechanism(:dzhanibekov,
1414

1515
# ## Simulate
1616
initialize_dzhanibekov!(mech,
17-
angular_velocity=[15.0; 0.01; 0.0])
18-
storage = simulate!(mech, 4.00,
17+
angular_velocity=[8.0; 0.01; 0.0])
18+
storage = simulate!(mech, 8.00,
1919
record=true,
2020
verbose=false)
2121

0 commit comments

Comments
 (0)