PiStorms and EV3 ServoMotor encoder value
 Hardware Related   Started by Jordi FARAUDO   2017-02-28 06:54:50 -05:00   Comments: 10    Viewed: 309

  1. Hi
    We are using PiStorms + RPi 3 with EV3 motors.
    We are getting strange values for the encoder, which depends on the direction of rotation.
    We ask a Large Ev3 servo motor to rotate slowly. The programs first resets the encoder value, then starts to move the motor showing on screen the read encoder value as the motor.
    When the motor rotates clockwise, everything seems fine: encoder values where increasing and reach a value of 360 after a full rotation. But when the motor rotates anti-clockwise, we get from the beginning very large numbers of the encoder value (numbers with many milions) which decrease as the motor rotates.
    Anybody had similar issues?
    Any suggestion?

    By the way, what are the values that I should expect from encoder? I mean, is there a maximum value for the reading of the encoder?

    thanks!

    jordi
    Jordi FARAUDO, 2017-02-28 06:54:50 -05:00
  2. setht
    setht Member Staff Member
    Hello!

    Could you please attach the program you are using?

    Also, please try running 50-MotorDemos/04-Motor-ShowPos.py. I ran this, connected a large EV3 motor to BAM1, and pressed OK. When I rotated the motor the value on screen showed a reasonable number of degrees, in both the positive and negative direction.

    50-MotorDemos/04-Motor-ShowPos.py
    setht, 2017-03-08 10:48:32 -05:00
  3. HI,
    still obtaining strange (very large and nonsense)  values with  50-MotorDemos/04-Motor-ShowPos.py. Here are photos of the reading in the screen obtained with the program 50-MotorDemos/04-Motor-ShowPos.py
     


    In anti-clockwise rotation we never see negative values for the encoder. Always these strange large values. These values appear only in one of the rotation directions (anti-clockwise). In clockwise rotation, everything seems to be always fine (the encoder value keeps growing and we get 720 after two full rotations for example).

    In this Pistroms v2 the firmware version is 2.05 and the software version is 4.010

    Any advice will be great.
    thanks
    jordi
    Jordi FARAUDO, 2017-03-21 09:02:39 -04:00
  4. setht
    setht Member Staff Member

    Good morning,

    The first thing that came to mind when I saw your screenshots was 2^31. However, even subtracting this out leaves an 8 million degree deficit, and I doubt you have rotated this motor over 20k rotations since it was reset. Does the number jump up to the large value as soon as it passes 0? Does rotating it back clockwise return to normal only when it passes 0?

    Thank you for providing your PiStorms' firmware version number, that is helpful. I believe I have replicated your test and observed the expected and reasonable results in both directions. If you have access to an NXT or EV3 could you please try an equivalent test with it? I would assume you get the expected negative values, but I'm not quite sure what to look at when I'm having trouble recreating the issue you saw.

    setht, 2017-03-21 11:15:55 -04:00
  5. Everything is fine with mindstorms EV3. The problem is with pistorms. 
    Have you tried with the same software and firmware version as I did? I can update if needed...
    Jordi FARAUDO, 2017-03-21 12:46:08 -04:00
  6. setht
    setht Member Staff Member
    I'm glad to hear everything is working fine as far as the EV3 goes.

    I believe this aligns with what you are trying. I just flashed firmware V2.05 and the software 4.010 image to a microSD card. The values showed as you'd expect.

    setht, 2017-03-21 14:13:08 -04:00
  7. I see... So I am completely lost.
    What can I do? Flash a new SD card?
    Is there anything I can try?
    Jordi
    Jordi FARAUDO, 2017-03-21 14:38:15 -04:00
  8. setht
    setht Member Staff Member
    I you have a spare microSD card laying around I think that'd certainly a good thing to try.

    Just to check, you haven't modified PiStormsCom.py, mindsensors_i2c.py, 04-Motor-ShowPos.py or the PiStorms instance, correct?
    setht, 2017-03-21 14:45:34 -04:00
  9. True, I have not modified these programs.
    Maybe it can be a problem with I2C?
    Jordi
    Jordi FARAUDO, 2017-03-21 15:01:22 -04:00
  10. setht
    setht Member Staff Member
    From what I understand it's working for clockwise, so I2C has to be working in some regard. Sure though, try: sudo pip install --upgrade --force-reinstall mindsensors_i2c.

    I'd like to make sure the issue is clear. Is the following your observed behaviour?
    • Begin 04-Motor-ShowPos, motor encoder value is 0
    • Rotate clockwise a single rotation, encoder reads 360
    • Rotate anti-clockwise half a rotation, encoder reads 180
      • This would mean that problem isn't with the direction of the value, increasing or decreasing, but with the value being positive or negative
    • Continue rotating anti-clockwise half a rotation, encoder reads 0
    • Rotate a small amount anti-clockwise, reading jumps to over two billion, a negative number never appeared on screen
    setht, 2017-03-21 15:13:13 -04:00
  11. (You must log in or sign up to post here)

Log in | Sign up
Tems & Conditions!
Help!