|
12 | 12 | # u: (optional, default 0), feedback, EX: u1 <=> x1, u2<=> y2...
|
13 | 13 | #
|
14 | 14 | # Outputs:
|
15 |
| -# x1, y1 => LF |
16 |
| -# x2, y2 => RF |
17 |
| -# x3, y3 => LH |
18 |
| -# x4, y4 => RH |
| 15 | +# x1 => LF |
| 16 | +# x2 => RF |
| 17 | +# x3 => LH |
| 18 | +# x4 => RH |
| 19 | +# |
| 20 | +# x, the output of the oscillator, is control signal for hip joint |
| 21 | +# the Ascending part is in the swing phase |
| 22 | +# the Descending part is in support phase (when the knee joint is frozen) |
19 | 23 | ###
|
20 | 24 |
|
21 | 25 | import matplotlib.pyplot as plt
|
22 | 26 | import numpy as np
|
23 | 27 |
|
24 |
| -alpha = 100 |
| 28 | +alpha = 10000 |
25 | 29 | beta = 0.75
|
26 | 30 | mu = 1
|
27 | 31 | omega_sw = 5 * np.pi
|
28 | 32 | omega_st = omega_sw * (1 - beta) / beta
|
29 |
| -a = 100 |
| 33 | +a = 10 |
30 | 34 |
|
31 | 35 | # phase config of walk gait
|
32 | 36 | phi_LF = 0
|
|
39 | 43 | # 5 seconds
|
40 | 44 | sim_duration = 5
|
41 | 45 | dt = 0.01
|
42 |
| -iteration = 10 |
| 46 | +iteration = 100 |
43 | 47 |
|
44 | 48 | x1, y1, x2, y2, x3, y3, x4, y4 = np.random.uniform(0, 1, 8)
|
45 | 49 | Q = np.matrix([x1, y1, x2, y2, x3, y3, x4, y4]).T
|
|
80 | 84 | ]).T
|
81 | 85 |
|
82 | 86 | """
|
| 87 | + Coupling Matrix of 4 Oscillators |
83 | 88 | R = [
|
84 | 89 | R11, R21, R31, R41;
|
85 | 90 | R12, R22, R32, R42;
|
|
125 | 130 | x4_t.append(x4)
|
126 | 131 | y4_t.append(y4)
|
127 | 132 |
|
128 |
| -fig, (ax0, ax1, ax2, ax3) = plt.subplots(4, 1) |
129 |
| -ax0.plot(t_t, x1_t, label='hip') |
| 133 | +plt.figure() |
| 134 | +plt.subplot(411) |
| 135 | +plt.plot(t_t, x1_t, label='hip') |
130 | 136 | plt.ylabel('LF')
|
131 |
| -ax1.plot(t_t, x2_t, label='hip') |
| 137 | +plt.grid() |
| 138 | + |
| 139 | +plt.subplot(412) |
| 140 | +plt.plot(t_t, x2_t, label='hip') |
132 | 141 | plt.ylabel('RF')
|
133 |
| -ax2.plot(t_t, x3_t, label='hip') |
| 142 | +plt.grid() |
| 143 | + |
| 144 | +plt.subplot(413) |
| 145 | +plt.plot(t_t, x3_t, label='hip') |
134 | 146 | plt.ylabel('LH')
|
135 |
| -ax3.plot(t_t, x4_t, label='hip') |
| 147 | +plt.grid() |
| 148 | + |
| 149 | +plt.subplot(414) |
| 150 | +plt.plot(t_t, x4_t, label='hip') |
136 | 151 | plt.ylabel('RH')
|
| 152 | +plt.grid() |
137 | 153 |
|
| 154 | +plt.subplots_adjust(top=0.92, bottom=0.2, hspace=0.5, wspace=0.35) |
138 | 155 | plt.legend()
|
139 | 156 |
|
140 | 157 |
|
|
0 commit comments