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

Mysterious negative sign required _sometimes_ #105

Open
baggepinnen opened this issue Jul 17, 2024 · 0 comments
Open

Mysterious negative sign required _sometimes_ #105

baggepinnen opened this issue Jul 17, 2024 · 0 comments

Comments

@baggepinnen
Copy link
Contributor

This test demonstrates a problem in our description of orientations

Two opposing forces (green arrows) are both acting on a body. Another identical body is connected to the first body.

image

  • If the second body is removed, the tests pass with quat = true or neg_w = true
  • If the second body is present, it passes with quat = false, neg_w = false
  • It passes with quat = true, if the transpose on Ω is removed in nonunit_quaternion_equations. This further indicates that that this transpose is equivalent to the neg_w
  • When the test fails, the result corresponds exactly to one of the forces being set to zero

Questions

  • What's the relation between the negative sign in the angular velocity and the force?
  • Why is negative sign needed sometimes but not other times? I.e., why does the second body b0 make a difference here?
@mtkmodel TestWorldForce begin
    @components begin
        world = W()
        forcea = WorldForce(resolve_frame=:frame_b)
        forceb = WorldForce(resolve_frame=:frame_b)
        b0 = Body(m=1, state_priority=0)
        body = Body(m=1, state=true, isroot=true, quat=true, neg_w=false)
    end
    @parameters begin
        f[1:3]
    end
    begin
        f = collect(f)
    end
    @equations begin
        connect(forcea.frame_b, body.frame_a, b0.frame_a)
        connect(forceb.frame_b, body.frame_a)
        forcea.force.u ~ f
        forceb.force.u ~ -f
    end
end

@named testwf = TestWorldForce()
testwf = complete(testwf)
ssys = structural_simplify(IRSystem(testwf))
prob = ODEProblem(ssys, [testwf.world.g => 0; collect(testwf.f) .=> [1,0,0]], (0, 1))
sol = solve(prob, Tsit5())
# plot(sol)
@test sol(1, idxs=testwf.body.r_0)  [0, 0.0, 0.0] atol=1e-3
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

No branches or pull requests

1 participant