Better kick behaviour

This commit is contained in:
2018-06-18 16:00:06 +02:00
parent 30fb39ec8d
commit d58bd10584
2 changed files with 22 additions and 15 deletions

View File

@@ -21,3 +21,4 @@ if __name__ == "__main__":
mover = NaoMover(cfg['ip']) mover = NaoMover(cfg['ip'])
mover.stand_up() mover.stand_up()
mover.kick(foot=args.foot) mover.kick(foot=args.foot)
mover.rest()

View File

@@ -9,21 +9,24 @@ class NaoMover(object):
KICK_SEQUENCE = [ KICK_SEQUENCE = [
# base_or_kicking, unsymmetric, joint, angle, speed # base_or_kicking, unsymmetric, joint, angle, speed
[[(0, 1, 'ShoulderRoll', -70, 0.025)], 1], [[(0, 1, 'ShoulderRoll', -70, 0.4)], 1],
[[(0, 1, 'AnkleRoll', -9, 0.05), [[(0, 1, 'AnkleRoll', -9, 0.2),
(1, 1, 'AnkleRoll', -9, 0.05)], (1, 1, 'AnkleRoll', -9, 0.2)],
2],
[[(1, 0, 'KneePitch', 90, 0.05),
(1, 0, 'AnklePitch', -40, 0.05)],
2,],
[[(1, 0, 'HipPitch', -45, 0.08),
(1, 0, 'KneePitch', 10, 0.20),
(1, 0, 'AnklePitch', 20, 0.16)],
1], 1],
[[(1, 0, 'HipPitch', -55, 0.08)], 1]
[[(1, 0, 'KneePitch', 90, 0.3),
(1, 0, 'AnklePitch', -40, 0.4)],
1.5,],
[[(1, 0, 'HipPitch', -45, 0.05),
(1, 0, 'KneePitch', 10, 0.8),
(1, 0, 'AnklePitch', 20, 0.7)],
1],
[[(1, 0, 'KneePitch', 40, 0.25),
(1, 0, 'AnklePitch', 10, 0.25)],
1,],
] ]
def __init__(self, nao_ip, nao_port=9559): def __init__(self, nao_ip, nao_port=9559):
@@ -46,7 +49,6 @@ class NaoMover(object):
self.set_hip_stiffness(0.8) self.set_hip_stiffness(0.8)
self.set_knee_stiffness(0.8) self.set_knee_stiffness(0.8)
self.set_ankle_stiffness(1) self.set_ankle_stiffness(1)
multiplier = 5
if foot == 'L': if foot == 'L':
sides = ['R', 'L'] sides = ['R', 'L']
elif foot == 'R': elif foot == 'R':
@@ -58,11 +60,15 @@ class NaoMover(object):
if foot == 'R' and unsymmetric: if foot == 'R' and unsymmetric:
angle *= -1 angle *= -1
self.mp.setAngles( self.mp.setAngles(
[sides[side] + joint], [radians(angle)], speed * multiplier [sides[side] + joint], [radians(angle)], speed
) )
sleep(wait) sleep(wait)
self.stand_up(0.5) self.stand_up(0.5)
self.set_arm_stiffness()
self.set_hip_stiffness()
self.set_knee_stiffness()
self.set_ankle_stiffness()
def stand_up(self, speed=0.8): def stand_up(self, speed=0.8):
self.set_arm_stiffness(0.9) self.set_arm_stiffness(0.9)