on Ubuntu 16.04
This is not exactly a new problem but I still do not get it and this makes me feel uneasy to use vrep. I would appreciate if you could please explain how to properly deal with this issue. I suspect this problem is in the API wrapper so I would be fine applying a patch.
simxSetJointTargetVelocity always gives me an error (and I can not find out what it means) and it does not set the motor speed unless I call simxGetLastErrors. simxGetLastErrors comes back empty but the crazy thing is that it then works (code below).
I want to use VREP with Tensorflow. Is there something more robust than the python remote api?
Code: Select all
import vrep
# controlling the robot inside v-rep
vrep.simxFinish(-1) # just in case, close all opened connections
clientID = vrep.simxStart('127.0.0.1', 9999, True, True, 5000, 5) # Connect to V-REP
if clientID!=-1:
print 'Connected to remote API server'
vrep.simxAddStatusbarMessage(clientID, 'Moin from Python', vrep.simx_opmode_oneshot)
# Now send some data to V-REP:
err, left = vrep.simxGetObjectHandle(clientID, 'Pioneer_p3dx_leftMotor', vrep.simx_opmode_oneshot_wait)
#err, right = vrep.simxGetObjectHandle(clientID, 'Pioneer_p3dx_rightMotor', vrep.simx_opmode_blocking)
# this always gives an error and I can not figure out what it is
err = vrep.simxSetJointTargetVelocity(clientID, left, 10.0, vrep.simx_opmode_streaming)
#err = vrep.simxSetJointTargetVelocity(clientID, right, 0, vrep.simx_opmode_oneshot)
if err != vrep.simx_return_ok:
print "SetJointTargetVelocity got error code: %s" % err
# this line determines if this is successful or not
# so commenting it out breaks this
error = vrep.simxGetLastErrors(clientID, vrep.simx_opmode_blocking)
vrep.simxFinish(clientID)
else:
print 'Failed connecting to remote API server'
print 'Program ended'