In [1]:
import time
from poppy.creatures import PoppyHumanoid
from cherry import Cherry

from pypot.primitive.move import MoveRecorder, Move, MovePlayer

In [2]:
cherry = Cherry()
cherry.setup()

for m in cherry.robot.motors :
    m.goal_position = 0.0
    
for m in cherry.robot.head :
    m.compliant = False
for m in cherry.robot.arms :
    m.compliant = True

cherry.robot.head_z.goal_position = 0.0
cherry.robot.head_y.goal_position = 30.0


init camera
init voice ok
True
init ok
init ok

In [3]:
cherry.robot.run_look.start()


setup
camera detectee!.

In [ ]:
cherry.camera.setup()

In [ ]:
cherry.robot.run_look.stop()
cherry.camera.stop()

In [ ]:
cherry.camera.displayVideo()

In [12]:
cherry.robot.tracking_behave.start()

In [9]:
cherry.robot.tracking_behave.stop()
cherry.robot.head_z.goal_position = 0.0
cherry.robot.head_y.goal_position = 30.0

In [ ]:
name = cherry.camera._name
cherry.robot.say_sentence_local.start("Bonjour ! " + name + " !")

In [ ]:
cherry.camera.isSomebody

In [ ]:
import time

for m in cherry.robot.arms:
    m.compliant = False

for m in cherry.robot.motors:
    m.moving_speed = 150
    
cherry.robot.r_shoulder_x.goal_position = -90.0
cherry.robot.l_shoulder_x.goal_position = 90.0

cherry.robot.r_arm_z.goal_position = -80.0
cherry.robot.r_elbow_y.goal_position = -30.0

cherry.robot.l_arm_z.goal_position = 80.0
cherry.robot.l_elbow_y.goal_position = -30.0

time.sleep(0.5)

cherry.robot.say_sentence_local.start("Rodri gue aise!")
cherry.robot.say_sentence_local.stop()

time.sleep(0.5)

for m in cherry.robot.motors:
    m.moving_speed = 60
    
cherry.robot.r_shoulder_x.goal_position = -10.0
cherry.robot.l_shoulder_x.goal_position = 10.0

cherry.robot.r_arm_z.goal_position = -10.0
cherry.robot.r_elbow_y.goal_position = -30.0

cherry.robot.l_arm_z.goal_position = 10.0
cherry.robot.l_elbow_y.goal_position = -30.0

time.sleep(1.2)

cherry.robot.r_elbow_y.moving_speed = 150
cherry.robot.r_arm_z.goal_position = 50.0
cherry.robot.r_elbow_y.goal_position = -145.0

time.sleep(1)
cherry.robot.say_sentence_local.start("Père")
cherry.robot.say_sentence_local.stop()
time.sleep(0.1)

for m in cherry.robot.motors:
    m.moving_speed = 150
    
cherry.robot.r_shoulder_x.goal_position = -90.0
cherry.robot.r_arm_z.goal_position = -80.0
cherry.robot.r_elbow_y.goal_position = -30.0

time.sleep(0.5)

cherry.robot.say_sentence_local.start("Et Pisse !")
cherry.robot.say_sentence_local.stop()

In [ ]:
import time

import math

amp = 30 # in degrees
freq = 0.5 # in Hz

current, goal, = [], []


position = 0.0
k = 10
errprec = 0.0
cherry.robot.head_z.goal_position = position
time.sleep(1)
cherry.robot.head_z.moving_speed=0
t0 = time.time()


while True:
    t = time.time()
    if t - t0 > 2:
        position = 90.0
    # run for 5s
    if t - t0 > 5:
        break

    #poppy.head_z.goal_position = amp * math.sin(2 * 3.14 * freq * t)
    
    mes = cherry.robot.head_z.present_position
    err =  position - mes
    #commande = 1.2*( err )+ 1.2*(err - errprec) + position
    
    commande = position + 1.2*( err )+ 1.2*(err - errprec)
    cherry.robot.head_z.goal_position = position
    
    
    current.append(mes)
    goal.append(position)
    #errprec = err
    time.sleep(0.01)

%pylab inline
import matplotlib.pyplot as plt

t = linspace(0, 5, len(current))
plot(t, goal)
plot(t, current)
axis([1.5, 4, -10, 100])

legend(('goal', 'current','com'))

In [ ]:
{p.name for p in cherry.robot.primitives}

In [ ]:
cherry.robot.wave_behave.start()

In [ ]:
cherry.robot.wave_behave.stop()

In [ ]:
cherry.robot.take_head_behave.start()

In [ ]:
cherry.robot.normal_behave.start()

In [ ]:
cherry.robot.yes_behave.start()

In [ ]:
cherry.robot.yes_behave.stop()

In [ ]:
cherry.robot.copy_arm_behave.start()

In [ ]:
cherry.robot.copy_arm_behave.stop()

In [ ]:
move_recorder = MoveRecorder(cherry.robot, 50, cherry.robot.motors)

for m in cherry.robot.arms:
    m.compliant = True

for m in cherry.robot.head:
    m.compliant = True    
    
move_recorder.start()

In [ ]:
for m in cherry.robot.head:
    m.compliant = False

In [ ]:
for m in cherry.robot.arms:
    m.compliant = True

In [ ]:
move_recorder.stop()

In [ ]:
import time

with open('my_nice_move.move', 'w') as f:
    move_recorder.move.save(f)

with open('my_nice_move.move') as f:
    m = Move.load(f)

cherry.robot.compliant = False

move_player = MovePlayer(cherry.robot, m)
move_player.start()

In [ ]:
cherry.robot.r_shoulder_x.goal_speed = -70

In [ ]:
for m in cherry.robot.motors :
    m.goal_position = 0.0

In [ ]:
cherry.robot.head_z.goal_speed = -100

In [ ]: