Skip to content
LIBRARY
PlanarMechanics.CutForceTest.md

PlanarMechanics.CutForceTest

Test for CutForce sensor: a damped pendulum with three CutForce sensors measuring reaction forces at different points in the chain, each resolved in a different frame.

Topology: World → CutForce(frame_a) → Revolute → CutForce(world) → FixedTranslation → CutForce(frame_b) → Body A rotational damper stabilizes the revolute joint via its flange.

Translated from PlanarMechanicsTest.Sensors.CutForces (line 633).

Usage

MultibodyComponents.PlanarMechanics.CutForceTest()

Behavior

[connect(world+frameb,cutforce_frame_a+frame_a)connect(cutforce_frame_a+frame_b,revolute+framea)connect(revolute+frameb,cutforce_world+frame_a)connect(cutforce_world+frame_b,rod+framea)connect(rod+frameb,cutforce_frame_b+frame_a)connect(cutforce_frame_b+frame_b,body+framea)connect(damper+splineb,revolute+flangea)connect(damper+splinea,fixed+spline)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.phi(t)=rod.framea.phi(t)rod.w(t)=drod.phi(t)dtrod.r0(t)=arrayliteral([22],cos(rod.phi(t)),sin(rod.phi(t)),sin(rod.phi(t)),cos(rod.phi(t)))rod.rrod.r0(t)=arrayliteral([2],rod.framea.x(t)+rod.frameb.x(t),rod.frameb.y(t)rod.framea.y(t))rod.framea.phi(t)=rod.frameb.phi(t)rod.framea.fx(t)+rod.frameb.fx(t)=0rod.frameb.fy(t)+rod.framea.fy(t)=0rod.framea.tau(t)+rod.frameb.tau(t)+rod.r01(t)rod.frameb.fy(t)rod.r02(t)rod.frameb.fx(t)=0rod.shape.r(t)=arrayliteral([3],rod.framea.x(t),rod.framea.y(t),rod.zposition)rod.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)rod.shape.rshape(t)=[000]rod.shape.lengthdirection(t)=arrayliteral([3],rod.r01(t)rod.l,rod.r02(t)rod.l,0)rod.shape.widthdirection(t)=[001]rod.shape.length(t)=rod.lrod.shape.width(t)=2rod.radiusrod.shape.height(t)=2rod.radiusbody.r(t)=arrayliteral([2],body.framea.x(t),body.framea.y(t))body.v(t)=dbody.r(t)dtbody.phi(t)=body.framea.phi(t)body.w(t)=dbody.phi(t)dtbody.a(t)=dbody.v(t)dtbody.alpha(t)=dbody.w(t)dtbody.f(t)=arrayliteral([2],body.framea.fx(t),body.framea.fy(t))body.f(t)+arrayliteral([2],body.mgn2d1,body.mgn2d2)=body.mbody.a(t)body.Ibody.alpha(t)=body.framea.tau(t)body.shape.r(t)=arrayliteral([3],body.framea.x(t),body.framea.y(t),body.zposition)body.shape.R(t)=arrayliteral([33],cos(body.phi(t)),sin(body.phi(t)),0,sin(body.phi(t)),cos(body.phi(t)),0,0,0,1)body.shape.rshape(t)=[000]body.shape.lengthdirection(t)=[001]body.shape.widthdirection(t)=[100]body.shape.length(t)=2body.radiusbody.shape.width(t)=2body.radiusbody.shape.height(t)=2body.radiusdamper.phirel(t)=damper.splinea.phi(t)+damper.splineb.phi(t)damper.splineb.tau(t)=damper.tau(t)damper.splinea.tau(t)=damper.tau(t)ddamper.phirel(t)dt=damper.wrel(t)ddamper.wrel(t)dt=damper.arel(t)damper.tau(t)=damper.ddamper.wrel(t)fixed.spline.phi(t)=fixed.phi0cutforce_frame_a.frame_a.x(t)=cutforce_frame_a.frame_b.x(t)cutforce_frame_a.frame_a.y(t)=cutforce_frame_a.frame_b.y(t)cutforce_frame_a.frame_a.phi(t)=cutforce_frame_a.frame_b.phi(t)cutforce_frame_a.frame_a.fx(t)+cutforce_frame_a.frame_b.fx(t)=0cutforce_frame_a.frame_b.fy(t)+cutforce_frame_a.frame_a.fy(t)=0cutforce_frame_a.frame_b.tau(t)+cutforce_frame_a.frame_a.tau(t)=0cutforce_frame_a.f0x(t)=ifelse(cutforce_frame_a.positive_sign,cutforce_frame_a.frame_a.fx(t),cutforce_frame_a.frame_a.fx(t))cutforce_frame_a.f0y(t)=ifelse(cutforce_frame_a.positive_sign,cutforce_frame_a.frame_a.fy(t),cutforce_frame_a.frame_a.fy(t))cutforce_frame_a.force_x(t)=cos(cutforce_frame_a.phi_resolve(t))cutforce_frame_a.f0x(t)+sin(cutforce_frame_a.phi_resolve(t))cutforce_frame_a.f0y(t)cutforce_frame_a.force_y(t)=cos(cutforce_frame_a.phi_resolve(t))cutforce_frame_a.f0y(t)sin(cutforce_frame_a.phi_resolve(t))cutforce_frame_a.f0x(t)cutforce_frame_a.force_arrow.r(t)=arrayliteral([3],cutforce_frame_a.frame_b.x(t),cutforce_frame_a.frame_b.y(t),cutforce_frame_a.z_position)cutforce_frame_a.force_arrow.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)cutforce_frame_a.force_arrow.r_shape(t)=[000]cutforce_frame_a.force_arrow.length_direction(t)=arrayliteral([3],cutforce_frame_a.f0x(t),cutforce_frame_a.f0y(t),0)cutforce_frame_a.force_arrow.width_direction(t)=[001]cutforce_frame_a.force_arrow.length(t)=cutforce_frame_a.scale(cutforce_frame_a.f0y(t))2+(cutforce_frame_a.f0x(t))2cutforce_frame_a.force_arrow.width(t)=cutforce_frame_a.arrow_diametercutforce_frame_a.force_arrow.height(t)=cutforce_frame_a.arrow_diametercutforce_frame_a.phi_resolve(t)=cutforce_frame_a.frame_a.phi(t)cutforce_world.frame_a.x(t)=cutforce_world.frame_b.x(t)cutforce_world.frame_a.y(t)=cutforce_world.frame_b.y(t)cutforce_world.frame_a.phi(t)=cutforce_world.frame_b.phi(t)cutforce_world.frame_b.fx(t)+cutforce_world.frame_a.fx(t)=0cutforce_world.frame_a.fy(t)+cutforce_world.frame_b.fy(t)=0cutforce_world.frame_a.tau(t)+cutforce_world.frame_b.tau(t)=0cutforce_world.f0x(t)=ifelse(cutforce_world.positive_sign,cutforce_world.frame_a.fx(t),cutforce_world.frame_a.fx(t))cutforce_world.f0y(t)=ifelse(cutforce_world.positive_sign,cutforce_world.frame_a.fy(t),cutforce_world.frame_a.fy(t))cutforce_world.force_x(t)=cutforce_world.f0y(t)sin(cutforce_world.phi_resolve(t))+cos(cutforce_world.phi_resolve(t))cutforce_world.f0x(t)cutforce_world.force_y(t)=cutforce_world.f0y(t)cos(cutforce_world.phi_resolve(t))cutforce_world.f0x(t)sin(cutforce_world.phi_resolve(t))cutforce_world.force_arrow.r(t)=arrayliteral([3],cutforce_world.frame_b.x(t),cutforce_world.frame_b.y(t),cutforce_world.z_position)cutforce_world.force_arrow.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)cutforce_world.force_arrow.r_shape(t)=[000]cutforce_world.force_arrow.length_direction(t)=arrayliteral([3],cutforce_world.f0x(t),cutforce_world.f0y(t),0)cutforce_world.force_arrow.width_direction(t)=[001]cutforce_world.force_arrow.length(t)=cutforce_world.scale(cutforce_world.f0y(t))2+(cutforce_world.f0x(t))2cutforce_world.force_arrow.width(t)=cutforce_world.arrow_diametercutforce_world.force_arrow.height(t)=cutforce_world.arrow_diametercutforce_world.phi_resolve(t)=0cutforce_frame_b.frame_a.x(t)=cutforce_frame_b.frame_b.x(t)cutforce_frame_b.frame_a.y(t)=cutforce_frame_b.frame_b.y(t)cutforce_frame_b.frame_a.phi(t)=cutforce_frame_b.frame_b.phi(t)cutforce_frame_b.frame_b.fx(t)+cutforce_frame_b.frame_a.fx(t)=0cutforce_frame_b.frame_b.fy(t)+cutforce_frame_b.frame_a.fy(t)=0cutforce_frame_b.frame_a.tau(t)+cutforce_frame_b.frame_b.tau(t)=0cutforce_frame_b.f0x(t)=ifelse(cutforce_frame_b.positive_sign,cutforce_frame_b.frame_a.fx(t),cutforce_frame_b.frame_a.fx(t))cutforce_frame_b.f0y(t)=ifelse(cutforce_frame_b.positive_sign,cutforce_frame_b.frame_a.fy(t),cutforce_frame_b.frame_a.fy(t))cutforce_frame_b.force_x(t)=cutforce_frame_b.f0y(t)sin(cutforce_frame_b.phi_resolve(t))+cos(cutforce_frame_b.phi_resolve(t))cutforce_frame_b.f0x(t)cutforce_frame_b.force_y(t)=cutforce_frame_b.f0y(t)cos(cutforce_frame_b.phi_resolve(t))sin(cutforce_frame_b.phi_resolve(t))cutforce_frame_b.f0x(t)cutforce_frame_b.force_arrow.r(t)=arrayliteral([3],cutforce_frame_b.frame_b.x(t),cutforce_frame_b.frame_b.y(t),cutforce_frame_b.z_position)cutforce_frame_b.force_arrow.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)cutforce_frame_b.force_arrow.r_shape(t)=[000]cutforce_frame_b.force_arrow.length_direction(t)=arrayliteral([3],cutforce_frame_b.f0x(t),cutforce_frame_b.f0y(t),0)cutforce_frame_b.force_arrow.width_direction(t)=[001]cutforce_frame_b.force_arrow.length(t)=cutforce_frame_b.scale(cutforce_frame_b.f0y(t))2+(cutforce_frame_b.f0x(t))2cutforce_frame_b.force_arrow.width(t)=cutforce_frame_b.arrow_diametercutforce_frame_b.force_arrow.height(t)=cutforce_frame_b.arrow_diametercutforce_frame_b.phi_resolve(t)=cutforce_frame_b.frame_b.phi(t)]

