Skip to content
LIBRARY
PlanarMechanics.BodyShapePendulumTest.md

PlanarMechanics.BodyShapePendulumTest

Pendulum with BodyShape: Fixed -> Revolute -> BodyShape.

A 1m BodyShape pendulum starting at rest, swinging under gravity. Translates the "Pendulum with body shape" test from test_PlanarMechanics.jl.

Usage

MultibodyComponents.PlanarMechanics.BodyShapePendulumTest()

Behavior

Source

dyad
"""
Pendulum with BodyShape: Fixed -> Revolute -> BodyShape.

A 1m BodyShape pendulum starting at rest, swinging under gravity.
Translates the "Pendulum with body shape" test from test_PlanarMechanics.jl.
"""
test component BodyShapePendulumTest
  world = World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 220, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = Revolute(phi(initial = 0.0), w(initial = 0.0)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 480, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  rod = BodyShape(r = [1.0, 0.0], m = 1.0, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 540, "y1": 20, "x2": 740, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end
Flattened Source
dyad
"""
Pendulum with BodyShape: Fixed -> Revolute -> BodyShape.

A 1m BodyShape pendulum starting at rest, swinging under gravity.
Translates the "Pendulum with body shape" test from test_PlanarMechanics.jl.
"""
test component BodyShapePendulumTest
  world = World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 220, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = Revolute(phi(initial = 0.0), w(initial = 0.0)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 480, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  rod = BodyShape(r = [1.0, 0.0], m = 1.0, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 540, "y1": 20, "x2": 740, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end


Test Cases

Test Case case1