@@ -22,7 +22,7 @@ open(vis)
2222S = 7
2323timestep= 1 / 148 * S
2424gscaled = - 9.81 * 20
25- mech = get_mechanism (:box ,
25+ mech = get_mechanism (:block ,
2626 timestep= timestep,
2727 gravity= gravityscaled,
2828 friction_coefficient= 0.2 ,
@@ -31,7 +31,7 @@ mech = get_mechanism(:box,
3131 mode= :box );
3232
3333# ## Simualate
34- initialize! (mech, :box ,
34+ initialize! (mech, :block ,
3535 x= [0.0 , - 1.0 , 1.0 ],
3636 v= [0.0 , 2.0 , 1.0 ],
3737 ω= [2.0 , 5.0 , 10.0 ])
@@ -61,18 +61,18 @@ data0 = params0[:data]
6161# ###############################################################################
6262# # Optimization Objective: Evaluation & Gradient
6363# ###############################################################################
64- clean_loss (:box , pairs0, data0,
64+ clean_loss (:block , pairs0, data0,
6565 n_sample= 250 ,
6666 opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ),
6767 timestep= timestep,
6868 gravity= gravityscaled)
6969
70- [clean_loss (:box , pairs0, data0 + [i;zeros (55 )],
70+ [clean_loss (:block , pairs0, data0 + [i;zeros (55 )],
7171 opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ),
7272 timestep= timestep,
7373 gravity= gravityscaled)
7474 for i in Vector (- 0.10 : 0.01 : 0.1 )]
75- [clean_loss (:box , pairs0, data0 + [0 ;i;zeros (54 )],
75+ [clean_loss (:block , pairs0, data0 + [0 ;i;zeros (54 )],
7676 opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ),
7777 timestep= timestep,
7878 gravity= gravityscaled)
@@ -108,7 +108,7 @@ lower = [0.00, 0.05]
108108upper = [0.80 , 1.50 ]
109109
110110function f0 (d; rot= 0 )
111- return clean_loss (:box , pairs0, d2data (d),
111+ return clean_loss (:block , pairs0, d2data (d),
112112 n_sample= 200 ,
113113 timestep= timestep,
114114 gravity= gravityscaled,
118118
119119function fgH0 (d;
120120 rot= 0 )
121- f, g, H = clean_loss (:box , pairs0, d2data (d),
121+ f, g, H = clean_loss (:block , pairs0, d2data (d),
122122 n_sample= 200 ,
123123 timestep= timestep,
124124 gravity= gravityscaled,
@@ -151,7 +151,7 @@ dsol #[0.171, 0.933]
151151using Plots; pyplot ()
152152x= range (0.00 ,stop= 0.80 ,length= 10 )
153153y= range (0.10 ,stop= 1.50 ,length= 10 )
154- f (x,y) = log (10 , clean_loss (:box , pairs0, d2data ([x,y]), n_sample= 50 , timestep= timestep, gravity= gravityscaled,
154+ f (x,y) = log (10 , clean_loss (:block , pairs0, d2data ([x,y]), n_sample= 50 , timestep= timestep, gravity= gravityscaled,
155155 opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ))[1 ])
156156plot (x,y,f,st= :surface ,camera= (25 ,75 ))
157157
@@ -212,11 +212,11 @@ upper = [0.80,
212212 - 0.05 , - 0.05 , + 1.50 ]
213213
214214function f0 (d; rot= 0 , n_sample= 50 )
215- return clean_loss (:box , pairs0, d2data (d), n_sample= n_sample, timestep= timestep, gravity= gravityscaled, rot= rot, opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ))[1 ]
215+ return clean_loss (:block , pairs0, d2data (d), n_sample= n_sample, timestep= timestep, gravity= gravityscaled, rot= rot, opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ))[1 ]
216216end
217217
218218function fgH0 (d; rot= 0 , n_sample= 50 )
219- f, g, H = clean_loss (:box , pairs0, d2data (d), n_sample= n_sample, timestep= timestep, gravity= gravityscaled, rot= rot, opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ))
219+ f, g, H = clean_loss (:block , pairs0, d2data (d), n_sample= n_sample, timestep= timestep, gravity= gravityscaled, rot= rot, opts= SolverOptions (btol= 3e-4 , rtol= 3e-4 ))
220220 return f, ∇d2data' * g, ∇d2data' * H * ∇d2data
221221end
222222dsol, Dsol = quasi_newton_solve (f0, fgH0, d0, iter= 50 , gtol= 1e-8 , ftol= 1e-6 ,
0 commit comments