Вы находитесь на странице: 1из 18

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2020.04.

12 09:03:44 =~=~=~=~=~=~=~=~=~=~=~=

root@hexapod_zynq:~/hexapod_project/Modeling/Python# py
test_locomotion_gait_translation.py
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.07
Insert alpha : 0
Insert Walk : 3
Insert N gaits : 1
Traceback (most recent call last):
File "test_locomotion_gait_translation.py", line 226, in <module>
hexapod.set_step_debug()
File "/home/root/hexapod_project/Modeling/Python/includes/hexapod_class.py", line
198, in set_step_debug
if ( leg == 1 ):
ValueError: The truth value of an array with more than one element is ambiguous.
Use a.any() or a.all()
root@hexapod_zynq:~/hexapod_project/Modeling/Python# py
test_locomotion_gait_translation.pyvim test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" 228L, 11173C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue173 if S!=0:
174 z5=-(8*(3*i-S/4)**2/S-zo-S/2);
175 else:
176 z5=zo+S/2;
177 if i<=S/2:
178 x6=xo-0.6*i*sin(alf);y6=-yo-0.6*i*cos(alf);z6=zo;
179
180 ## Segunda Etapa: S/3<i<=S/2
181 if i>S/3 and i<=S/2:
182 x1=xo+(3*i-1.2*S)*sin(-alf); y1=yo+(3*i-1.2*S)*cos(-alf); z1=-(8*((3*i-
1.2 *S)-S/20)**2/S-zo-S/2);
183 ## Segunda Etapa: 5*S/6<i<=S
184 if i>5*S/6 and i<=S:
185 x2=xo+3*(i-S)*sin(alf);y2=yo+3*(i-S)*cos(alf);z2=-(8*(3*(i-S)+ S/4)**2/S-zo-
S/2);
186 ## Segunda Etapa: S/6<i<=S/3
187 if i>S/6 and i<=S/3:
188 x3=xo+(3*i-0.6*S)*sin(-alf); y3=0+(3*i-0.6*S)*cos(-alf); z3=-(8*((3*i-
0.6 *S)-3/20*S)**2/S-zo-S/2);
189 if i>2*S/3 and i<=5*S/6:
190 x4=xo+(3*i-2.4*S)*sin(alf); y4=0+(3*i-2.4*S)*cos(alf); z4=-(8*((3*i-
2.4 *S)+3/20*S)**2/S-zo-S/2);
191 ## Segunda Etapa: S/6<i<=S
192 if i>S/6 and i<=S:
193 x5=xo+0.6*(S-i)*sin(-alf); y5=-yo+0.6*(S-i)*cos(-alf); z5=zo;
194 ## Segunda Etapa: S/2<i<=2S/3
195 if i>S/2 and i<=2*S/3:
196 x6=xo+(3*i-1.8*S)*sin(alf); y6=-yo+(3*i-1.8*S)*cos(alf); z6=-(8*((3*i-
1.8 *S)+S/20)**2/S-zo-S/2);
197
198 ## Tercera Etapa: S/2<i<=S
199 if i>S/2 and i<=S:
200 x1=xo+0.6*(S-i)*sin(-alf); y1=yo+0.6*(S-i)*cos(-alf); z1=zo;
201 ## Tercera Etapa: S/3<i<=S
202 if i>S/3 and i<=S:
203 x3=xo+0.6*(S-i)*sin(-alf); y3=0+0.6*(S-i)*cos(-alf);z3=zo;

204 ## Tercera Etapa: 5*S/6<i<=S


