Skip to content

Commit 8df42d6

Browse files
committed
fix merge run_ci
2 parents 2eafcfe + e6ab08f commit 8df42d6

File tree

1 file changed

+46
-47
lines changed

1 file changed

+46
-47
lines changed

examples/simulation/cone_compare.jl

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ using Dojo
88
# ## Visualizer
99
vis= Visualizer()
1010
open(vis)
11-
set_camera!(vis,
12-
cam_pos=[-0.01, 0.0, 90.0],
11+
set_camera!(vis,
12+
cam_pos=[-0.01, 0.0, 90.0],
1313
zoom=30)
14-
set_floor!(vis,
15-
x=20.0,
16-
y=20.0,
14+
set_floor!(vis,
15+
x=20.0,
16+
y=20.0,
1717
color=RGBA(1.0, 1.0, 1.0, 1.0))
18-
set_light!(vis,
19-
ambient=0.65,
20-
fill=0.60,
18+
set_light!(vis,
19+
ambient=0.65,
2120
direction="Positive")
2221

2322
################################################################################
@@ -33,28 +32,28 @@ opts = SolverOptions(rtol=1.0e-6, btol=1.0e-6)
3332

3433
# ## Linear cone
3534
color_lc = orange;
36-
mech_lc = get_mechanism(:box,
37-
timestep=timestep,
38-
gravity=gravity,
35+
mech_lc = get_mechanism(:box,
36+
timestep=timestep,
37+
gravity=gravity,
3938
friction_coefficient=friction_coefficient,
40-
contact_type=:linear,
41-
mode=:box,
39+
contact_type=:linear,
40+
mode=:box,
4241
color=color_lc);
4342

4443
# ## Simulate
45-
initialize!(mech_lc, :box,
46-
x=x0,
47-
q=one(UnitQuaternion),
48-
v=v0,
44+
initialize!(mech_lc, :box,
45+
x=x0,
46+
q=one(UnitQuaternion),
47+
v=v0,
4948
ω=ω0)
5049

51-
storage_lc = simulate!(mech_lc, 4.0,
52-
record=true,
50+
storage_lc = simulate!(mech_lc, 4.0,
51+
record=true,
5352
opts=opts)
5453

5554
# ## Visualize
56-
via, anim = visualize(mech_lc, storage_lc,
57-
vis=vis,
55+
via, anim = visualize(mech_lc, storage_lc,
56+
vis=vis,
5857
name=:lc)
5958

6059
line_mat_lc = LineBasicMaterial(color=color_lc, linewidth=10.0)
@@ -67,28 +66,28 @@ setobject!(vis[:path_lc], MeshCat.Line(points_lc, line_mat_lc))
6766

6867
# ## Nonlinear cone
6968
color_nc = cyan;
70-
mech_nc = get_mechanism(:box,
71-
timestep=timestep,
72-
gravity=gravity,
69+
mech_nc = get_mechanism(:box,
70+
timestep=timestep,
71+
gravity=gravity,
7372
friction_coefficient=friction_coefficient,
74-
contact_type=:nonlinear,
75-
mode=:box,
73+
contact_type=:nonlinear,
74+
mode=:box,
7675
color=color_nc);
7776

7877
# ## Simulate
79-
initialize!(mech_nc, :box,
80-
x=x0,
81-
q=one(UnitQuaternion),
82-
v=v0,
78+
initialize!(mech_nc, :box,
79+
x=x0,
80+
q=one(UnitQuaternion),
81+
v=v0,
8382
ω=ω0)
8483

85-
storage_nc = simulate!(mech_nc, 4.0,
86-
record=true,
84+
storage_nc = simulate!(mech_nc, 4.0,
85+
record=true,
8786
opts=opts)
8887

8988
# ## Visualize
9089
for (i, x) in enumerate(storage_nc.x[1])
91-
storage_nc.x[1][i] += [0.0; 0.0; 0.1]
90+
storage_nc.x[1][i] += [0.0; 0.0; 0.1]
9291
end
9392

9493
line_mat_nc = LineBasicMaterial(color=color_nc, linewidth=25.0)
@@ -99,34 +98,34 @@ for (i, xt) in enumerate(storage_nc.x[1])
9998
end
10099
setobject!(vis[:path_nc], MeshCat.Line(points_nc, line_mat_nc))
101100

102-
vis, anim = visualize(mech_nc, storage_nc,
103-
vis=vis,
104-
name=:nc,
101+
vis, anim = visualize(mech_nc, storage_nc,
102+
vis=vis,
103+
name=:nc,
105104
animation=anim)
106105

107106
# ## MuJoCo cone
108107
color_mj = magenta;
109108

110-
mech_mj = get_mechanism(:box,
111-
timestep=timestep,
112-
gravity=gravity,
109+
mech_mj = get_mechanism(:box,
110+
timestep=timestep,
111+
gravity=gravity,
113112
friction_coefficient=friction_coefficient,
114-
contact_type=:linear,
113+
contact_type=:linear,
115114
mode=:box, color=color_mj);
116115

117116
# ## Load
118-
initialize!(mech_mj, :box,
119-
x=x0,
120-
q=one(UnitQuaternion),
121-
v=v0,
117+
initialize!(mech_mj, :box,
118+
x=x0,
119+
q=one(UnitQuaternion),
120+
v=v0,
122121
ω=ω0)
123122
file = jldopen(joinpath(@__DIR__, "../MuJoCo_benchmark/results/cone_compare.jld2"))
124123
storage_mj = generate_storage(mech_mj, [get_maximal_state(mech_mj), file["ztraj"]...])
125124

126125
# ## Visualize
127-
vis, anim = visualize(mech_mj, storage_mj,
128-
vis=vis,
129-
name=:mj,
126+
vis, anim = visualize(mech_mj, storage_mj,
127+
vis=vis,
128+
name=:mj,
130129
animation=anim)
131130

132131
line_mat_mj = LineBasicMaterial(color=color_mj, linewidth=25.0)

0 commit comments

Comments
 (0)