From e5de244e3b496226f2279373ee3cdc4963aed5ec Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Wed, 26 Jun 2024 12:39:19 +0200 Subject: [PATCH] finishing touches --- src/components.jl | 6 +++--- test/runtests.jl | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components.jl b/src/components.jl index 40b0397d..7fd91f0a 100644 --- a/src/components.jl +++ b/src/components.jl @@ -306,16 +306,16 @@ Representing a body with 3 translational and 3 rotational degrees-of-freedom. @variables phid(t)[1:3]=phid0 [state_priority = 10] @variables phidd(t)[1:3]=zeros(3) [state_priority = 10] phi, phid, phidd = collect.((phi, phid, phidd)) - ar = axes_rotations([1, 2, 3], phi, phid) + ar = axes_rotations([1, 2, 3], phi, -phid) # NOTE: this - sign is mysterious, it was not required before the change to axis_rotation in https://github.com/JuliaComputing/Multibody.jl/pull/93, but the change in the PR was checked by comparing Multibody.RotX(pi/2) and angle = pi/2; [1 0 0; 0 cos(angle) sin(angle); 0 -sin(angle) cos(angle)] which is the modelica implementation of RotX. It appears related to vef_from_R, if the - is removed, vel_from_R can be set to false in swing example. Equation[ phid .~ D.(phi) phidd .~ D.(phid) Ra ~ ar - Ra.w .~ w_a + Ra.w .~ ar.w if vel_from_R w_a .~ angular_velocity2(ori(frame_a, false)) # This is required for FreeBody and ThreeSprings tests to pass, but the other one required for harmonic osciallator without joint to pass. FreeBody passes with quat=true so we use that instead else - w_a .~ ar.w # This one for most systems + w_a .~ angular_velocity2(ar) # This one for most systems end ] end diff --git a/test/runtests.jl b/test/runtests.jl index 6444ad64..99c91dec 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -663,7 +663,7 @@ using LinearAlgebra # @testset "Rolling wheel" begin @mtkmodel WheelInWorld begin @components begin - world = World(render=true) + world = W() wheel = RollingWheel(radius = 0.3, m = 2, I_axis = 0.06, I_long = 0.12, x0 = 0.2, @@ -675,6 +675,7 @@ end @named worldwheel = WheelInWorld() worldwheel = complete(worldwheel) +# pars = collect(worldwheel.world.n) .=> [0,0,-1]; defs = Dict([ collect(worldwheel.world.n) .=> [0,0,-1]; worldwheel.wheel.body.r_0[1] => 0.2;