-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_SinTrajectory.py
executable file
·29 lines (24 loc) · 976 Bytes
/
_SinTrajectory.py
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
import numpy as np
import matplotlib.pyplot as plt
DownAMP = 0.01
UpperAMP = 0.05
StanceHeight = 0.18
StepLength = 0.12
CurrentPercent = np.array([a/100+0.01 for a in range(100)])
StancePercent = 0.6
SwingPercent = 1 - StancePercent
x = np.zeros(len(CurrentPercent), dtype=float)
y = np.zeros(len(CurrentPercent), dtype=float)
for i in range(len(CurrentPercent)):
if (CurrentPercent[i] <= StancePercent):
x[i] = -(StepLength / 2) + (CurrentPercent[i] / StancePercent) * StepLength
y[i] = DownAMP * np.sin(np.pi * CurrentPercent[i] / StancePercent) + StanceHeight
else:
x[i] = (StepLength / 2) - ((CurrentPercent[i] - StancePercent) / SwingPercent) * StepLength
y[i] = -UpperAMP * np.sin(np.pi * (CurrentPercent[i] - StancePercent) / SwingPercent) + StanceHeight
plt.plot(x,y)
plt.plot(x[99],y[99],x[79],y[79],x[59],y[59],x[29],y[29], marker='*')
# plt.title('SineTrajectory')
plt.ylim(0.195,0.125)
plt.grid()
plt.show()