I am interested in performing a simulation consisting of a robotic arm learning to hit a ball with a racket. For this I use the Python legacy remoteAPI.
To develop the learning task, I need to know if the racket has hit the ball or not at some point. I think the best way to do this is to try to identify if there is a collision between two objects.
For this I have made a conceptual scene where I place two objects on top of each other and analyze the collision between them. In this scene that I have done, if I simply run it pressing the "play" buttom, I can observe the collision thanks to the color change and the signal of contact points.
If i run the scene in synchronous mode, I can also see that in the VREP. However, if I run the following code; I am not able to see a "True" in the "collisionState".
Code: Select all
vrep.simxSynchronous(clientID, True) vrep.simxStartSimulation(clientID, vrep.simx_opmode_blocking) retCode,colhandle = vrep.simxGetCollisionHandle(clientID, 'col_object', vrep.simx_opmode_blocking) retCode, collisionState = vrep.simxReadCollision(clientID, colhandle, vrep.simx_opmode_streaming) retCode = vrep.simxSynchronousTrigger(clientID) retCode = vrep.simxGetPingTime(clientID) for n in xrange(0, 50): retCode, collisionState = vrep.simxReadCollision(clientID, colhandle, vrep.simx_opmode_buffer) print n ,collisionState retCode = vrep.simxSynchronousTrigger(clientID) retCode = vrep.simxGetPingTime(clientID)