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

Experiment with a scalar formulation #118

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Experiment with a scalar formulation #118

wants to merge 5 commits into from

Conversation

YingboMa
Copy link
Contributor

@YingboMa YingboMa commented Aug 8, 2024

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

* more wheel updates

* wheel solves but goes in the wrong direction

* test passes with world.n hacks

* finishing touches

* try global scoping n

* set world parameter defaults using keyword

* redefine defaults again

* scalarize world n

* switch to wheel rolling on xz plane

* move wheel tests to own file

rm using Plots
@baggepinnen
Copy link
Contributor

it solves but the solution is all zeros, while in OpenModelica the mechanism slides along the prismatic joint as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants