Strange behaviour among PCs and in the same PC

Typically: "How do I... ", "How can I... " questions
Post Reply
martin
Posts: 13
Joined: 15 Mar 2016, 10:38

Strange behaviour among PCs and in the same PC

Post by martin » 07 Dec 2017, 18:27

Hello,

A colleage and me are working on a project and we found a strange behaviour on VREP.

We are running a mobile robot, we use revolute joints as motors. We control our mobile robot by the external Python API. We use the "simxSetJointTargetVelocity" function for moving the robot.

In this context, we found a strange behaviour:
Both of us use laptops and we can observe a different behaviour when the laptop is connected to the wall or if it is using the battery laptop. In this case, the velocity that we can observe and meassure while the laptop uses its battery is approximately a half of the velocity than we can observe if the computer is conected with its power supply.
Furthermore, the same scene, the same code and the same IDE performs different in her laptop than in mine. Again, approximately the half of velocity in one case then the other (perhaps this may be should to this: viewtopic.php?f=9&t=7044)

Any idea what can be happening?

Regards!

coppelia
Site Admin
Posts: 6218
Joined: 14 Dec 2012, 00:25

Re: Strange behaviour among PCs and in the same PC

Post by coppelia » 10 Dec 2017, 21:47

Hello,

When you say that the observed velocity is half... does that mean the robot appears to take twice as long to reach a specific location? or does that mean that the displayed simulation time is double, when reaching that same location?

Cheers

martin
Posts: 13
Joined: 15 Mar 2016, 10:38

Re: Strange behaviour among PCs and in the same PC

Post by martin » 12 Dec 2017, 17:31

Hello,

What It happen is:
I'm using a Python external API and I'm working wiht Python functions. The pseudocode I'm using is the following:

Code: Select all

for n in range (0, 4):
    returnCode, posicion_inicial = vrep.simxGetObjectPosition(clientID, carcasaHandler, -1, vrep.simx_opmode_buffer)
    targetVelocity = [-vel_izq, -vel_der]
    returnCode = vrep.simxSetJointTargetVelocity(clientID, leftMotorHandler, targetVelocity[0], vrep.simx_opmode_streaming)
    returnCode = vrep.simxSetJointTargetVelocity(clientID, rightMotorHandler, targetVelocity[1], vrep.simx_opmode_streaming)
    time.sleep(t)
    targetVelocity02 = [0, 0]
    returnCode = vrep.simxSetJointTargetVelocity(clientID, leftMotorHandler, targetVelocity02[0],vrep.simx_opmode_streaming)
    returnCode = vrep.simxSetJointTargetVelocity(clientID, rightMotorHandler, targetVelocity02[1],vrep.simx_opmode_streaming)
    time.sleep(2)
    returnCode,end_position = vrep.simxGetObjectPosition(clientID,carcasaHandler,-1,vrep.simx_opmode_buffer)

    array_distancia[n] = posicion_inicial[0] - end_position[0]
    print "Distance:", array_distancia[n]
the same code, tested in both PC works different:
In my PC array_distancia[n] ussually is 0.48 (approx.)
In my colleage PC array_distancia[n] ussually is 0.62 (approx.)

It seems that it the same period of time "time.sleep(t)" with t=4 in our case, the distance displaced by the robot is different in both cases. And apparently, one can see that the mobile robot moves faster in that PC which moves longest distance.

And the point is, if we make changes in the code, the results change, but they are never equal in both computers.

The simulation parameters are the same in both cases and are those predefined by the VREP. (dt=50ms)

Regards.

Post Reply