Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce some intermediate level parameters #151

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ See also [`BodyCylinder`](@ref) and [`BodyBox`](@ref) for body components with p
frame_cm = Frame()
end

# NOTE: these parameters should be defined before the `systems` block above, but due to bugs in MTK/JSC with higher-order array parameters we cannot do that. We still define the parameters so that they are available to make animations
@variables r_0(t)[1:3]=r_0 [
state_priority = 2,
description = "Position vector from origin of world frame to origin of frame_a",
Expand Down
7 changes: 3 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ using Test
using JuliaSimCompiler
using OrdinaryDiffEq
using LinearAlgebra
t = Multibody.t
D = Differential(t)
isdefined(Main, :t) || (t = Multibody.t)
isdefined(Main, :D) || (D = Differential(t))
doplot() = false
world = Multibody.world

Expand Down Expand Up @@ -1124,6 +1124,7 @@ using LinearAlgebra

prob = ODEProblem(ssys, [model.joint.phi => 0], (0, 1))
sol = solve(prob, Rodas5P(), abstol=1e-8, reltol=1e-8)
@test SciMLBase.successful_retcode(sol)
# first(render(model, sol, 0, x=2.5, y=1.5, z=2.5, show_axis=true))
# @test sol(10, idxs=model.body.body.m) ≈ 226.27 rtol=1e-3 # Values from open modelica
# @test sol(10, idxs=model.body.body.I_11) ≈ 245.28 rtol=1e-3
Expand All @@ -1148,8 +1149,6 @@ end

using LinearAlgebra, ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq
using Multibody.Rotations: RotXYZ
t = Multibody.t
D = Multibody.D
world = Multibody.world

@named joint = Multibody.Spherical(isroot=false, state=false, quat=false)
Expand Down
3 changes: 1 addition & 2 deletions test/test_quaternions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ end

# @testset "Spherical joint with quaternion state" begin
using LinearAlgebra, ModelingToolkit, Multibody, JuliaSimCompiler
t = Multibody.t
world = Multibody.world


Expand All @@ -220,7 +219,7 @@ end
ssys = structural_simplify(irsys)


D = Differential(t)
isdefined(Main, :D) || (D = Differential(t))
# q0 = randn(4); q0 ./= norm(q0)
# q0 = [1,0,0,0]
prob = ODEProblem(ssys, [
Expand Down
Loading