205 if i>5*S/6 and i<=S:
206 x4=xo+0.6*(S-i)*sin(alf);y4=0+0.6*(S-i)*cos(alf);z4=zo;
207 ## Tercera Etapa: 2S/3<i<=S
208 if i>2*S/3 and i<=S:
209 x6=xo+0.6*(S-i)*sin(alf);y6=-yo+0.6*(S-i)*cos(alf); z6=zo;
210
211 x1=x1/100; y1=y1/100; z1=z1/100;
212 x2=x2/100; y2=y2/100; z2=z2/100;
213 x3=x3/100; y3=y3/100; z3=z3/100;
214 x4=x4/100; y4=y4/100; z4=z4/100;
215 x5=x5/100; y5=y5/100; z5=z5/100;
216 x6=x6/100; y6=y6/100; z6=z6/100;
217
218 hexapod.joints[0] = [x1, y1, z1]
219 hexapod.joints[1] = [x2, y2, z2]
220 hexapod.joints[2] = [x3, y3, z3]
221 hexapod.joints[3] = [x4, y4, z4]
222 hexapod.joints[4] = [x5, y5, z5]
223 hexapod.joints[5] = [x6, y6, z6]
224 hexapod.set_step()
225 # hexapod.step_delay()
226 hexapod.set_step_debug()
227
228 hexapod.set_init_position(print_out=False)G ()k k k k j j dd
hexapod.set_init_position(print_out=False)
~
k v1-- VISUAL --1d hexapod.step_delay()::wq!
"test_locomotion_gait_translation.py" 227L, 11139C written
root@hexapod_zynq:~/hexapod_project/Modeling/Python# clear
root@hexapod_zynq:~/hexapod_project/Modeling/Python# py alias TEST='py
test_locomotion_gait_translation .py'
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.7
Insert alpha : -90
Insert Walk : 4
Insert N gaits : 5
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" 227L, 11139C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue172 x5=xo+3*i*sin(-alf);y5=-yo+3*i*cos(-
alf);
173 if S!=0:
174 z5=-(8*(3*i-S/4)**2/S-zo-S/2);
175 else:
176 z5=zo+S/2;
177 if i<=S/2:
178 x6=xo-0.6*i*sin(alf);y6=-yo-0.6*i*cos(alf);z6=zo;
179
180 ## Segunda Etapa: S/3<i<=S/2
181 if i>S/3 and i<=S/2:
182 x1=xo+(3*i-1.2*S)*sin(-alf); y1=yo+(3*i-1.2*S)*cos(-alf); z1=-(8*((3*i-
1.2 *S)-S/20)**2/S-zo-S/2);
183 ## Segunda Etapa: 5*S/6<i<=S
184 if i>5*S/6 and i<=S:
185 x2=xo+3*(i-S)*sin(alf);y2=yo+3*(i-S)*cos(alf);z2=-(8*(3*(i-S)+ S/4)**2/S-zo-
S/2);
186 ## Segunda Etapa: S/6<i<=S/3
187 if i>S/6 and i<=S/3:
188 x3=xo+(3*i-0.6*S)*sin(-alf); y3=0+(3*i-0.6*S)*cos(-alf); z3=-(8*((3*i-
0.6 *S)-3/20*S)**2/S-zo-S/2);
189 if i>2*S/3 and i<=5*S/6:
190 x4=xo+(3*i-2.4*S)*sin(alf); y4=0+(3*i-2.4*S)*cos(alf); z4=-(8*((3*i-
2.4 *S)+3/20*S)**2/S-zo-S/2);
191 ## Segunda Etapa: S/6<i<=S
192 if i>S/6 and i<=S:
193 x5=xo+0.6*(S-i)*sin(-alf); y5=-yo+0.6*(S-i)*cos(-alf); z5=zo;
194 ## Segunda Etapa: S/2<i<=2S/3
195 if i>S/2 and i<=2*S/3:
196 x6=xo+(3*i-1.8*S)*sin(alf); y6=-yo+(3*i-1.8*S)*cos(alf); z6=-(8*((3*i-
1.8 *S)+S/20)**2/S-zo-S/2);
197
198 ## Tercera Etapa: S/2<i<=S
199 if i>S/2 and i<=S:
200 x1=xo+0.6*(S-i)*sin(-alf); y1=yo+0.6*(S-i)*cos(-alf); z1=zo;
201 ## Tercera Etapa: S/3<i<=S
202 if i>S/3 and i<=S:
203 x3=xo+0.6*(S-i)*sin(-alf); y3=0+0.6*(S-i)*cos(-alf);z3=zo;

204 ## Tercera Etapa: 5*S/6<i<=S


