Skip to content

Commit 840f7a2

Browse files
committed
update world g in tests
1 parent 097a6a4 commit 840f7a2

2 files changed

Lines changed: 20 additions & 22 deletions

File tree

test/test_quaternions.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ connections = [connect(world.frame_b, spring.frame_a)
2828
connect(spring.frame_b, body.frame_a)]
2929

3030
@named model = System(connections, t, systems = [world, spring, body])
31-
model = complete(model)
3231
# ssys = structural_simplify(model, allow_parameter = false)
3332

3433
ssys = multibody(model)

test/test_worldforces.jl

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ end
4141
@named testwf = TestWorldForce1()
4242
testwf = complete(testwf)
4343
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))
4545
sol = solve(prob, Tsit5())
4646
# plot(sol)
4747
@test sol(1, idxs=testwf.b.r_0) [0, 0.0, 0.0] atol=1e-3
4848

4949
# ==============================================================================
5050
## A single force
5151
# ==============================================================================
52-
# Tests here pass for any combination of quat and neg_w
5352
@component function TestWorldForce2(; name)
5453
pars = @parameters begin
5554
f[1:3]
@@ -78,13 +77,13 @@ end
7877
@named testwf = TestWorldForce2()
7978
testwf = complete(testwf)
8079
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))
8281
sol = solve(prob, Tsit5())
8382
# plot(sol)
8483
@test sol(1, idxs=testwf.body.r_0) [0.5*1^2*1, 0, 0] atol=1e-3
8584

8685

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))
8887
sol = solve(prob, Tsit5())
8988
# plot(sol)
9089
@test sol(1, idxs=testwf.body.r_0) [0, 0.5*1^2*1, 0] atol=1e-3
@@ -125,13 +124,13 @@ end
125124
@named testwf = TestWorldForce3()
126125
testwf = complete(testwf)
127126
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))
129128
sol = solve(prob, Tsit5())
130129
# plot(sol)
131130
@test sol(1, idxs=testwf.body.r_0) [0, 0, 0] atol=1e-3
132131

133132

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))
135134
sol = solve(prob, Tsit5(), reltol=1e-8)
136135
# plot(sol)
137136
@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
169168
@named testwf = TestWorldForce4()
170169
testwf = complete(testwf)
171170
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))
173172
sol = solve(prob, Tsit5())
174173
# plot(sol)
175174
@test sol(1, idxs=testwf.body.r_0) [0, 0, 0] atol=1e-3
176175

177176

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))
179178
sol = solve(prob, Tsit5(), reltol=1e-8)
180179
# plot(sol)
181180
@test sol(1, idxs=testwf.body.frame_a.r_0) [0.9419246090353689, -0.23388592078659548, 0.0] atol=1e-3
@@ -213,13 +212,13 @@ end
213212
@named testwf = TestWorldForce5()
214213
testwf = complete(testwf)
215214
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))
217216
sol = solve(prob, Tsit5())
218217
# plot(sol)
219218
@test sol(1, idxs=testwf.body.r_0) [0, 0, 0] atol=1e-3
220219

221220

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))
223222
sol = solve(prob, Tsit5(), reltol=1e-8)
224223
# plot(sol)
225224
@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
259258
@named testwf = TestWorldForce6()
260259
testwf = complete(testwf)
261260
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))
263262
sol = solve(prob, Tsit5())
264263
# plot(sol)
265264
@test sol(1, idxs=testwf.body.r_0) [0, 0, 0] atol=1e-3
266265
@test sol(1, idxs=testwf.body.body.w_a[3]-testwf.b0.w_a[3]) 0 atol=1e-3 # These should be identical
267266

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))
269268
sol = solve(prob, Rodas4(), reltol=1e-8)
270269
# plot(sol)
271270
@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
306305
@named testwf = TestWorldForce7()
307306
testwf = complete(testwf)
308307
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))
310309
sol = solve(prob, Tsit5())
311310
# plot(sol)
312311
@test sol(1, idxs=testwf.body.r_0) [0, 0, 0] atol=1e-3
313312

314313

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))
316315
sol = solve(prob, Tsit5(), abstol=1e-8, reltol=1e-8)
317316
# plot(sol)
318317
@test sol(0.1, idxs=testwf.body.frame_a.r_0) [0.36595999301484056, 0.48169308140123934, 0.0] atol=1e-3
@@ -354,7 +353,7 @@ end
354353
@named testwf = TestWorldForce8()
355354
testwf = complete(testwf)
356355
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))
358357
sol = solve(prob, Tsit5())
359358
# plot(sol)
360359
@test sol(1, idxs=testwf.b1.r_0) [0, 0.0, 0.0] atol=1e-3
@@ -396,7 +395,7 @@ end
396395
@named testwf = TestWorldForce9()
397396
testwf = complete(testwf)
398397
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))
400399
sol = solve(prob, Tsit5())
401400
@test sol(1, idxs=testwf.body.r_0) [0, 0.0, 0.0] atol=1e-3
402401

@@ -432,7 +431,7 @@ end
432431
@named testwf = TestWorldForce10()
433432
testwf = complete(testwf)
434433
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))
436435
sol = solve(prob, Tsit5())
437436
# plot(sol)
438437
@test sol(1, idxs=testwf.body.r_0) [0, 0.0, 0.0] atol=1e-3
@@ -472,13 +471,13 @@ end
472471
@named testwf = TestWorldForce11()
473472
testwf = complete(testwf)
474473
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))
476475
sol = solve(prob, Tsit5())
477476
# plot(sol)
478477
@test sol(1, idxs=testwf.body.r_0) [0, 0.0, 0.0] atol=1e-3
479478

480479

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))
482481
sol = solve(prob, Tsit5())
483482
# plot(sol)
484483
@test !iszero(sol(1, idxs=testwf.body.frame_a.r_0))
@@ -531,13 +530,13 @@ end
531530
@named testwf = TestWorldForce12()
532531
testwf = complete(testwf)
533532
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))
535534
sol = solve(prob, Tsit5())
536535
# plot(sol)
537536
@test sol(1, idxs=testwf.body.r_0) [0, 0.0, 0.0] atol=1e-3
538537

539538

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))
541540
sol = solve(prob, Tsit5())
542541
# plot(sol)
543542
@test !iszero(sol(1, idxs=testwf.body.frame_a.r_0))

0 commit comments

Comments
 (0)