Source

dyad
"""
Test for CutForce sensor: a damped pendulum with three CutForce sensors
measuring reaction forces at different points in the chain, each resolved
in a different frame.

Topology: World → CutForce(frame_a) → Revolute → CutForce(world) → FixedTranslation → CutForce(frame_b) → Body
A rotational damper stabilizes the revolute joint via its flange.

Translated from PlanarMechanicsTest.Sensors.CutForces (line 633).
"""
test component CutForceTest
  world = World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 380, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  rod = FixedTranslation(r = [1, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 521, "y1": 20, "x2": 621, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 1, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 767, "y1": 20, "x2": 867, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  damper = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 190, "x2": 380, "y2": 290, "rot": 270}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 340, "x2": 380, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in frame_a (between world and revolute)"
  cut_force_frame_a = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameA()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in world frame (between revolute and rod)"
  cut_force_world = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.World()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 395, "y1": 20, "x2": 495, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in frame_b (between rod and body)"
  cut_force_frame_b = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameB()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 641, "y1": 20, "x2": 741, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial revolute.phi = 0
  initial revolute.w = 0
  # Main chain: World → CutForce(A) → Revolute → CutForce(W) → Rod → CutForce(B) → Body
  connect(world.frame_b, cut_force_frame_a.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_frame_a.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, cut_force_world.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_world.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(rod.frame_b, cut_force_frame_b.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_frame_b.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Rotational damper on revolute flange
  connect(damper.spline_b, revolute.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(damper.spline_a, fixed.spline) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end
Flattened Source
dyad
"""
Test for CutForce sensor: a damped pendulum with three CutForce sensors
measuring reaction forces at different points in the chain, each resolved
in a different frame.

Topology: World → CutForce(frame_a) → Revolute → CutForce(world) → FixedTranslation → CutForce(frame_b) → Body
A rotational damper stabilizes the revolute joint via its flange.

Translated from PlanarMechanicsTest.Sensors.CutForces (line 633).
"""
test component CutForceTest
  world = World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 380, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  rod = FixedTranslation(r = [1, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 521, "y1": 20, "x2": 621, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 1, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 767, "y1": 20, "x2": 867, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  damper = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 190, "x2": 380, "y2": 290, "rot": 270}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 340, "x2": 380, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in frame_a (between world and revolute)"
  cut_force_frame_a = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameA()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in world frame (between revolute and rod)"
  cut_force_world = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.World()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 395, "y1": 20, "x2": 495, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "CutForce resolved in frame_b (between rod and body)"
  cut_force_frame_b = CutForce(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameB()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 641, "y1": 20, "x2": 741, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial revolute.phi = 0
  initial revolute.w = 0
  # Main chain: World → CutForce(A) → Revolute → CutForce(W) → Rod → CutForce(B) → Body
  connect(world.frame_b, cut_force_frame_a.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_frame_a.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, cut_force_world.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_world.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(rod.frame_b, cut_force_frame_b.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(cut_force_frame_b.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Rotational damper on revolute flange
  connect(damper.spline_b, revolute.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(damper.spline_a, fixed.spline) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end


Test Cases

Test Case case1