205 if i>5*S/6 and i<=S:
206 x4=xo+0.6*(S-i)*sin(alf);y4=0+0.6*(S-i)*cos(alf);z4=zo;
207 ## Tercera Etapa: 2S/3<i<=S
208 if i>2*S/3 and i<=S:
209 x6=xo+0.6*(S-i)*sin(alf);y6=-yo+0.6*(S-i)*cos(alf); z6=zo;
210
211 x1=x1/100; y1=y1/100; z1=z1/100;
212 x2=x2/100; y2=y2/100; z2=z2/100;
213 x3=x3/100; y3=y3/100; z3=z3/100;
214 x4=x4/100; y4=y4/100; z4=z4/100;
215 x5=x5/100; y5=y5/100; z5=z5/100;
216 x6=x6/100; y6=y6/100; z6=z6/100;
217
218 hexapod.joints[0] = [x1, y1, z1]
219 hexapod.joints[1] = [x2, y2, z2]
220 hexapod.joints[2] = [x3, y3, z3]
221 hexapod.joints[3] = [x4, y4, z4]
222 hexapod.joints[4] = [x5, y5, z5]
223 hexapod.joints[5] = [x6, y6, z6]
224 hexapod.set_step()
225 hexapod.step_delay()
226
227 hexapod.set_init_position(print_out=False)^M ^M G g gg 1 # -*- coding:
utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = 0.01
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;::q!
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.pyTEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.7
Insert alpha : -45
Insert Walk : 1 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.7
Insert alpha : 0
Insert Walk : 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" 227L, 11139C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue 1 # -*- coding: utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = 0.01
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;G 172 x5=xo+3*i*sin(-
alf);y5=-yo+3*i*cos(-alf);
173 if S!=0:
174 z5=-(8*(3*i-S/4)**2/S-zo-S/2);
175 else:
176 z5=zo+S/2;
177 if i<=S/2:
178 x6=xo-0.6*i*sin(alf);y6=-yo-0.6*i*cos(alf);z6=zo;
179
180 ## Segunda Etapa: S/3<i<=S/2
181 if i>S/3 and i<=S/2:
182 x1=xo+(3*i-1.2*S)*sin(-alf); y1=yo+(3*i-1.2*S)*cos(-alf); z1=-(8*((3*i-
1.2 *S)-S/20)**2/S-zo-S/2);
183 ## Segunda Etapa: 5*S/6<i<=S
184 if i>5*S/6 and i<=S:
185 x2=xo+3*(i-S)*sin(alf);y2=yo+3*(i-S)*cos(alf);z2=-(8*(3*(i-S)+ S/4)**2/S-zo-
S/2);
186 ## Segunda Etapa: S/6<i<=S/3
187 if i>S/6 and i<=S/3:
188 x3=xo+(3*i-0.6*S)*sin(-alf); y3=0+(3*i-0.6*S)*cos(-alf); z3=-(8*((3*i-
0.6 *S)-3/20*S)**2/S-zo-S/2);
189 if i>2*S/3 and i<=5*S/6:
190 x4=xo+(3*i-2.4*S)*sin(alf); y4=0+(3*i-2.4*S)*cos(alf); z4=-(8*((3*i-
2.4 *S)+3/20*S)**2/S-zo-S/2);
191 ## Segunda Etapa: S/6<i<=S
192 if i>S/6 and i<=S:
193 x5=xo+0.6*(S-i)*sin(-alf); y5=-yo+0.6*(S-i)*cos(-alf); z5=zo;
194 ## Segunda Etapa: S/2<i<=2S/3
195 if i>S/2 and i<=2*S/3:
196 x6=xo+(3*i-1.8*S)*sin(alf); y6=-yo+(3*i-1.8*S)*cos(alf); z6=-(8*((3*i-
1.8 *S)+S/20)**2/S-zo-S/2);
197
198 ## Tercera Etapa: S/2<i<=S
199 if i>S/2 and i<=S:
200 x1=xo+0.6*(S-i)*sin(-alf); y1=yo+0.6*(S-i)*cos(-alf); z1=zo;
201 ## Tercera Etapa: S/3<i<=S
202 if i>S/3 and i<=S:
203 x3=xo+0.6*(S-i)*sin(-alf); y3=0+0.6*(S-i)*cos(-alf);z3=zo;

