@@ -4,8 +4,8 @@ using Test
44using JuliaSimCompiler
55using OrdinaryDiffEq
66using LinearAlgebra
7- t = Multibody.t
8- D = Differential(t)
7+ isdefined(Main, :t) || (t = Multibody.t)
8+ isdefined(Main, :D) || (D = Differential(t) )
99doplot() = false
1010world = Multibody.world
1111W(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)
970969prob = ODEProblem(ssys, [
971970 # D.(D.(collect(rope.r))) .=> 0;
972971 collect(body.r_0) .=> [1,1,1];
@@ -1111,7 +1110,7 @@ end
11111110# ==============================================================================
11121111using 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
11581158using LinearAlgebra, ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq
11591159using Multibody.Rotations: RotXYZ
1160- t = Multibody.t
1161- D = Multibody.D
11621160world = Multibody.world
11631161
11641162@named joint = Multibody.Spherical(isroot=false, state=false, quat=false)
0 commit comments