Skip to content

Mysterious negative sign required _sometimes_ #105

Open
@baggepinnen

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions