In [ ]:
import vrep
import numpy
import time

hello = numpy.genfromtxt('hello.csv',delimiter=',',skip_header=3,usecols = (1, 2, 3),dtype=numpy.float)
object_name = 'feltPen_invisible'
object_name = 'my_Cube'
print 'Program started'
vrep.simxFinish(-1) # just in case, close all opened connections
clientID=vrep.simxStart('127.0.0.1',19999,True,True,5000,5)
if clientID!=-1:
    print 'Connected to remote API server'
    res,objs=vrep.simxGetObjects(clientID,vrep.sim_handle_all,vrep.simx_opmode_oneshot_wait)
    if res==vrep.simx_return_ok:
        print 'Number of objects in the scene: ',len(objs)
        res,v0=vrep.simxGetObjectHandle(clientID,object_name,vrep.simx_opmode_oneshot_wait)
        print "Ok, I'm in!"
        
        for i in hello:
            # Reads the pen position X,Y,Z
            res,pos=vrep.simxGetObjectPosition(clientID,v0,vrep.sim_handle_parent,vrep.simx_opmode_oneshot_wait)
            pos = numpy.array(pos,dtype=numpy.float)+numpy.concatenate([i[[0,1]],[0]]) # Sums X and Y
            print pos
            # Sets the new position
            res = vrep.simxSetObjectPosition(clientID,v0,vrep.sim_handle_parent,pos,vrep.simx_opmode_oneshot_wait)
            time.sleep(0.1)


    else:
        print 'Remote API function call returned with error code: ',res
    vrep.simxFinish(clientID)
else:
    print 'Failed connecting to remote API server'
print 'Program ended'


Program started
Connected to remote API server
Number of objects in the scene:  110
Ok, I'm in!
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21499995  0.50699984  0.838     ]
[ 0.21899994  0.50699984  0.838     ]
[ 0.22299994  0.50699984  0.838     ]
[ 0.22799993  0.50699984  0.838     ]
[ 0.23499993  0.50699984  0.838     ]
[ 0.24599992  0.50799985  0.838     ]
[ 0.25699993  0.50899984  0.838     ]
[ 0.26899994  0.50999982  0.838     ]
[ 0.28099993  0.51099981  0.838     ]
[ 0.29399993  0.5129998   0.838     ]
[ 0.30699994  0.51499977  0.838     ]
[ 0.32099995  0.51699975  0.838     ]
[ 0.33499995  0.51899972  0.838     ]
[ 0.34999995  0.5209997   0.838     ]
[ 0.36599993  0.52299967  0.838     ]
[ 0.38199994  0.52499964  0.838     ]
[ 0.39899994  0.52699962  0.838     ]
[ 0.41699993  0.52899959  0.838     ]
[ 0.43599994  0.53099957  0.838     ]
[ 0.45599993  0.53299954  0.838     ]
[ 0.47699994  0.53599952  0.838     ]
[ 0.49899994  0.53899954  0.838     ]
[ 0.52299995  0.54199956  0.838     ]
[ 0.54799994  0.54499958  0.838     ]
[ 0.57399992  0.5479996   0.838     ]
[ 0.59999994  0.55099962  0.838     ]
[ 0.62699996  0.55399964  0.838     ]
[ 0.65499997  0.55699966  0.838     ]
[ 0.68299997  0.55999968  0.838     ]
[ 0.71199997  0.5629997   0.838     ]
[ 0.74199995  0.56599973  0.838     ]
[ 0.77299992  0.56899975  0.838     ]
[ 0.80499994  0.57099977  0.838     ]
[ 0.83899995  0.57199974  0.838     ]
[ 0.87299993  0.57299973  0.838     ]
[ 0.90799991  0.57399972  0.838     ]
[ 0.94299993  0.5749997   0.838     ]
[ 0.97899996  0.57599969  0.838     ]
[ 1.01499997  0.57699968  0.838     ]
[ 1.05099999  0.57699966  0.838     ]
[ 1.088       0.57699966  0.838     ]
[ 1.12499994  0.57699966  0.838     ]
[ 1.16199988  0.57699966  0.838     ]
[ 1.19899982  0.57699966  0.838     ]
[ 1.23599976  0.57699966  0.838     ]
[  3.80000000e-02  -7.70000000e-09   0.00000000e+00]
[  3.80000000e-02  -7.70000000e-09   0.00000000e+00]
[  3.80000000e-02  -7.70000000e-09   0.00000000e+00]

In [ ]: