Improved kick movement with angleInterpolation

This commit is contained in:
2018-06-24 12:33:55 +02:00
parent 0e84a98abe
commit 9941ca5778

View File

@@ -8,30 +8,30 @@ class NaoMover(object):
# fancy kick # fancy kick
KICK_SEQUENCE = [ KICK_SEQUENCE = [
# base_or_kicking, unsymmetric, joint, angle, speed # base_or_kicking, unsymmetric, joint, angle
# lift the arm # lift the arm
[[(0, 1, 'ShoulderRoll', -70, 0.4)], 1], [[(0, 1, 'ShoulderRoll', -70)], 0.5],
# lean to the side using the ankle joints # lean to the side using the ankle joints
[[(0, 1, 'AnkleRoll', -9, 0.2), [[(0, 1, 'AnkleRoll', -10),
(1, 1, 'AnkleRoll', -9, 0.2)], (1, 1, 'AnkleRoll', -10)],
1], 1],
# lift the foot using the knee joint and the ankle joint # lift the foot using the knee joint and the ankle joint
[[(1, 0, 'KneePitch', 90, 0.3), [[(1, 0, 'KneePitch', 90),
(1, 0, 'AnklePitch', -40, 0.4)], (1, 0, 'AnklePitch', -40)],
1.5,], 0.7,],
# kick-it! # kick-it!
[[(1, 0, 'HipPitch', -45, 0.05), [[(1, 0, 'HipPitch', -45),
(1, 0, 'KneePitch', 10, 0.8), (1, 0, 'KneePitch', 10),
(1, 0, 'AnklePitch', 20, 0.7)], (1, 0, 'AnklePitch', 0)],
1], 0.3],
# prepare to return into standing position # prepare to return into standing position
[[(1, 0, 'KneePitch', 40, 0.25), [[(1, 0, 'KneePitch', 40),
(1, 0, 'AnklePitch', 10, 0.25)], (1, 0, 'AnklePitch', 10)],
1,], 1,],
] ]
@@ -60,15 +60,17 @@ class NaoMover(object):
elif foot == 'R': elif foot == 'R':
sides = ['L', 'R'] sides = ['L', 'R']
for motion, wait in self.KICK_SEQUENCE: for motion, wait in self.KICK_SEQUENCE:
joints = []
angles = []
for part in motion: for part in motion:
print(part) print(part)
side, unsymmetric, joint, angle, speed = part side, unsymmetric, joint, angle = part
if foot == 'R' and unsymmetric: if foot == 'R' and unsymmetric:
angle *= -1 angle *= -1
self.mp.setAngles( joints.append(sides[side] + joint)
[sides[side] + joint], [radians(angle)], speed angles.append(radians(angle))
) self.mp.angleInterpolation(joints, angles, wait, True)
sleep(wait) # sleep(wait)
self.stand_up(0.5) self.stand_up(0.5)
self.set_arm_stiffness() self.set_arm_stiffness()