|
41 | 41 | @named testwf = TestWorldForce1() |
42 | 42 | testwf = complete(testwf) |
43 | 43 | ssys = multibody(testwf) |
44 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
| 44 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
45 | 45 | sol = solve(prob, Tsit5()) |
46 | 46 | # plot(sol) |
47 | 47 | @test sol(1, idxs=testwf.b.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
48 | 48 |
|
49 | 49 | # ============================================================================== |
50 | 50 | ## A single force |
51 | 51 | # ============================================================================== |
52 | | -# Tests here pass for any combination of quat and neg_w |
53 | 52 | @component function TestWorldForce2(; name) |
54 | 53 | pars = @parameters begin |
55 | 54 | f[1:3] |
|
78 | 77 | @named testwf = TestWorldForce2() |
79 | 78 | testwf = complete(testwf) |
80 | 79 | ssys = multibody(testwf) |
81 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 80 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
82 | 81 | sol = solve(prob, Tsit5()) |
83 | 82 | # plot(sol) |
84 | 83 | @test sol(1, idxs=testwf.body.r_0) ≈ [0.5*1^2*1, 0, 0] atol=1e-3 |
85 | 84 |
|
86 | 85 |
|
87 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
| 86 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
88 | 87 | sol = solve(prob, Tsit5()) |
89 | 88 | # plot(sol) |
90 | 89 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0.5*1^2*1, 0] atol=1e-3 |
@@ -125,13 +124,13 @@ end |
125 | 124 | @named testwf = TestWorldForce3() |
126 | 125 | testwf = complete(testwf) |
127 | 126 | ssys = multibody(testwf) |
128 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 127 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
129 | 128 | sol = solve(prob, Tsit5()) |
130 | 129 | # plot(sol) |
131 | 130 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0, 0] atol=1e-3 |
132 | 131 |
|
133 | 132 |
|
134 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
| 133 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
135 | 134 | sol = solve(prob, Tsit5(), reltol=1e-8) |
136 | 135 | # plot(sol) |
137 | 136 | @test sol(1, idxs=testwf.body.frame_a.r_0) ≈ [0.572800369240885, 0.4946715021692289, 0.0] atol=1e-3 # Spinning around center of mass |
@@ -169,13 +168,13 @@ end |
169 | 168 | @named testwf = TestWorldForce4() |
170 | 169 | testwf = complete(testwf) |
171 | 170 | ssys = multibody(testwf) |
172 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 171 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
173 | 172 | sol = solve(prob, Tsit5()) |
174 | 173 | # plot(sol) |
175 | 174 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0, 0] atol=1e-3 |
176 | 175 |
|
177 | 176 |
|
178 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
| 177 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
179 | 178 | sol = solve(prob, Tsit5(), reltol=1e-8) |
180 | 179 | # plot(sol) |
181 | 180 | @test sol(1, idxs=testwf.body.frame_a.r_0) ≈ [0.9419246090353689, -0.23388592078659548, 0.0] atol=1e-3 |
@@ -213,13 +212,13 @@ end |
213 | 212 | @named testwf = TestWorldForce5() |
214 | 213 | testwf = complete(testwf) |
215 | 214 | ssys = multibody(testwf) |
216 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 215 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
217 | 216 | sol = solve(prob, Tsit5()) |
218 | 217 | # plot(sol) |
219 | 218 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0, 0] atol=1e-3 |
220 | 219 |
|
221 | 220 |
|
222 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 0.1)) |
| 221 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 0.1)) |
223 | 222 | sol = solve(prob, Tsit5(), reltol=1e-8) |
224 | 223 | # plot(sol) |
225 | 224 | @test sol(0.1, idxs=testwf.body.frame_a.r_0) ≈ [0.36637355877861, 0.4818152481205165, 0.0] atol=1e-3 |
@@ -259,13 +258,13 @@ end |
259 | 258 | @named testwf = TestWorldForce6() |
260 | 259 | testwf = complete(testwf) |
261 | 260 | ssys = multibody(testwf) |
262 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 261 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
263 | 262 | sol = solve(prob, Tsit5()) |
264 | 263 | # plot(sol) |
265 | 264 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0, 0] atol=1e-3 |
266 | 265 | @test sol(1, idxs=testwf.body.body.w_a[3]-testwf.b0.w_a[3]) ≈ 0 atol=1e-3 # These should be identical |
267 | 266 |
|
268 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
| 267 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 1)) |
269 | 268 | sol = solve(prob, Rodas4(), reltol=1e-8) |
270 | 269 | # plot(sol) |
271 | 270 | @test sol(0.1, idxs=testwf.body.frame_a.r_0) ≈ [0.36595999301484056, 0.48169308140123934, 0.0] atol=1e-3 # Identical to the test above without extra body b0 |
@@ -306,13 +305,13 @@ end |
306 | 305 | @named testwf = TestWorldForce7() |
307 | 306 | testwf = complete(testwf) |
308 | 307 | ssys = multibody(testwf) |
309 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 308 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
310 | 309 | sol = solve(prob, Tsit5()) |
311 | 310 | # plot(sol) |
312 | 311 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0, 0] atol=1e-3 |
313 | 312 |
|
314 | 313 |
|
315 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,1,0]], (0, 0.1)) |
| 314 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,1,0]], (0, 0.1)) |
316 | 315 | sol = solve(prob, Tsit5(), abstol=1e-8, reltol=1e-8) |
317 | 316 | # plot(sol) |
318 | 317 | @test sol(0.1, idxs=testwf.body.frame_a.r_0) ≈ [0.36595999301484056, 0.48169308140123934, 0.0] atol=1e-3 |
|
354 | 353 | @named testwf = TestWorldForce8() |
355 | 354 | testwf = complete(testwf) |
356 | 355 | ssys = multibody(testwf) |
357 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 356 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
358 | 357 | sol = solve(prob, Tsit5()) |
359 | 358 | # plot(sol) |
360 | 359 | @test sol(1, idxs=testwf.b1.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
|
396 | 395 | @named testwf = TestWorldForce9() |
397 | 396 | testwf = complete(testwf) |
398 | 397 | ssys = multibody(testwf) |
399 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 398 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
400 | 399 | sol = solve(prob, Tsit5()) |
401 | 400 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
402 | 401 |
|
|
432 | 431 | @named testwf = TestWorldForce10() |
433 | 432 | testwf = complete(testwf) |
434 | 433 | ssys = multibody(testwf) |
435 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 434 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
436 | 435 | sol = solve(prob, Tsit5()) |
437 | 436 | # plot(sol) |
438 | 437 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
@@ -472,13 +471,13 @@ end |
472 | 471 | @named testwf = TestWorldForce11() |
473 | 472 | testwf = complete(testwf) |
474 | 473 | ssys = multibody(testwf) |
475 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 474 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
476 | 475 | sol = solve(prob, Tsit5()) |
477 | 476 | # plot(sol) |
478 | 477 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
479 | 478 |
|
480 | 479 |
|
481 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,10,0]], (0, 1)) |
| 480 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,10,0]], (0, 1)) |
482 | 481 | sol = solve(prob, Tsit5()) |
483 | 482 | # plot(sol) |
484 | 483 | @test !iszero(sol(1, idxs=testwf.body.frame_a.r_0)) |
@@ -531,13 +530,13 @@ end |
531 | 530 | @named testwf = TestWorldForce12() |
532 | 531 | testwf = complete(testwf) |
533 | 532 | ssys = multibody(testwf) |
534 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
| 533 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [1,0,0]], (0, 1)) |
535 | 534 | sol = solve(prob, Tsit5()) |
536 | 535 | # plot(sol) |
537 | 536 | @test sol(1, idxs=testwf.body.r_0) ≈ [0, 0.0, 0.0] atol=1e-3 |
538 | 537 |
|
539 | 538 |
|
540 | | -prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [0,10,0]], (0, 1)) |
| 539 | +prob = ODEProblem(ssys, [Multibody.WORLD_G => 0; collect(testwf.f) .=> [0,10,0]], (0, 1)) |
541 | 540 | sol = solve(prob, Tsit5()) |
542 | 541 | # plot(sol) |
543 | 542 | @test !iszero(sol(1, idxs=testwf.body.frame_a.r_0)) |
|
0 commit comments