OpenRoberta / robertalab-ev3dev

roberta lab connector for ev3dev
Apache License 2.0
17 stars 14 forks source link

Trouble with the EV3 Gyrosensor #38

Closed DJuego closed 7 years ago

DJuego commented 7 years ago

For instance;

i want to show the Gyro values in EV3 screen: http://imgur.com/a/Y1d1w

I get the code: [https://paste.ofcode.org/MLV6ttyg5VcRXHmamfHqua]

Now I spin the robot with my hands. The expected values are:

0.0 12.0 18.0 32.0 Now i stop. The final value must be 32.0

HOWEVER

I get:

0.0 12.0 18.0 32.0 Now i stop, and... 14.0 11.0 4.0 0.0

Why???

P.S: I have a fully upgraded ev3dev. (2017.03.18) P.S: I have attached the XML file program in a .zip file. (2017.03.22) NEPOprog.zip

dlech commented 7 years ago

This looks like OpenRoberta. cc: @ensonic

DJuego commented 7 years ago

I am not sure, @dlech. The code generated by openroberta seems correct but when i run 'manually' (python3 NEPOprog.py) the problem remains.

On the other hand I know ev3dev-lang-python works flawlessly with the gyrosensor. I have tested it

I suspect around the EV3.py file of robertalab-ev3dev. Perhaps a problem with setting the mode sensor ...?

Could anyone try to reproduce the problem?

cc: @ensonic

ensonic commented 7 years ago

@DJuego when you say 'Now I stop', the program should stop, right? Are you saying that it still runs 4 interations and prints more values?

DJuego commented 7 years ago

No, @ensonic . I want to say i stop to spin the robot with my hands. :-P So, the robot is stationary now and the expected value in the gyro must be the current orientation ( 32º for instance). However the gyro -returns- to zero (0º)

dlech commented 7 years ago

My eyes must have been crossed yesterday. I thought this was in the ev3dev issue tracker. :blush:

ensonic commented 7 years ago

I think I found it. Contrary to the docs the sensor also reset when setting the same mode as before. http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-jessie/sensor_data.html#lego-ev3-gyro-mode0-reset

I will only set the sensor mode, if it changed.