Skip to content

Writing the model file directly

For when you would rather write the whole thing in a text editor than use the forms. The YAML menu of the toolbar helps: Show YAML... shows the model as it would be saved, Open in a text editor opens the saved file, and Reload from disk reads it again after you changed it. This page puts the shape of the file in one place; each tab's own "If you edit the file by hand" section has the field-by-field detail, and the command-line manual has everything, including what is not on this page.

One complete file

A two-link arm with a PD controller, a trajectory to compare it against, and a push on the tip:

name: My 2-Link Arm
gravity: [0, -9.81, 0]

links:
  - link: 1
    parent: 0
    joint: R
    dh: {alp: 0, a: 0.0, b: 0, th: 0}
    mass: 0.5
    com: [0.15, 0, 0]
    inertia: [4.2e-6, 3.75e-3, 3.75e-3, 0, 0, 0]
  - link: 2
    parent: 1
    joint: R
    dh: {alp: 0, a: 0.3, b: 0, th: 0}
    mass: 0.4
    com: [0.125, 0, 0]
    inertia: [3.3e-6, 2.08e-3, 2.08e-3, 0, 0, 0]
    tip: [0.3, 0, 0]

fordyn:
  q0: [0, 0]
  time: [0, 2]
  step: 0.01
  solver: ode45
  torque:
    pd: {kp: 49, kd: 14, q_d: [1, 0.5]}
  external:
    - {link: 2, point: [0.25, 0, 0], force: [0, 0.5, 0], from: 0.2, to: 0.7}

invdyn:
  time: [0, 2]
  step: 0.05
  trajectory:
    quintic: {q0: [0, 0], qf: [1.0, 0.5]}

Save that as a .yaml file and open it here — drawn, checked and run exactly as if it had been built in the forms. None of the sections are required together: a file with only links (no fordyn or invdyn) opens fine, with both tabs unticked until you turn one on.

The top-level keys

key what it is the detail is in
name a title, shown on the plots and in the window —
gravity [x, y, z]; [0, 0, 0] turns it off —
links the robot, one entry per link, base outwards Links
fordyn forward-dynamics settings: a controller, external forces Forward dynamics
invdyn inverse-dynamics settings: a trajectory, external forces Inverse dynamics
base_pos only for links attached to the ground in more than one place (a parallel robot); no form here Limitations
cuts only for a closed loop: where it is cut; no form here Limitations

A closed loop

A loop (four-bar, slider-crank, Stewart platform, ...) has no form here at all — cuts: is the one top-level key with nothing in the GUI behind it. The idea: cut the loop at one joint, describe what remains as an ordinary tree (as above), then say under cuts: that the two cut ends must meet. The bundled fourbar model, in full:

name: My Four-bar
gravity: [0, -9.81, 0]
cuts:
  - {a: 3, pa: [0.1, 0, 0], b: 1, pb: [0.05, 0, 0], dirs: xy}
links:
  - link: 1
    parent: 0
    joint: R
    dh: {alp: 0, a: 0.0, b: 0, th: 0}
    mass: 1.5
    com: [0.025, 0, 0]
    inertia: [1.25e-5, 3.125e-4, 3.125e-4, 0, 0, 0]
  - link: 2
    parent: 0
    joint: R
    dh: {alp: 0, a: 0.15, b: 0, th: 0}
    mass: 5.0
    com: [0.065, 0, 0]
    inertia: [4.17e-5, 7.04e-3, 7.04e-3, 0, 0, 0]
    actuated: false
  - link: 3
    parent: 2
    joint: R
    dh: {alp: 0, a: 0.13, b: 0, th: 0}
    mass: 3.0
    com: [0.05, 0, 0]
    inertia: [2.5e-5, 2.5e-3, 2.5e-3, 0, 0, 0]
    actuated: false
fordyn:
  q0: [0, 2.28, 2.28]
  time: [0, 1.33]
  step: 0.01
invdyn:
  time: [0, 1.33]
  step: 0.01
  guess: [0, 2.28, 2.28]
  trajectory:
    constant_speed: {rpm: 45}
part what it says
cuts: [{a: 3, pa: ..., b: 1, pb: ..., dirs: xy}] point pa, in link 3's own frame, must meet point pb, in link 1's own frame, in both x and y (xy: a flat loop; xyz: a ball joint). b: 0 would mean the ground, and pb a fixed point in the ground frame
actuated: false on links 2 and 3 these joints are passive; only link 1 (the crank) has a motor. Every q_d, tau or trajectory then gives one value per motor, not per joint — here, one
guess: [0, 2.28, 2.28] under invdyn a starting guess for the passive joints, close to a pose where the loop actually closes. Left out, it defaults to fordyn's q0; with neither, the loop usually fails to close at all

