Skip to content

Commit 0f3a63f

Browse files
committed
updates tests
1 parent b005e75 commit 0f3a63f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/robot/FullRobot.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ function Robot6DOF(; name, kwargs...)
246246

247247
controlBus = ControlBus()
248248
end
249+
push!(systems, world)
249250

250251
eqs = [connect(axis2.flange, mechanics.axis2)
251252
connect(axis1.flange, mechanics.axis1)

test/runtests.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ using Test
44
using JuliaSimCompiler
55
using OrdinaryDiffEq
66
using LinearAlgebra
7-
t = Multibody.t
8-
D = Differential(t)
7+
isdefined(Main, :t) || (t = Multibody.t)
8+
isdefined(Main, :D) || (D = Differential(t))
99
doplot() = false
1010
world = Multibody.world
1111
W(args...; kwargs...) = Multibody.world
@@ -966,7 +966,6 @@ connections = [connect(world.frame_b, rope.frame_a)
966966
# ssys = structural_simplify(model, allow_parameter = false)
967967

968968
@time "Simplify flexible rope pendulum" ssys = structural_simplify(IRSystem(flexible_rope))
969-
D = Differential(t)
970969
prob = ODEProblem(ssys, [
971970
# D.(D.(collect(rope.r))) .=> 0;
972971
collect(body.r_0) .=> [1,1,1];
@@ -1111,7 +1110,7 @@ end
11111110
# ==============================================================================
11121111
using LinearAlgebra
11131112

1114-
# @testset "BodyBox" begin
1113+
@testset "BodyBox" begin
11151114
# NOTE: r = [0,1,0] yields unstable simulation due to the commented branch in from_nxy: if n_z_aux' * n_z_aux > 1.0e-6
11161115
# NOTE: for r=[0,0,1], r_shape=[0.1, 0, 0] the render of the box appears to have negative gravity
11171116
@info "Testing BodyBox"
@@ -1133,6 +1132,7 @@ using LinearAlgebra
11331132

11341133
prob = ODEProblem(ssys, [model.joint.phi => 0], (0, 1))
11351134
sol = solve(prob, Rodas5P(), abstol=1e-8, reltol=1e-8)
1135+
@test SciMLBase.successful_retcode(sol)
11361136
# first(render(model, sol, 0, x=2.5, y=1.5, z=2.5, show_axis=true))
11371137
# @test sol(10, idxs=model.body.body.m) ≈ 226.27 rtol=1e-3 # Values from open modelica
11381138
# @test sol(10, idxs=model.body.body.I_11) ≈ 245.28 rtol=1e-3
@@ -1151,14 +1151,12 @@ using LinearAlgebra
11511151
# @test sol(10, idxs=model.joint.phi) ≈ -2.0992 atol=1e-2
11521152
# @test sol(10, idxs=model.body.body.I_31) ≈ -42.39 rtol=1e-3
11531153
# using Plots; plot(sol)
1154-
# end
1154+
end
11551155

11561156
##
11571157

11581158
using LinearAlgebra, ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq
11591159
using Multibody.Rotations: RotXYZ
1160-
t = Multibody.t
1161-
D = Multibody.D
11621160
world = Multibody.world
11631161

11641162
@named joint = Multibody.Spherical(isroot=false, state=false, quat=false)

test/test_quaternions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ end
198198

199199
# @testset "Spherical joint with quaternion state" begin
200200
using LinearAlgebra, ModelingToolkit, Multibody, JuliaSimCompiler
201-
t = Multibody.t
202201
world = Multibody.world
203202

204203

@@ -220,7 +219,7 @@ end
220219
ssys = structural_simplify(irsys)
221220

222221

223-
D = Differential(t)
222+
isdefined(Main, :D) || (D = Differential(t))
224223
# q0 = randn(4); q0 ./= norm(q0)
225224
# q0 = [1,0,0,0]
226225
prob = ODEProblem(ssys, [

0 commit comments

Comments
 (0)