204 ## Tercera Etapa: 5*S/6<i<=S


205 if i>5*S/6 and i<=S:
206 x4=xo+0.6*(S-i)*sin(alf);y4=0+0.6*(S-i)*cos(alf);z4=zo;
207 ## Tercera Etapa: 2S/3<i<=S
208 if i>2*S/3 and i<=S:
209 x6=xo+0.6*(S-i)*sin(alf);y6=-yo+0.6*(S-i)*cos(alf); z6=zo;
210
211 x1=x1/100; y1=y1/100; z1=z1/100;
212 x2=x2/100; y2=y2/100; z2=z2/100;
213 x3=x3/100; y3=y3/100; z3=z3/100;
214 x4=x4/100; y4=y4/100; z4=z4/100;
215 x5=x5/100; y5=y5/100; z5=z5/100;
216 x6=x6/100; y6=y6/100; z6=z6/100;
217
218 hexapod.joints[0] = [x1, y1, z1]
219 hexapod.joints[1] = [x2, y2, z2]
220 hexapod.joints[2] = [x3, y3, z3]
221 hexapod.joints[3] = [x4, y4, z4]
222 hexapod.joints[4] = [x5, y5, z5]
223 hexapod.joints[5] = [x6, y6, z6]
224 hexapod.set_step()
225 hexapod.step_delay()
226
227 hexapod.set_init_position(print_out=False)g gg 1 # -*- coding: utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = 0.01
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;g gg ::q
root@hexapod_zynq:~/hexapod_project/Modeling/Python# git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: includes/hexapod_class.py
modified: test_locomotion_gait_translation.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
.axi.log.swn
.axi.log.swo
.axi.log.swp
.compare.py.un~
.set_hexapod_offsets.py.un~
.set_initial_position.py.un~
.test_gait.py.un~
.test_locomotion.py.swp
.test_locomotion.py.un~
.test_locomotion_gait_translation.py.un~
axi.log
compare.py
includes/.hexapod_class.py.un~
includes/cordic_model.pyc
includes/devmem_map.pyc
includes/hexapod_class.pyc
includes/hexapod_class.py~
includes/numeric_conversions.pyc
params/.init_position.params.un~
params/.init_servo_inv.params.un~
params/.joint_offset.params.un~
params/init_position.params~
params/init_servo_inv.params~
params/joint_offset.params~
set_hexapod_offsets.py~
set_initial_position.py~
test_gait.py~
test_locomotion.py~
test_locomotion_gait_translation.py~

