Exemplo n.º 1
0
    def __init__(self, simulator=None, camera=False):
        """Constructeur de la classe Cherry

        Param :
        simulator -- Mettre simulator='vrep' si vous voulez utiliser Vrep (None par défault)
        camera -- Utilisation de la camera ou non (True par défault)
        
        """

        if simulator is not None:

            self.robot = PoppyHumanoid(simulator='vrep')
            self.isCamera = False

        else:
            # TODO : Changer avec robot = PoppyTorso()
            self.robot = from_json(
                "../resource/mandatory/poppy_torso_config.json")
            self.robot.start_sync()

            for m in self.robot.motors:
                m.moving_speed = 60

            for m in self.robot.torso:
                m.compliant = False

            if camera:
                imagePath = "../utils/img/"
                cascadePath = "../utils/haarcascade_frontalface_default.xml"
                self.camera = Camera(self.robot, imagePath, cascadePath)
                self.isCamera = True
            else:
                self.isCamera = False
Exemplo n.º 2
0
# http://nbviewer.jupyter.org/github/jjehl/poppy_balance/blob/master/test_balance_2.ipynb
from poppy.creatures import PoppyHumanoid

poppy = PoppyHumanoid(simulator='vrep')

%pylab inline
import time

list_pos_x = []
list_pos_y = []
list_pos_z = []
t= []


#poppy.r_hip_y.goto_position(-50, 4)
#poppy.r_knee_y.goto_position(50, 4)

poppy.l_shoulder_y.goto_behavior = 'minjerk'
poppy.r_shoulder_y.goto_behavior = 'minjerk'
poppy.l_shoulder_x.goto_behavior = 'minjerk'
poppy.r_shoulder_x.goto_behavior = 'minjerk'

poppy.l_shoulder_x.goto_position(10, 2, wait=True)
poppy.l_shoulder_y.goto_position(10, 2, wait=True)
poppy.r_shoulder_x.goto_position(-10, 2, wait=True)
poppy.r_shoulder_y.goto_position(10, 2, wait=True)

poppy.l_shoulder_y.goto_position(80, 4)
poppy.r_shoulder_y.goto_position(80, 4)

import socket
import itertools
import time
import serial
import pypot.vrep
from pypot.vrep import from_vrep
from poppy.creatures import PoppyHumanoid


HOST = '127.0.0.1'
PORT = 50007              # Arbitrary non-privileged port

pypot.vrep.close_all_connections()

poppy = PoppyHumanoid(simulator='vrep') #connection à simulateur

print ('Connection reussi avec POPPY HUMANOID') 

poppy.compliant = False
poppy.power_up()

        # Change PID of Dynamixel MX motors
for m in filter(lambda m: hasattr(m, 'pid'), poppy.motors):
    m.pid = (1, 8, 0)  

for m in poppy.torso:
    m.pid = (6, 2, 0)

        # Reduce max torque to keep motor temperature low
for m in poppy.motors:
    m.torque_limit = 70
Exemplo n.º 4
0
# http://nbviewer.jupyter.org/github/jjehl/poppy_balance/blob/master/test_VREP_force.ipynb
from poppy.creatures import PoppyHumanoid

poppy = PoppyHumanoid(simulator='vrep',scene='poppy_humanoid_add_force.ttt')

%pylab inline

import time

"""
Populating the interactive namespace from numpy and matplotlib
"""

t0 = time.time()
t_simu = poppy.current_simulation_time
while time.time()-t0 <10:
    if poppy.current_simulation_time - t_simu < 1 :
        time.sleep(0.01)
    else :
        poppy.set_VREP_force([7,0,0],'l_forearm_respondable')
        t_simu = poppy.current_simulation_time
        while poppy.current_simulation_time - t_simu < 0.025:
            time.sleep(0.01)
        poppy.set_VREP_force([0,0,0],'l_forearm_respondable')