Slow and delayed sensor readings

Hi all,
I am new to the Poppy platform. Installation etc was very smooth.
Now I am having issues with reading the sensor values. The values are delayed and are only updated every 10-15Hz.
I tried it both within a LoopPrimitive, a normal Primitive (with a while loop) and also outside the primitive framework. This is a minimal example.

from pypot.vrep import from_vrep
from pypot.creatures import PoppyHumanoid

robot = PoppyHumanoid(simulator='vrep')
def test_run(n):
        for s in range(n):
            t = time.time()            
            x = np.sin(t * freq * 2*np.pi)
            if s>300 and s<350:
                target = -10
            else:
                target = x*20.0-40.0
            robot.motors[0].goal_position=target
            testfile.write("{}\t{}\t{}\n".format(t,target, robot.motors[0].present_position))
            time.sleep(0.01)
testfile= open("test.txt",'w')
test_run(500)
testfile.close()

The output is attached.

See how the sensor for the position is delayed by 0.5 sec and also updated infrequently.
Any help would be appreciated.

Cheers,
Georg

1 Like