⇠ Back to the gallery

(small) (normal) (large)

Closed loop dynamics on fixed base

Example of simple closed loop dynamics in codyn. The model on the left shows how to close a system on the fixed base (i.e. world inertial frame) by connecting the p3 node to the closing joint. The resulting system has only one degree of freedom left.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
include "physics/physics.cdn"
include "physics/cjoints.cdn"

integrator {
    method = "runge-kutta"
}

defines {
    offset = "0.2 * pi"
}

node "system" : physics.system {
    node "p{1:3}" : physics.joints.revoluteY {
         tr = "[0; 0; -1]"
        com = "[0; 0; -0.5]"
          I = "Inertia.Box(m, 0.05, 0.05, 1)"
    }

    node "p1" {
        tr = "[0; 0; 0]"
         q = "-@offset"
    }

    node "p{2:3}" {
        q = ["0.5 * pi + @offset",
             "0.5 * pi - @offset"]
    }

    edge from "p{1:3}"
           to "p$(@1 + 1)" : physics.joint {}

    # Create a closing joint node
    node "pcl" : physics.cjoints.revoluteY {
        tr = "[0; 0; -1]"
    }

    # Connect the last body (p3) to the closing
    # loop joint
    edge from "p3" to "pcl" : physics.cjoint {}

    include "physics/model.cdn"
    include "physics/dynamics.cdn"
}

⌦ Open in playground