Skip to content

tank.turn_degrees throwing an error #717

Closed

Description

@kpu979

mtank.turn_degrees(20,90)
File "/home/robot/ev3dev-lang-python/ev3dev2/motor.py", line 2267, in turn_degrees
speed_native_units = speed.to_native_units(self.left_motor)
AttributeError: 'int' object has no attribute 'to_native_units'

  • **ev3dev version: 4.14.117-ev3dev-2.3.4-ev3
  • **ev3dev-lang-python version:
    +++-====================================-=======================-=======================-==============================================================================
    ii micropython-ev3dev2 2.0.0 all Python language bindings for ev3dev for MicroPython
    ii python3-ev3dev 1.2.0 all Python language bindings for ev3dev
    ii python3-ev3dev2 2.0.0 all Python language bindings for ev3dev

Activity

  1. WasabiFan commented on Jan 19, 2020

    @WasabiFan
    Member

    @dwalton76 this looks like a bug in the gyro drive methods; they assume a speed unit class rather than defaulting to percent if a number is given.

    Side-note: I think this comment line has a typo: https://github.com/ev3dev/ev3dev-lang-python/blob/ev3dev-stretch/ev3dev2/motor.py#L2279

    @kpu979 Sorry! As a workaround, you should use a "speed unit" class (https://ev3dev-lang.readthedocs.io/projects/python-ev3dev/en/ev3dev-stretch/motors.html#units). In your case, this would look like:

    mtank.turn_degrees(SpeedPercent(20),90)
    

    I should also warn you -- since you cloned the repository and are using your local copy from our development branch, there are changes in your version which aren't in past or future releases. Just a heads-up.

  2. WasabiFan commented on Jan 19, 2020

    @WasabiFan
    Member

    Looks like you already know: #715 (comment)

  3. self-assigned this
    on Jan 20, 2020
  4. kpu979 commented on Feb 23, 2020

    @kpu979
    Author

    Hi, Here's another related bug:

    When I do this:

        mtank.follow_gyro_angle(
            kp=11.3, ki=0.05, kd=3.2,
            speed=SpeedPercent(30),
            target_angle=0,
            follow_for=follow_for_ms,
            ms=4500)
    

    I get this:

      File "/home/robot/ev3dev-lang-python/ev3dev2/motor.py", line 2179, in follow_gyro_angle
        assert speed_native_units <= MAX_SPEED, "Speed exceeds the max speed of the motors"
      File "/home/robot/ev3dev-lang-python/ev3dev2/motor.py", line 101, in __ge__
        return self.to_native_units() >= other.to_native_units()
    AttributeError: 'float' object has no attribute 'to_native_units'
    
  5. WasabiFan commented on Mar 15, 2020

    @WasabiFan
    Member

    @dwalton76 Did you get a chance to look at these issues? Are they solved by #724?

    I can try to get these things resolved today or otherwise soon before I publish a release.

  6. WasabiFan commented on Mar 23, 2020

    @WasabiFan
    Member

    I believe this is fixed in the 2.1.0 release. @kpu979 would you be able to confirm this is fixed?

  7. dwalton76 commented on Mar 23, 2020

    @dwalton76
    Collaborator

    sorry just saw this...it should be fixed via #724

  8. kpu979 commented on Mar 23, 2020

    @kpu979
    Author

    @WasabiFan -- I'd be happy to validate this issue.

    to ensure I have the correct versions on my mac and EV3:
    IN VS Code on my Mac (Im running in a virtual environment) -- console:
    $ pip install python-ev3dev2 (do I use the --upgrade tag?)

    Is there a better way to load EV3dev on the EV3 without refreshing the card?

  9. dlech commented on Mar 23, 2020

    @dlech
    Member

    Is there a better way to load EV3dev on the EV3 without refreshing the card?

    1. make sure the EV3 is connected to the internet with USB or Wi-Fi
    2. open an SSH terminal to the EV3
    3. run sudo apt update && sudo apt upgrade
  10. kpu979 commented on Apr 5, 2020

    @kpu979
    Author

    Sorry it took this long to get back to you. I've never been busier for my work.

    I finally got everything updated and tweaked, and this works!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions