Skip to content
LIBRARY
examples.TrajectoryPlannersTest.md

examples.TrajectoryPlannersTest

Example model for the Kinematic5 trajectory planner. The velocity output is passed through a BlockComponents.Continuous.Integrator so that the integrated velocity can be compared against the position output.

Usage

MultibodyComponents.examples.TrajectoryPlannersTest()

Behavior

[connect(kin5+qd,selector1+u)connect(selector1+y,intkin5+u)connect(selector2+y,intbounded_jerk+u)connect(kinematicptpboundedjerk+qd,selector2+u)connect(selector+y,intptp+u)connect(kinematicptp+qd,selector+u)kin5.q1(t)=traj5q(t,kin5.tf,kin5.q01,kin5.q11,kin5.qd01,kin5.qd11,kin5.qdd01,kin5.qdd11)kin5.qd1(t)=traj5qd(t,kin5.tf,kin5.q01,kin5.q11,kin5.qd01,kin5.qd11,kin5.qdd01,kin5.qdd11)kin5.qdd1(t)=traj5qdd(t,kin5.tf,kin5.q01,kin5.q11,kin5.qd01,kin5.qd11,kin5.qdd01,kin5.qdd11)dintkin5.x(t)dt=intkin5.kintkin5.u(t)intkin5.y(t)=intkin5.x(t)kinematicptpboundedjerk.q1(t)=evaluateat_1(kinematicptpboundedjerk.profile1,t)kinematicptpboundedjerk.qd1(t)=evaluateat_2(kinematicptpboundedjerk.profile1,t)kinematicptpboundedjerk.qdd1(t)=evaluateat_3(kinematicptpboundedjerk.profile1,t)kinematicptpboundedjerk.qddd1(t)=evaluateat_4(kinematicptpboundedjerk.profile1,t)dintbounded_jerk.x(t)dt=intbounded_jerk.kintbounded_jerk.u(t)intbounded_jerk.y(t)=intbounded_jerk.x(t)selector1.y(t)=selector1.u1(t)selector2.y(t)=selector2.u1(t)kinematicptp.q1(t)=ptpq(t,kinematicptp.q01,kinematicptp.q11,kinematicptp.qdmax1,kinematicptp.qddmax1)kinematicptp.qd1(t)=ptpqd(t,kinematicptp.q01,kinematicptp.q11,kinematicptp.qdmax1,kinematicptp.qddmax1)kinematicptp.qdd1(t)=ptpqdd(t,kinematicptp.q01,kinematicptp.q11,kinematicptp.qdmax1,kinematicptp.qddmax1)selector.y(t)=selector.u1(t)dintptp.x(t)dt=intptp.kintptp.u(t)intptp.y(t)=intptp.x(t)]

Source

dyad
"""
Example model for the Kinematic5 trajectory planner. The velocity output is
passed through a BlockComponents.Continuous.Integrator so that the integrated velocity can
be compared against the position output.
"""
example component TrajectoryPlannersTest
  "5th order polynomial trajectory planner"
  kin5 = MultibodyComponents.Kinematic5(nout = 1, tf = 2.0, q0 = [0.0], q1 = [1.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 290, "x2": 250, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  "Integrator for the Kinematic5 velocity output"
  int_kin5 = BlockComponents.Continuous.Integrator(k = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 290, "x2": 580, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  kinematicptpboundedjerk = MultibodyComponents.KinematicPTPBoundedJerk() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 450, "x2": 250, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  int_bounded_jerk = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 450, "x2": 580, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  selector1 = MultibodyComponents.Selector(nu = 1, index = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 290, "x2": 420, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  selector2 = MultibodyComponents.Selector(nu = 1, index = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 450, "x2": 420, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  kinematicptp = MultibodyComponents.KinematicPTP() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 610, "x2": 250, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
  selector = MultibodyComponents.Selector() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 610, "x2": 420, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
  int_ptp = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 610, "x2": 580, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(kin5.qd, selector1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(selector1.y, int_kin5.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(selector2.y, int_bounded_jerk.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(kinematicptpboundedjerk.qd, selector2.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 280, "y": 488}, {"x": 280, "y": 500}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(selector.y, int_ptp.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(kinematicptp.qd, selector.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end
Flattened Source
dyad
"""
Example model for the Kinematic5 trajectory planner. The velocity output is
passed through a BlockComponents.Continuous.Integrator so that the integrated velocity can
be compared against the position output.
"""
example component TrajectoryPlannersTest
  "5th order polynomial trajectory planner"
  kin5 = MultibodyComponents.Kinematic5(nout = 1, tf = 2.0, q0 = [0.0], q1 = [1.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 290, "x2": 250, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  "Integrator for the Kinematic5 velocity output"
  int_kin5 = BlockComponents.Continuous.Integrator(k = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 290, "x2": 580, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  kinematicptpboundedjerk = MultibodyComponents.KinematicPTPBoundedJerk() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 450, "x2": 250, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  int_bounded_jerk = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 450, "x2": 580, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  selector1 = MultibodyComponents.Selector(nu = 1, index = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 290, "x2": 420, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  selector2 = MultibodyComponents.Selector(nu = 1, index = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 450, "x2": 420, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  kinematicptp = MultibodyComponents.KinematicPTP() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 610, "x2": 250, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
  selector = MultibodyComponents.Selector() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 320, "y1": 610, "x2": 420, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
  int_ptp = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 480, "y1": 610, "x2": 580, "y2": 710, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(kin5.qd, selector1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(selector1.y, int_kin5.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(selector2.y, int_bounded_jerk.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(kinematicptpboundedjerk.qd, selector2.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 280, "y": 488}, {"x": 280, "y": 500}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(selector.y, int_ptp.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(kinematicptp.qd, selector.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end


Test Cases

Test Case case1

  • Examples

  • Experiments

  • Analyses