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

[connect(world+frameb,revolute+framea)connect(revolute+frameb,rod+framea)world.frameb.x(t)=0world.frameb.y(t)=0world.frameb.phi(t)=0connect(frameb,framevis+frame_a)world.framevis.phi(t)=world.framevis.frame_a.phi(t)world.framevis.x_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.x_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.x_shape.r_shape(t)=[000]world.framevis.x_shape.length_direction(t)=[100]world.framevis.x_shape.width_direction(t)=[001]world.framevis.x_shape.length(t)=world.framevis.axis_lengthworld.framevis.x_shape.width(t)=2world.framevis.axis_radiusworld.framevis.x_shape.height(t)=2world.framevis.axis_radiusworld.framevis.y_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.y_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.y_shape.r_shape(t)=[000]world.framevis.y_shape.length_direction(t)=[010]world.framevis.y_shape.width_direction(t)=[001]world.framevis.y_shape.length(t)=world.framevis.axis_lengthworld.framevis.y_shape.width(t)=2world.framevis.axis_radiusworld.framevis.y_shape.height(t)=2world.framevis.axis_radiusworld.framevis.z_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.z_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.z_shape.r_shape(t)=[000]world.framevis.z_shape.length_direction(t)=[001]world.framevis.z_shape.width_direction(t)=[100]world.framevis.z_shape.length(t)=world.framevis.axis_lengthworld.framevis.z_shape.width(t)=2world.framevis.axis_radiusworld.framevis.z_shape.height(t)=2world.framevis.axis_radiusrevolute.w(t)=drevolute.phi(t)dtrevolute.alpha(t)=drevolute.w(t)dtrevolute.framea.x(t)=revolute.frameb.x(t)revolute.framea.y(t)=revolute.frameb.y(t)revolute.framea.phi(t)+revolute.phi(t)=revolute.frameb.phi(t)revolute.frameb.fx(t)+revolute.framea.fx(t)=0revolute.framea.fy(t)+revolute.frameb.fy(t)=0revolute.frameb.tau(t)+revolute.framea.tau(t)=0revolute.framea.tau(t)=revolute.tau(t)revolute.flangea.phi(t)=revolute.phi(t)revolute.flangea.tau(t)=revolute.tau(t)revolute.shape.r(t)=arrayliteral([3],revolute.framea.x(t),revolute.framea.y(t),revolute.zposition)revolute.shape.R(t)=arrayliteral([33],cos(revolute.framea.phi(t)),sin(revolute.framea.phi(t)),0,sin(revolute.framea.phi(t)),cos(revolute.framea.phi(t)),0,0,0,1)revolute.shape.rshape(t)=arrayliteral([3],0,0,12revolute.cylinderlength)revolute.shape.lengthdirection(t)=[001]revolute.shape.widthdirection(t)=[100]revolute.shape.length(t)=revolute.cylinderlengthrevolute.shape.width(t)=2revolute.radiusrevolute.shape.height(t)=2revolute.radiusrod.rodshape.r(t)=arrayliteral([3],rod.framea.x(t),rod.framea.y(t),rod.zposition)rod.rodshape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)rod.rodshape.r_shape(t)=[000]rod.rodshape.length_direction(t)=arrayliteral([3],rod.translation.r01(t)rod.l,rod.translation.r02(t)rod.l,0)rod.rodshape.width_direction(t)=[001]rod.rodshape.length(t)=rod.lrod.rodshape.width(t)=2rod.radiusrod.rodshape.height(t)=2rod.radiusconnect(framea,translation+framea,translationcm+frame_a)connect(frameb,translation+frameb)connect(translationcm+frame_b,body+framea)rod.translation.phi(t)=rod.translation.framea.phi(t)rod.translation.w(t)=drod.translation.phi(t)dtrod.translation.r0(t)=arrayliteral([22],cos(rod.translation.phi(t)),sin(rod.translation.phi(t)),sin(rod.translation.phi(t)),cos(rod.translation.phi(t)))rod.translation.rrod.translation.r0(t)=arrayliteral([2],rod.translation.frameb.x(t)rod.translation.framea.x(t),rod.translation.frameb.y(t)rod.translation.framea.y(t))rod.translation.framea.phi(t)=rod.translation.frameb.phi(t)rod.translation.framea.fx(t)+rod.translation.frameb.fx(t)=0rod.translation.frameb.fy(t)+rod.translation.framea.fy(t)=0rod.translation.framea.tau(t)+rod.translation.frameb.tau(t)rod.translation.frameb.fx(t)rod.translation.r02(t)+rod.translation.frameb.fy(t)rod.translation.r01(t)=0rod.translation.shape.r(t)=arrayliteral([3],rod.translation.framea.x(t),rod.translation.framea.y(t),rod.translation.zposition)rod.translation.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)rod.translation.shape.rshape(t)=[000]rod.translation.shape.lengthdirection(t)=arrayliteral([3],rod.translation.r01(t)rod.translation.l,rod.translation.r02(t)rod.translation.l,0)rod.translation.shape.widthdirection(t)=[001]rod.translation.shape.length(t)=rod.translation.lrod.translation.shape.width(t)=2rod.translation.radiusrod.translation.shape.height(t)=2rod.translation.radiusrod.translationcm.phi(t)=rod.translationcm.frame_a.phi(t)rod.translationcm.w(t)=drod.translationcm.phi(t)dtrod.translationcm.r0(t)=arrayliteral([22],cos(rod.translationcm.phi(t)),sin(rod.translationcm.phi(t)),sin(rod.translationcm.phi(t)),cos(rod.translationcm.phi(t)))rod.translationcm.rrod.translationcm.r0(t)=arrayliteral([2],rod.translationcm.frame_b.x(t)rod.translationcm.frame_a.x(t),rod.translationcm.frame_a.y(t)+rod.translationcm.frame_b.y(t))rod.translationcm.frame_a.phi(t)=rod.translationcm.frame_b.phi(t)rod.translationcm.frame_a.fx(t)+rod.translationcm.frame_b.fx(t)=0rod.translationcm.frame_a.fy(t)+rod.translationcm.frame_b.fy(t)=0rod.translationcm.frame_a.tau(t)+rod.translationcm.frame_b.tau(t)+rod.translationcm.r0_1(t)rod.translationcm.frame_b.fy(t)rod.translationcm.r0_2(t)rod.translationcm.frame_b.fx(t)=0rod.translationcm.shape.r(t)=arrayliteral([3],rod.translationcm.frame_a.x(t),rod.translationcm.frame_a.y(t),rod.translationcm.z_position)rod.translationcm.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)rod.translationcm.shape.r_shape(t)=[000]rod.translationcm.shape.length_direction(t)=arrayliteral([3],rod.translationcm.r0_1(t)rod.translationcm.l,rod.translationcm.r0_2(t)rod.translationcm.l,0)rod.translationcm.shape.width_direction(t)=[001]rod.translationcm.shape.length(t)=rod.translationcm.lrod.translationcm.shape.width(t)=2rod.translationcm.radiusrod.translationcm.shape.height(t)=2rod.translationcm.radiusrod.body.r(t)=arrayliteral([2],rod.body.framea.x(t),rod.body.framea.y(t))rod.body.v(t)=drod.body.r(t)dtrod.body.phi(t)=rod.body.framea.phi(t)rod.body.w(t)=drod.body.phi(t)dtrod.body.a(t)=drod.body.v(t)dtrod.body.alpha(t)=drod.body.w(t)dtrod.body.f(t)=arrayliteral([2],rod.body.framea.fx(t),rod.body.framea.fy(t))arrayliteral([2],gn2d1rod.body.m,gn2d2rod.body.m)+rod.body.f(t)=rod.body.mrod.body.a(t)rod.body.Irod.body.alpha(t)=rod.body.framea.tau(t)rod.body.shape.r(t)=arrayliteral([3],rod.body.framea.x(t),rod.body.framea.y(t),rod.body.zposition)rod.body.shape.R(t)=arrayliteral([33],cos(rod.body.phi(t)),sin(rod.body.phi(t)),0,sin(rod.body.phi(t)),cos(rod.body.phi(t)),0,0,0,1)rod.body.shape.rshape(t)=[000]rod.body.shape.lengthdirection(t)=[001]rod.body.shape.widthdirection(t)=[100]rod.body.shape.length(t)=2rod.body.radiusrod.body.shape.width(t)=2rod.body.radiusrod.body.shape.height(t)=2rod.body.radius]

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() {
    "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
  initial revolute.phi = 0.0
  initial revolute.w = 0.0
  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() {
    "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
  initial revolute.phi = 0.0
  initial revolute.w = 0.0
  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