Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiment with a scalar formulation
```julia using Test using Multibody using ModelingToolkit import ModelingToolkitStandardLibrary.Mechanical.Rotational using OrdinaryDiffEq using LinearAlgebra using JuliaSimCompiler t = Multibody.t D = Differential(t) world = Multibody.world W(args...; kwargs...) = Multibody.world @mtkmodel TestUSR begin @components begin world = W() j1 = JointUSR(positive_branch=true, use_arrays=false) fixed = FixedTranslation(r=[1,0,0]) b1 = Body(isroot=false, neg_w=true) p1 = Prismatic(state_priority=100) end @equations begin connect(world.frame_b, j1.frame_a, fixed.frame_a) connect(fixed.frame_b, p1.frame_a) connect(p1.frame_b, j1.frame_b) connect(j1.frame_im, b1.frame_a) end end @nAmed model = TestUSR() model = complete(model) ss = structural_simplify(IRSystem(model)) prob = ODEProblem(ss, [model.b1.a_0[1]=>0.0, D(D(model.p1.s))=>0.0], (0.0, 1.0)) sol = solve(prob, FBDF(autodiff=true)) ``` works
- Loading branch information