@@ -60,7 +60,7 @@ line_mat_lc = LineBasicMaterial(color=color_lc, linewidth=10.0)
60
60
points_lc = Vector {Point{3,Float64}} ()
61
61
for (i, xt) in enumerate (storage_lc. x[1 ])
62
62
k = xt
63
- push! (points_lc, Point (k[ 1 ], k[ 2 ] + 0.04 , k[ 3 ] ))
63
+ push! (points_lc, Point (k... ))
64
64
end
65
65
setobject! (vis[:path_lc ], MeshCat. Line (points_lc, line_mat_lc))
66
66
@@ -86,15 +86,12 @@ storage_nc = simulate!(mech_nc, 4.0,
86
86
opts= opts)
87
87
88
88
# ## Visualize
89
- for (i, x) in enumerate (storage_nc. x[1 ])
90
- storage_nc. x[1 ][i] += [0.0 ; 0.0 ; 0.1 ]
91
- end
92
-
93
89
line_mat_nc = LineBasicMaterial (color= color_nc, linewidth= 25.0 )
94
90
points_nc = Vector {Point{3,Float64}} ()
95
91
for (i, xt) in enumerate (storage_nc. x[1 ])
96
92
k = xt
97
- push! (points_nc, Point (k[1 ], k[2 ] - 0.04 , k[3 ] + 0.0 ))
93
+ @show k[3 ]
94
+ push! (points_nc, Point (k... ))
98
95
end
99
96
setobject! (vis[:path_nc ], MeshCat. Line (points_nc, line_mat_nc))
100
97
@@ -103,39 +100,78 @@ vis, anim = visualize(mech_nc, storage_nc,
103
100
name= :nc ,
104
101
animation= anim)
105
102
106
- # ## MuJoCo cone
107
- color_mj = magenta;
103
+ # ## MuJoCo pyramidal cone
104
+ color_mjlc = magenta;
105
+
106
+ mech_mjlc = get_mechanism (:box ,
107
+ timestep= timestep,
108
+ gravity= gravity,
109
+ friction_coefficient= friction_coefficient,
110
+ contact_type= :linear ,
111
+ mode= :box , color= color_mjlc);
112
+
113
+ # ## Load
114
+ initialize! (mech_mjlc, :box ,
115
+ x= x0,
116
+ q= one (UnitQuaternion),
117
+ v= v0,
118
+ ω= ω0)
119
+ file = jldopen (joinpath (@__DIR__ , " ../mujoco_benchmark/results/cone_compare_pyramidal.jld2" ))
120
+ storage_mjlc = generate_storage (mech_mjlc, [get_maximal_state (mech_mjlc), file[" ztraj" ]. .. ])
121
+
122
+ # ## Visualize
123
+ vis, anim = visualize (mech_mjlc, storage_mjlc,
124
+ vis= vis,
125
+ name= :mjlc ,
126
+ animation= anim)
127
+
128
+ line_mat_mjlc = LineBasicMaterial (color= color_mjlc, linewidth= 25.0 )
129
+ points_mjlc = Vector {Point{3,Float64}} ()
130
+ for (i, xt) in enumerate (storage_mjlc. x[1 ])
131
+ k = xt
132
+ push! (points_mjlc, Point (k[1 ], k[2 ], k[3 ]))
133
+ end
134
+ setobject! (vis[:path_mjlc ], MeshCat. Line (points_mjlc, line_mat_mjlc))
135
+
136
+
137
+ # ## MuJoCo elliptic cone
138
+ color_mjnc = RGBA (0 ,0 ,0 );
108
139
109
- mech_mj = get_mechanism (:box ,
140
+ mech_mjnc = get_mechanism (:box ,
110
141
timestep= timestep,
111
142
gravity= gravity,
112
143
friction_coefficient= friction_coefficient,
113
144
contact_type= :linear ,
114
- mode= :box , color= color_mj );
145
+ mode= :box , color= color_mjnc );
115
146
116
147
# ## Load
117
- initialize! (mech_mj , :box ,
148
+ initialize! (mech_mjnc , :box ,
118
149
x= x0,
119
150
q= one (UnitQuaternion),
120
151
v= v0,
121
152
ω= ω0)
122
- file = jldopen (joinpath (@__DIR__ , " ../MuJoCo_benchmark /results/cone_compare .jld2" ))
123
- storage_mj = generate_storage (mech_mj , [get_maximal_state (mech_mj ), file[" ztraj" ]. .. ])
153
+ file = jldopen (joinpath (@__DIR__ , " ../mujoco_benchmark /results/cone_compare_elliptic .jld2" ))
154
+ storage_mjnc = generate_storage (mech_mjnc , [get_maximal_state (mech_mjnc ), file[" ztraj" ]. .. ])
124
155
125
156
# ## Visualize
126
- vis, anim = visualize (mech_mj, storage_mj ,
157
+ vis, anim = visualize (mech_mjnc, storage_mjnc ,
127
158
vis= vis,
128
- name= :mj ,
159
+ name= :mjnc ,
129
160
animation= anim)
130
161
131
- line_mat_mj = LineBasicMaterial (color= color_mj , linewidth= 25.0 )
132
- points_mj = Vector {Point{3,Float64}} ()
133
- for (i, xt) in enumerate (storage_mj . x[1 ])
162
+ line_mat_mjnc = LineBasicMaterial (color= color_mjnc , linewidth= 25.0 )
163
+ points_mjnc = Vector {Point{3,Float64}} ()
164
+ for (i, xt) in enumerate (storage_mjnc . x[1 ])
134
165
k = xt
135
- push! (points_mj , Point (k[1 ], k[2 ], k[3 ]))
166
+ push! (points_mjnc , Point (k[1 ], k[2 ], k[3 ]))
136
167
end
137
- setobject! (vis[:path_mj ], MeshCat. Line (points_mj, line_mat_mj ))
168
+ setobject! (vis[:path_mjnc ], MeshCat. Line (points_mjnc, line_mat_mjnc ))
138
169
139
170
settransform! (vis[:lc ], MeshCat. Translation (0 ,+ 0.04 ,0 ))
171
+ settransform! (vis[:path_lc ], MeshCat. Translation (0 ,+ 0.04 ,0 ))
140
172
settransform! (vis[:nc ], MeshCat. Translation (0 ,- 0.04 ,0 ))
141
- settransform! (vis[:mj ], MeshCat. Translation (0 ,+ 0.00 ,0 ))
173
+ settransform! (vis[:path_nc ], MeshCat. Translation (0 ,- 0.04 ,0 ))
174
+ settransform! (vis[:mjlc ], MeshCat. Translation (0 ,+ 0.00 ,0 ))
175
+ # settransform!(vis[:mjnc], MeshCat.Translation(0,-0.08,-0.02))
176
+ settransform! (vis[:mjnc ], MeshCat. Translation (0 ,- 0.08 ,0 ))
177
+ settransform! (vis[:path_mjnc ], MeshCat. Translation (0 ,- 0.08 ,0 ))
0 commit comments