Skip to content
LIBRARY
PlanarMechanics.examples.two_joint_robot.TwoJointPlanarArm.md

PlanarMechanics.examples.two_joint_robot.TwoJointPlanarArm

Planar 2-joint serial arm: two revolute joints exposed through rotational flanges, two rigid links, and an end-effector body. Instantiated twice in TwoJointPlanarRobotPID: once as the simulated robot and once as an inverse model for computed-torque feedforward.

Usage

MultibodyComponents.PlanarMechanics.examples.two_joint_robot.TwoJointPlanarArm(r1=[1.0, 0.0], r2=[1.0, 0.0], m=1.0, I=0.1, phi1_start=0.0, phi2_start=0.0, render=true)

Parameters:

NameDescriptionUnitsDefault value
r1Translation vector of link 1m[1.0, 0.0]
r2Translation vector of link 2m[1.0, 0.0]
mEnd-effector masskg1.0
IEnd-effector moment of inertiakg.m20.1
phi1_startInitial angle of joint 1rad0.0
phi2_startInitial angle of joint 2rad0.0
renderWhether to render the arm in animationstrue

Connectors

  • frame_a - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. (Frame2D)

  • flange1 - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)

  • flange2 - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)

  • frame_tool - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. (Frame2D)

Behavior

Source

dyad
"Planar 2-joint serial arm: two revolute joints exposed through rotational flanges, two rigid links, and an end-effector body. Instantiated twice in TwoJointPlanarRobotPID: once as the simulated robot and once as an inverse model for computed-torque feedforward."
component TwoJointPlanarArm
  "Base frame"
  frame_a = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Flange of joint 1"
  flange1 = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 190, "x2": 50, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  "Flange of joint 2"
  flange2 = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 700, "x2": 50, "y2": 800, "rot": 0}
      },
      "tags": []
    }
  }
  "Tool flange at the tip of link 2"
  frame_tool = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  revolute1 = MultibodyComponents.PlanarMechanics.Revolute(phi(initial = phi1_start), w(initial = 0.0), final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 210, "y1": 450, "x2": 310, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  link1 = MultibodyComponents.PlanarMechanics.FixedTranslation(final r = r1, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 330, "y1": 450, "x2": 430, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  revolute2 = MultibodyComponents.PlanarMechanics.Revolute(phi(initial = phi2_start), w(initial = 0.0), final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 450, "x2": 550, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  link2 = MultibodyComponents.PlanarMechanics.FixedTranslation(final r = r2, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 450, "x2": 670, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(final m = m, final I = I, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 690, "y1": 450, "x2": 790, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Translation vector of link 1"
  parameter r1::Length[2] = [1.0, 0.0]
  "Translation vector of link 2"
  parameter r2::Length[2] = [1.0, 0.0]
  "End-effector mass"
  parameter m::Dyad.Mass = 1.0
  "End-effector moment of inertia"
  parameter I::MomentOfInertia = 0.1
  "Initial angle of joint 1"
  parameter phi1_start::Angle = 0.0
  "Initial angle of joint 2"
  parameter phi2_start::Angle = 0.0
  "Whether to render the arm in animations"
  parameter render::Boolean = true
relations
  connect(frame_a, revolute1.frame_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 960, "y": 500},
            {"x": 960, "y": 410},
            {"x": 200, "y": 410},
            {"x": 200, "y": 500}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(revolute1.frame_b, link1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(link1.frame_b, revolute2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute2.frame_b, link2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(link2.frame_b, body.frame_a, frame_tool) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute1.flange_a, flange1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 260, "y": 240}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(revolute2.flange_a, flange2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 500, "y": 750}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {
  "Dyad": {"icons": {"default": "dyad://MultibodyComponents/TwoJointPlanarArm.svg"}}
}
end
Flattened Source
dyad
"Planar 2-joint serial arm: two revolute joints exposed through rotational flanges, two rigid links, and an end-effector body. Instantiated twice in TwoJointPlanarRobotPID: once as the simulated robot and once as an inverse model for computed-torque feedforward."
component TwoJointPlanarArm
  "Base frame"
  frame_a = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Flange of joint 1"
  flange1 = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 190, "x2": 50, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  "Flange of joint 2"
  flange2 = Spline() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 700, "x2": 50, "y2": 800, "rot": 0}
      },
      "tags": []
    }
  }
  "Tool flange at the tip of link 2"
  frame_tool = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  revolute1 = MultibodyComponents.PlanarMechanics.Revolute(phi(initial = phi1_start), w(initial = 0.0), final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 210, "y1": 450, "x2": 310, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  link1 = MultibodyComponents.PlanarMechanics.FixedTranslation(final r = r1, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 330, "y1": 450, "x2": 430, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  revolute2 = MultibodyComponents.PlanarMechanics.Revolute(phi(initial = phi2_start), w(initial = 0.0), final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 450, "x2": 550, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  link2 = MultibodyComponents.PlanarMechanics.FixedTranslation(final r = r2, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 450, "x2": 670, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(final m = m, final I = I, final render = render) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 690, "y1": 450, "x2": 790, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Translation vector of link 1"
  parameter r1::Length[2] = [1.0, 0.0]
  "Translation vector of link 2"
  parameter r2::Length[2] = [1.0, 0.0]
  "End-effector mass"
  parameter m::Dyad.Mass = 1.0
  "End-effector moment of inertia"
  parameter I::MomentOfInertia = 0.1
  "Initial angle of joint 1"
  parameter phi1_start::Angle = 0.0
  "Initial angle of joint 2"
  parameter phi2_start::Angle = 0.0
  "Whether to render the arm in animations"
  parameter render::Boolean = true
relations
  connect(frame_a, revolute1.frame_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 960, "y": 500},
            {"x": 960, "y": 410},
            {"x": 200, "y": 410},
            {"x": 200, "y": 500}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(revolute1.frame_b, link1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(link1.frame_b, revolute2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute2.frame_b, link2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(link2.frame_b, body.frame_a, frame_tool) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute1.flange_a, flange1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 260, "y": 240}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(revolute2.flange_a, flange2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 500, "y": 750}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {
  "Dyad": {"icons": {"default": "dyad://MultibodyComponents/TwoJointPlanarArm.svg"}}
}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses