In [10]:
from poppy.creatures import PoppyHumanoid
creature = PoppyHumanoid(simulator='vrep')


---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-10-01d50a648bf7> in <module>()
      1 from poppy.creatures import PoppyHumanoid
----> 2 creature = PoppyHumanoid(simulator='vrep')

C:\Anaconda2\lib\site-packages\poppy\creatures\abstractcreature.pyc in __new__(cls, base_path, config, simulator, scene, host, port, id, use_snap, snap_host, snap_port, snap_quiet, use_http, http_host, http_port, http_quiet, use_remote, remote_host, remote_port, sync)
     87                     poppy_creature = from_vrep(config, host, port, scene)
     88                 except VrepConnectionError:
---> 89                     raise IOError('Connection to V-REP failed!')
     90 
     91             elif simulator == 'threejs':

IOError: Connection to V-REP failed!

In [35]:
creature.reset_simulation()

In [36]:
import numpy as np

def robot3_inv(x,y,z) :
    
    l1 = 16; #taille de bras
    l2 = 20; #taille de avant-bras

    Cq2 = (x^2 + y^2 + z^2 - l1^2 - l2^2)/(2*l1*l2);
    q2 = -np.arccos(Cq2);
    q1 = np.arctan(z/np.sqrt(x^2 + y^2)) - np.arctan(-l2*np.sqrt(1-Cq2^2)/(l1+l2*Cq2) );
    q0 = -np.arctan(x/y);


    q2 = round((np.real(q2*180/np.pi))); #% l_elbox_y
    q1 = round(np.real(q1*180/np.pi));  #% l_shoulder_x
    q0 = round(np.real(q0*180/np.pi)); #% l_shoulder_y
    
    return [q0,q1,q2]

In [49]:
[q0, q1, q2] = robot3_inv(50,50,50)
print q0, q1, q2

creature.l_shoulder_y.goal_position = q0
creature.l_shoulder_y.goal_position = q1
creature.l_elbow_y.goal_position = q2


-45.0 153.0 -90.0