Skip to content

Commit 7d8dd00

Browse files
committed
merge cone compare run_ci
2 parents 4f4ccb2 + 01a9897 commit 7d8dd00

File tree

4 files changed

+62
-9
lines changed

4 files changed

+62
-9
lines changed
540 KB
Loading
299 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ## Ghost
2+
set_camera!(vis, cam_pos=[-1,1,0], zoom=1)
3+
4+
z_sim = get_maximal_state(storage)
5+
timesteps = [5, 10, 15]# .+ 150
6+
7+
for t in timesteps
8+
name = Symbol("robot_$t")
9+
build_robot(mech, vis=vis, name=name, color= magenta_light)
10+
z = z_sim[t]
11+
set_robot(vis, mech, z, name=name)
12+
end
13+
14+
z_sim[220][1] -= 0.1
15+
z_sim[220][13 + 1] -= 0.05
16+
set_robot(vis, mech, z_sim[220])
17+
18+
z_sim[104][1] -= 0.025
19+
z_sim[104][13 + 1] -= 0.05
20+
set_robot(vis, mech, z_sim[104])

examples/simulation/cone_compare.jl

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,62 @@ vis, anim = visualize(mech_nc, storage_nc,
8888
name=:nc,
8989
animation=anim)
9090

91-
# ## MuJoCo cone
92-
color_mj = magenta;
91+
# ## MuJoCo pyramidal cone
92+
color_mjlc = magenta;
9393

94-
mech_mj = get_mechanism(:box,
94+
mech_mjlc = get_mechanism(:box,
9595
timestep=timestep,
9696
gravity=gravity,
9797
friction_coefficient=friction_coefficient,
9898
contact_type=:linear,
99-
mode=:box, color=color_mj);
99+
mode=:box, color=color_mjlc);
100100

101101
# ## Load
102-
initialize!(mech_mj, :box,
102+
initialize!(mech_mjlc, :box,
103103
x=x0,
104104
q=one(UnitQuaternion),
105105
v=v0,
106106
ω=ω0)
107-
file = jldopen(joinpath(@__DIR__, "../MuJoCo_benchmark/results/cone_compare.jld2"))
108-
storage_mj = generate_storage(mech_mj, [get_maximal_state(mech_mj), file["ztraj"]...])
107+
file = jldopen(joinpath(@__DIR__, "../mujoco_benchmark/results/cone_compare_pyramidal.jld2"))
108+
storage_mjlc = generate_storage(mech_mjlc, [get_maximal_state(mech_mjlc), file["ztraj"]...])
109109

110110
# ## Visualize
111-
vis, anim = visualize(mech_mj, storage_mj,
111+
vis, anim = visualize(mech_mjlc, storage_mjlc,
112112
vis=vis,
113-
name=:mj,
113+
name=:mjlc,
114114
animation=anim)
115115

116+
line_mat_mjlc = LineBasicMaterial(color=color_mjlc, linewidth=25.0)
117+
points_mjlc = Vector{Point{3,Float64}}()
118+
for (i, xt) in enumerate(storage_mjlc.x[1])
119+
k = xt
120+
push!(points_mjlc, Point(k[1], k[2], k[3]))
121+
end
122+
setobject!(vis[:path_mjlc], MeshCat.Line(points_mjlc, line_mat_mjlc))
123+
124+
125+
# ## MuJoCo elliptic cone
126+
color_mjnc = RGBA(0,0,0);
127+
128+
mech_mjnc = get_mechanism(:box,
129+
timestep=timestep,
130+
gravity=gravity,
131+
friction_coefficient=friction_coefficient,
132+
contact_type=:linear,
133+
mode=:box, color=color_mjnc);
134+
135+
# ## Load
136+
initialize!(mech_mjnc, :box,
137+
x=x0,
138+
q=one(UnitQuaternion),
139+
v=v0,
140+
ω=ω0)
141+
file = jldopen(joinpath(@__DIR__, "../mujoco_benchmark/results/cone_compare_elliptic.jld2"))
142+
storage_mjnc = generate_storage(mech_mjnc, [get_maximal_state(mech_mjnc), file["ztraj"]...])
143+
144+
# ## Visualize
145+
vis, anim = visualize(mech_mjnc, storage_mjnc,
146+
vis=vis,
147+
name=:mjnc,
148+
animation=anim)
116149

0 commit comments

Comments
 (0)