added dance after kick
This commit is contained in:
@@ -190,6 +190,66 @@ class NaoMover(object):
|
|||||||
self.ready_to_move = True
|
self.ready_to_move = True
|
||||||
self.mp.post.moveToward(front, side, rotation)
|
self.mp.post.moveToward(front, side, rotation)
|
||||||
|
|
||||||
|
def dance(self):
|
||||||
|
self.stand_up(0.5)
|
||||||
|
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# First we defined each step
|
||||||
|
###############################
|
||||||
|
footStepsList = []
|
||||||
|
|
||||||
|
# 1) Step forward with your left foot
|
||||||
|
footStepsList.append([["LLeg"], [[0.06, 0.1, 0.0]]])
|
||||||
|
|
||||||
|
# 2) Sidestep to the left with your left foot
|
||||||
|
footStepsList.append([["LLeg"], [[0.00, 0.16, 0.0]]])
|
||||||
|
|
||||||
|
# 3) Move your right foot to your left foot
|
||||||
|
footStepsList.append([["RLeg"], [[0.00, -0.1, 0.0]]])
|
||||||
|
|
||||||
|
# 4) Sidestep to the left with your left foot
|
||||||
|
footStepsList.append([["LLeg"], [[0.00, 0.16, 0.0]]])
|
||||||
|
|
||||||
|
# 5) Step backward & left with your right foot
|
||||||
|
footStepsList.append([["RLeg"], [[-0.04, -0.1, 0.0]]])
|
||||||
|
|
||||||
|
# 6)Step forward & right with your right foot
|
||||||
|
footStepsList.append([["RLeg"], [[0.00, -0.16, 0.0]]])
|
||||||
|
|
||||||
|
# 7) Move your left foot to your right foot
|
||||||
|
footStepsList.append([["LLeg"], [[0.00, 0.1, 0.0]]])
|
||||||
|
|
||||||
|
# 8) Sidestep to the right with your right foot
|
||||||
|
footStepsList.append([["RLeg"], [[0.00, -0.16, 0.0]]])
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Send Foot step
|
||||||
|
###############################
|
||||||
|
stepFrequency = 0.8
|
||||||
|
clearExisting = False
|
||||||
|
nbStepDance = 2 # defined the number of cycle to make
|
||||||
|
|
||||||
|
for j in range( nbStepDance ):
|
||||||
|
for i in range( len(footStepsList) ):
|
||||||
|
try:
|
||||||
|
self.mp.setFootStepsWithSpeed(
|
||||||
|
footStepsList[i][0],
|
||||||
|
footStepsList[i][1],
|
||||||
|
[stepFrequency],
|
||||||
|
clearExisting)
|
||||||
|
except Exception, errorMsg:
|
||||||
|
print str(errorMsg)
|
||||||
|
print "This example is not allowed on this robot."
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
self.mp.waitUntilMoveIsFinished()
|
||||||
|
|
||||||
|
# Go to rest position
|
||||||
|
self.mp.rest()
|
||||||
|
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
self.mp.waitUntilMoveIsFinished()
|
self.mp.waitUntilMoveIsFinished()
|
||||||
|
|
||||||
|
|||||||
@@ -481,14 +481,15 @@ if __name__ == '__main__':
|
|||||||
sleep(1)
|
sleep(1)
|
||||||
striker.mover.move_to_fast(0.5, 0, 0)
|
striker.mover.move_to_fast(0.5, 0, 0)
|
||||||
striker.mover.wait()
|
striker.mover.wait()
|
||||||
break
|
break
|
||||||
# state = 'tracking'
|
|
||||||
|
|
||||||
elif state == 'kick':
|
elif state == 'kick':
|
||||||
print('KICK!')
|
print('KICK!')
|
||||||
striker.mover.stand_up()
|
striker.mover.stand_up()
|
||||||
sleep(0.3)
|
sleep(0.3)
|
||||||
striker.mover.kick(fancy=True, foot='L')
|
striker.mover.kick(fancy=True, foot='L')
|
||||||
|
striker.speak("Nice kick. Let's do a dance")
|
||||||
|
striker.mover.dance()
|
||||||
break
|
break
|
||||||
|
|
||||||
loop_end = time()
|
loop_end = time()
|
||||||
|
|||||||
Reference in New Issue
Block a user