no changes added to commit (use "git add" and/or "git commit -a")
root@hexapod_zynq:~/hexapod_project/Modeling/Python# git checkout --
test_locomotion_gait_translatio n.py includes/hexapod_class.py
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.7
Insert alpha : -45 -90
Insert Walk : 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Insert S val = 7
Insert res = 0.7
Insert alpha : 0
Insert Walk : 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vi m
test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" [noeol] 227L, 11138C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue 1 # -*- coding: utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = 0.01
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;::35$ v1-- VISUAL
--1h21h30h4.h5 0l40d a -- INSERT (paste) --ininpuinput('S = float(input(Insert S
val = )) #10 #y stride lengthres = float(input(Insert res = )) #0.1
#iteration resolutionxo = 12.38 #x offsetyo = float(5) #y offsetzo =
-10.51 #z offsetangle = input(Insert alpha : )alf = angle*pi/180;## Selecci�n de
caminatawalk = input(Insert Walk : )
###################################################################################
Traslational
Locomotion#########################################################################
######n_gaits = input(Insert N gaits : )for k in range (n_gaits): for j in
range(int(S/res)+1): i=res*j; if(walk==1): ## Primera
Etapa: 0<i<=S/2 if i<=S/2: x1=xo+i*sin(-alf);
y1=yo+i*cos(-alf); x2=xo+(S/2-i)*sin(alf); y2=yo+(S/2-
i)*cos(alf); z2=zo; x3=xo+(S/4-i)*sin(-alf); y3=0 +
(S/4-i)*cos(-alf); z3=zo;Set delay (0.01)() (0.01) : 'S =
float(input(Insert S val = )) #10 #y stride lengthres = float(input(Insert
res = )) #0.1 #iteration resolutionxo = #x offsetyo = float()
#y offsetzo = - #z offsetangle = input(Insert alpha : )alf = angle*pi/;##
Selecci�n de caminatawalk = input(Insert Walk : )
###################################################################################
Traslational
Locomotion#########################################################################
######n_gaits = input(Insert N gaits : )for k in range (n_gaits): for j in
range(int(S/res)+): i=res*j; if(walk==): ## Primera Etapa:
0<i<=S/2 if i<=S/: x1=xo+i*sin(-alf);
y1=yo+i*cos(-alf); x2=xo+(S/-i)*sin(alf); y2=yo+(S/-
i)*cos(alf); z2=zo; x3=xo+(S/-i)*sin(-alf); y3= +(S/-
i)*cos(-alf); z3=zo;)()^[ ::wq!"test_locomotion_gait_translation.py" 227L,
11163C written
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.pyTEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 0.05
Insert S val = 7
Insert res = 0.7
Insert alpha : - 0
Insert Walk : 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 0.1
Insert S val = 7
Insert res = 0.7
Insert alpha : 0
Insert Walk : 4
Insert N gaits : 19 0
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 0.1
Insert S val = 7
Insert res = 0.7
Insert alpha : 90
Insert Walk : 4
Insert N gaits : 10
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 7 0.1
Insert S val = 7
Insert res = 0.7
Insert alpha : 90
Insert Walk : 4
Insert N gaits : 10Traceback (most recent call last):
File "test_locomotion_gait_translation.py", line 53, in <module>
n_gaits = input('Insert N gaits : ')
KeyboardInterrupt
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 1
Insert S val = 7
Insert res = 0.7
Insert alpha : 90
Insert Walk : 4
Insert N gaits : 10
^CTraceback (most recent call last):
File "test_locomotion_gait_translation.py", line 225, in <module>
hexapod.step_delay()
File "/home/root/hexapod_project/Modeling/Python/includes/hexapod_class.py", line
205, in step_delay
sleep(self.delay)
KeyboardInterrupt
root@hexapod_zynq:~/hexapod_project/Modeling/Python# TEST
Appending path/home/root/hexapod_project/Modeling/Python/includes
HEXAPOD CLASS > Import initial possitions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_position.params
HEXAPOD CLASS > Import offsets successfuly :
/home/root/hexapod_project/Modeling/Python/params/joint_offset.params
HEXAPOD CLASS > Import servo inversions successfuly :
/home/root/hexapod_project/Modeling/Python/params/init_servo_inv.params
Set delay (0.01) : 1
Insert S val = 7
Insert res = 0.7
Insert alpha : 0
Insert Walk : 4
Insert N gaits : 10
^CTraceback (most recent call last):
File "test_locomotion_gait_translation.py", line 225, in <module>
hexapod.step_delay()
File "/home/root/hexapod_project/Modeling/Python/includes/hexapod_class.py", line
205, in step_delay
sleep(self.delay)
KeyboardInterrupt
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" 227L, 11163C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue 1 # -*- coding: utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = input('Set delay (0.01) : ')
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;^D () 63 x4=xo+(i-
S/4)*sin(-alf);y4=0 +(i-S/4)*cos(-alf);
64 x5=xo+i*sin(-alf);y5=-yo+i*cos(-alf);
65 x6=xo+(S/2-i)*sin(alf);y6=-yo+(S/2-i)*cos(alf);z6=zo;
66 if S!=0:
67 z1=-(8*(i-S/4)**2/S-zo-S/2);
68 z4=-(8*(i-S/4)**2/S-zo-S/2);
69 z5=-(8*(i-S/4)**2/S-zo-S/2);
70 else:
71 z1=zo+S/2;
72 z4=zo+S/2;
73 z5=zo;
74
75 ## Segunda Etapa: S/2<i<=S
76 if i>S/2 and i<=S:
77 x1=xo+(S-i)*sin(-alf);y1=yo+(S-i)*cos(-alf);z1=zo;
78 x2=xo+(i-S/2)*sin(alf);y2=yo+(i-S/2)*cos(alf);z2=-(8*(i-3*S/4) **2/S-zo-
S/2);
79 x3=xo+(i-3*S/4)*sin(-alf); y3=0+(i-3*S/4)*cos(-alf);z3=-(8*(i-3*S/4)
**2/S-zo-S/2);
80 x4=xo+(3*S/4-i)*sin(-alf); y4=0+(3*S/4-i)*cos(-alf);z4=zo;
81 x5=xo-(i-S)*sin(-alf);y5=-yo-(i-S)*cos(-alf);z5=zo;
82 x6=xo+(i-S/2)*sin(alf);y6=-yo+(i-S/2)*cos(alf);z6=-(8*(i-3*S/4) **2/S-zo-
S/2);
83
84 elif (walk==2):
85 ## Primera Etapa: 0<i<=S/3
86 if i<=S/3:
87 x1=xo+1.5*i*sin(-alf);y1=yo+1.5*i*cos(-alf);
88 x2=xo-0.75*i*sin(alf);y2=yo-0.75*i*cos(alf);z2=zo;
89 x3=xo-0.75*i*sin(-alf);y3=0-0.75*i*cos(-alf);z3=zo;
90 x4=xo+1.5*i*sin(alf);y4=0+1.5*i*cos(alf);G 172 x5=xo+3*i*sin(-alf);y5=-
yo+3*i*cos(-alf);
173 if S!=0:
174 z5=-(8*(3*i-S/4)**2/S-zo-S/2);
175 else:
176 z5=zo+S/2;
177 if i<=S/2:
178 x6=xo-0.6*i*sin(alf);y6=-yo-0.6*i*cos(alf);z6=zo;
179
180 ## Segunda Etapa: S/3<i<=S/2
181 if i>S/3 and i<=S/2:
182 x1=xo+(3*i-1.2*S)*sin(-alf); y1=yo+(3*i-1.2*S)*cos(-alf); z1=-(8*((3*i-
1.2 *S)-S/20)**2/S-zo-S/2);
183 ## Segunda Etapa: 5*S/6<i<=S
184 if i>5*S/6 and i<=S:
185 x2=xo+3*(i-S)*sin(alf);y2=yo+3*(i-S)*cos(alf);z2=-(8*(3*(i-S)+ S/4)**2/S-zo-
S/2);
186 ## Segunda Etapa: S/6<i<=S/3
187 if i>S/6 and i<=S/3:
188 x3=xo+(3*i-0.6*S)*sin(-alf); y3=0+(3*i-0.6*S)*cos(-alf); z3=-(8*((3*i-
0.6 *S)-3/20*S)**2/S-zo-S/2);
189 if i>2*S/3 and i<=5*S/6:
190 x4=xo+(3*i-2.4*S)*sin(alf); y4=0+(3*i-2.4*S)*cos(alf); z4=-(8*((3*i-
2.4 *S)+3/20*S)**2/S-zo-S/2);
191 ## Segunda Etapa: S/6<i<=S
192 if i>S/6 and i<=S:
193 x5=xo+0.6*(S-i)*sin(-alf); y5=-yo+0.6*(S-i)*cos(-alf); z5=zo;
194 ## Segunda Etapa: S/2<i<=2S/3
195 if i>S/2 and i<=2*S/3:
196 x6=xo+(3*i-1.8*S)*sin(alf); y6=-yo+(3*i-1.8*S)*cos(alf); z6=-(8*((3*i-
1.8 *S)+S/20)**2/S-zo-S/2);
197
198 ## Tercera Etapa: S/2<i<=S
199 if i>S/2 and i<=S:
200 x1=xo+0.6*(S-i)*sin(-alf); y1=yo+0.6*(S-i)*cos(-alf); z1=zo;
201 ## Tercera Etapa: S/3<i<=S
202 if i>S/3 and i<=S:
203 x3=xo+0.6*(S-i)*sin(-alf); y3=0+0.6*(S-i)*cos(-alf);z3=zo;

204 ## Tercera Etapa: 5*S/6<i<=S


205 if i>5*S/6 and i<=S:
206 x4=xo+0.6*(S-i)*sin(alf);y4=0+0.6*(S-i)*cos(alf);z4=zo;
207 ## Tercera Etapa: 2S/3<i<=S
208 if i>2*S/3 and i<=S:
209 x6=xo+0.6*(S-i)*sin(alf);y6=-yo+0.6*(S-i)*cos(alf); z6=zo;
210
211 x1=x1/100; y1=y1/100; z1=z1/100;
212 x2=x2/100; y2=y2/100; z2=z2/100;
213 x3=x3/100; y3=y3/100; z3=z3/100;
214 x4=x4/100; y4=y4/100; z4=z4/100;
215 x5=x5/100; y5=y5/100; z5=z5/100;
216 x6=x6/100; y6=y6/100; z6=z6/100;
217
218 hexapod.joints[0] = [x1, y1, z1]
219 hexapod.joints[1] = [x2, y2, z2]
220 hexapod.joints[2] = [x3, y3, z3]
221 hexapod.joints[3] = [x4, y4, z4]
222 hexapod.joints[4] = [x5, y5, z5]
223 hexapod.joints[5] = [x6, y6, z6]
224 hexapod.set_step()
225 hexapod.step_delay()
226
227 hexapod.set_init_position(print_out=False)::q!
root@hexapod_zynq:~/hexapod_project/Modeling/Python# vim
test_locomotion_gait_translation.py
"test_locomotion_gait_translation.py" 227L, 11163C
E823: Not an undo file:
/home/root/hexapod_project/Modeling/Python/.test_locomotion_gait_translatio
n.py.un~
Press ENTER or type command to continue172 x5=xo+3*i*sin(-alf);y5=-yo+3*i*cos(-
alf);
173 if S!=0:
174 z5=-(8*(3*i-S/4)**2/S-zo-S/2);
175 else:
176 z5=zo+S/2;
177 if i<=S/2:
178 x6=xo-0.6*i*sin(alf);y6=-yo-0.6*i*cos(alf);z6=zo;
179
180 ## Segunda Etapa: S/3<i<=S/2
181 if i>S/3 and i<=S/2:
182 x1=xo+(3*i-1.2*S)*sin(-alf); y1=yo+(3*i-1.2*S)*cos(-alf); z1=-(8*((3*i-
1.2 *S)-S/20)**2/S-zo-S/2);
183 ## Segunda Etapa: 5*S/6<i<=S
184 if i>5*S/6 and i<=S:
185 x2=xo+3*(i-S)*sin(alf);y2=yo+3*(i-S)*cos(alf);z2=-(8*(3*(i-S)+ S/4)**2/S-zo-
S/2);
186 ## Segunda Etapa: S/6<i<=S/3
187 if i>S/6 and i<=S/3:
188 x3=xo+(3*i-0.6*S)*sin(-alf); y3=0+(3*i-0.6*S)*cos(-alf); z3=-(8*((3*i-
0.6 *S)-3/20*S)**2/S-zo-S/2);
189 if i>2*S/3 and i<=5*S/6:
190 x4=xo+(3*i-2.4*S)*sin(alf); y4=0+(3*i-2.4*S)*cos(alf); z4=-(8*((3*i-
2.4 *S)+3/20*S)**2/S-zo-S/2);
191 ## Segunda Etapa: S/6<i<=S
192 if i>S/6 and i<=S:
193 x5=xo+0.6*(S-i)*sin(-alf); y5=-yo+0.6*(S-i)*cos(-alf); z5=zo;
194 ## Segunda Etapa: S/2<i<=2S/3
195 if i>S/2 and i<=2*S/3:
196 x6=xo+(3*i-1.8*S)*sin(alf); y6=-yo+(3*i-1.8*S)*cos(alf); z6=-(8*((3*i-
1.8 *S)+S/20)**2/S-zo-S/2);
197
198 ## Tercera Etapa: S/2<i<=S
199 if i>S/2 and i<=S:
200 x1=xo+0.6*(S-i)*sin(-alf); y1=yo+0.6*(S-i)*cos(-alf); z1=zo;
201 ## Tercera Etapa: S/3<i<=S
202 if i>S/3 and i<=S:
203 x3=xo+0.6*(S-i)*sin(-alf); y3=0+0.6*(S-i)*cos(-alf);z3=zo;

204 ## Tercera Etapa: 5*S/6<i<=S


205 if i>5*S/6 and i<=S:
206 x4=xo+0.6*(S-i)*sin(alf);y4=0+0.6*(S-i)*cos(alf);z4=zo;
207 ## Tercera Etapa: 2S/3<i<=S
208 if i>2*S/3 and i<=S:
209 x6=xo+0.6*(S-i)*sin(alf);y6=-yo+0.6*(S-i)*cos(alf); z6=zo;
210
211 x1=x1/100; y1=y1/100; z1=z1/100;
212 x2=x2/100; y2=y2/100; z2=z2/100;
213 x3=x3/100; y3=y3/100; z3=z3/100;
214 x4=x4/100; y4=y4/100; z4=z4/100;
215 x5=x5/100; y5=y5/100; z5=z5/100;
216 x6=x6/100; y6=y6/100; z6=z6/100;
217
218 hexapod.joints[0] = [x1, y1, z1]
219 hexapod.joints[1] = [x2, y2, z2]
220 hexapod.joints[2] = [x3, y3, z3]
221 hexapod.joints[3] = [x4, y4, z4]
222 hexapod.joints[4] = [x5, y5, z5]
223 hexapod.joints[5] = [x6, y6, z6]
224 hexapod.set_step()
225 hexapod.step_delay()
226
227 hexapod.set_init_position(print_out=False)g gg 1 # -*- coding: utf-8 -*-
2 import os, sys
3 from math import sin as sin
4 from math import cos as cos
5 from math import pi as pi
6
7 ###############################################################################
8 #### Append Paths
9 ###############################################################################
10 pathname = os.path.dirname(sys.argv[0])
11 abs_path = os.path.abspath(pathname)
12 print('Appending path'+ abs_path+'/includes')
13 sys.path.append(abs_path+'/includes')
14 from hexapod_class import hexapod_kinematics as hexapod
15
16 ###############################################################################
17 #### Hexapod Configuration
18 ###############################################################################
19 #### Hexapod Object
20 hexapod = hexapod(invoke_axi_ip=True)
21
22 ## Import Parameters
23 hexapod.offsets_file_path= abs_path+'/params/joint_offset.params'
24 hexapod.init_position_file_path = abs_path+'/params/init_position.params'
25 hexapod.init_servo_inv_file_path = abs_path+'/params/init_servo_inv.params'
26
27 ## Initialize Parameters
28 hexapod.import_init_pos()
29 hexapod.import_offsets()
30 hexapod.import_init_servo_invertion()
31 hexapod.set_default_offsets(print_out=False)
32 hexapod.set_init_position(print_out=False)
33
34 ## Set Delay
35 hexapod.delay = input('Set delay (0.01) : ')
36
37
38 S = float(input('Insert S val = ')) #10 #y stride length
39 res = float(input('Insert res = '))#0.1 #iteration resolution
40 xo = 12.38 #x offset
41 yo = float(5)#y offset
42 zo = -10.51 #z offset
43
44 angle = input('Insert alpha : ')
45 alf = angle*pi/180;
46
47 ## Selecci�n de caminata
48 walk = input('Insert Walk : ')
49
50 ###############################################################################
51 #### Traslational Locomotion
52 ###############################################################################
53 n_gaits = input('Insert N gaits : ')
54 for k in range (n_gaits):
55 for j in range(int(S/res)+1):
56 i=res*j;
57 if(walk==1):
58 ## Primera Etapa: 0<i<=S/2
59 if i<=S/2:
60 x1=xo+i*sin(-alf);y1=yo+i*cos(-alf);
61 x2=xo+(S/2-i)*sin(alf);y2=yo+(S/2-i)*cos(alf);z2=zo;
62 x3=xo+(S/4-i)*sin(-alf);y3=0 +(S/4-i)*cos(-alf);z3=zo;^M

Вам также может понравиться