fordyn's q0 does not need to close exactly either — the loop is closed for you before the run starts, keeping the motor's own angle. Open the file here to see it assembled; the Inverse dynamics tab shows the Lagrange multipliers (the force holding the cut together) alongside the usual joint plots.

For a slider-crank, a Stewart platform, and how to choose a cut for a robot of your own, see the command-line manual's Closed-loop mechanisms section.

A long chain of identical links (a cable, a soft-arm approximation, the bundled 20-link chain) does not need writing out link by link. A repeat entry stands in for that many copies, each attached to the one before:

name: A 30-link chain
gravity: [0, -9.81, 0]
links:
  - repeat: 30                  # thirty identical links
    each:
      joint: R
      dh: {a: 0.1}
      mass: 0.2
      com: [0.05, 0, 0]
      inertia: [1e-6, 1.7e-4, 1.7e-4, 0, 0, 0]
fordyn:
  q0: {fill: 0}                 # the same value for every joint
  time: [0, 1]
  step: 0.02
part what it says
repeat: 30 thirty copies of the link described under each
each an ordinary link, just without link: or parent: — those are filled in automatically
{fill: 0} the same number for every joint, wherever a per-joint list is expected (q0, dq0, q_d, qf, tau, guess, ...)

The first copy attaches to whatever came before the repeat entry; write parent: 3 next to repeat to attach it elsewhere instead (it applies to the first copy only). A repeat entry can be mixed with ordinary links and with other repeat entries, as many times as you like.

Opening a model like this shows the Links tab empty and greyed out — the links are used as they are in the file, and the table has no row-by-row form for them (see Links). Everything else about the model (fordyn, invdyn, external forces) is still edited normally.

A task-space motion

Instead of moving each joint, invdyn can move a point on the robot through space — a straight line with a turn, or a circle — and work out the joint motion that gives it. No form here either: open the file, or write it, under invdyn: task:. The bundled kuka_tool model is a 6-axis arm whose tool point moves by [-0.1, 0.15, 0.1] m while turning 60° about the z axis; here it is with the middle links shortened to fit:

name: KUKA Robot, tool pose (task space)
gravity: [0, 0, -9.81]
links:
  - {link: 1, parent: 0, joint: R, dh: {alp: 0, a: 0, b: 0.4, th: 0},
     mass: 16.038, com: [0.1047, 0.0051, 0.0590],
     inertia: [0.1769, 0.2665, 0.2622, 0, 0, 0]}
  # ... links 2-5, the rest of the arm, omitted here ...
  - {link: 6, parent: 5, joint: R, dh: {alp: 1.5708, a: 0, b: 0, th: 0},
     mass: 0.008, com: [0, 0, 0.1119], tip: [0, 0, 0.1],
     inertia: [3.11e-6, 1.51e-6, 1.65e-6, 0, 0, 0]}
invdyn:
  time: [0, 1.0]
  step: 0.01
  task:
    targets:
      - {link: 6, dirs: xyz, orientation: true}
    guess: [0.2, 0.5, -0.4, 0.3, 0.6, 0.1]
    trajectory:
      pose:
        start_joints: [0.2, 0.5, -0.4, 0.3, 0.6, 0.1]
        move: [-0.1, 0.15, 0.1]
        axis: [0, 0, 1]
        angle: 1.0472

Open the bundled kuka_tool model from the toolbar to see the complete file (all six links).

part what it says
targets: [{link: 6, dirs: xyz, orientation: true}] move link 6's tip (no point given, so its tip: is used) freely in x, y, z, and track its full 3-D orientation too
guess a starting guess for the joints, for the inverse kinematics to search from — the same idea as a closed loop's guess
trajectory: pose: {...} one of three path types: pose (a straight move with a turn, start to finish — used here), circle (a point moving on a circle), cycloidal (a smooth move of the task coordinates). move, axis and angle describe pose's straight move and turn

The number of task coordinates must equal the number of joints (here: 3 position + 3 orientation = 6, matching the arm's 6 joints), so the motion is unique.

The full field reference, the circle and cycloidal paths, and how to export a complete starting file (redysim --export kuka_tool my_robot.yaml) are in the command-line manual's More advanced robots section.

What this page leaves out

Your own Python function for a controller or a force is real, YAML-only, and explained with a worked example in the command-line manual's Make your own robot chapter — this page is a map of the shape, not a replacement for it.