From eb25951c3b5f2172e7bcaadd953a96792a9be035 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Wed, 3 Apr 2024 07:25:40 +0200 Subject: [PATCH] workaround for buggy symbolic arrays --- src/orientation.jl | 2 +- test/runtests.jl | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/orientation.jl b/src/orientation.jl index df51c1a1..297d1f09 100644 --- a/src/orientation.jl +++ b/src/orientation.jl @@ -1,6 +1,6 @@ using Rotations -_norm(x) = sqrt(sum(abs2.(x))) +_norm(x) = sqrt(sum(abs2(x) for x in x)) # Workaround for buggy symbolic arrays _normalize(x) = x ./ _norm(x) const R3{T} = RotMatrix{3, T} diff --git a/test/runtests.jl b/test/runtests.jl index efbd7d1f..d4c9dda6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -655,14 +655,13 @@ defs = [ # collect(D.(cwheel.rollingWheel.angles)) .=> [0, 5, 1] ] -ssys = structural_simplify(IRSystem(wheel)) -prob = ODEProblem(ssys, defs, (0, 10)) -# prob.u0 .+= 0.001 .* randn.() @test_skip begin # Does not initialize - sol = solve(prob, Rodas5P(autodiff=false), u0 = prob.u0 .+ 1e-6 .* randn.()) - @info "Write tests" + ssys = structural_simplify(IRSystem(wheel)) + prob = ODEProblem(ssys, defs, (0, 10)) + sol = solve(prob, Rodas5P(autodiff=false), u0 = prob.u0 .+ 1e-6 .* randn.()) + @info "Write tests" end end @@ -711,7 +710,7 @@ eqs = [connect(world.frame_b, freeMotion.frame_a) body]) # ssys = structural_simplify(model, allow_parameters = false) ssys = structural_simplify(IRSystem(model)) -@test_broken length(unknowns(ssys)) == 12 # This test passes when the body states are used, but not with joint states +@test length(unknowns(ssys)) == 12 prob = ODEProblem(ssys, [collect(body.w_a .=> [0, 1, 0]); collect(body.v_0 .=> [0, 0, 0]); ], (0, 10))