Skip to content

ev3dev Buttons wait_for_bump #584

Closed
Closed

Description

@dickric

Hello,

how can I use the Objekt "wait_for_bump" in the Button Class.
I become the following Errormessage.

Wait for Bump
Traceback (most recent call last):
File "test.py", line 22, in
btnb.wait_for_bump(left, 500)
File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 203, in wait_for_bump
if self.wait_for_pressed(buttons, timeout_ms):
File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 191, in wait_for_pressed
return self._wait(buttons, [], timeout_ms)
File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 168, in _wait
for event in self.evdev_device.read_loop():
File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 122, in evdev_device
if device.name == self.evdev_device_name:
AttributeError: 'ButtonBase' object has no attribute 'evdev_device_name'

                  • MobaXterm 11.0 •                          │
 │            (SSH client, X-server and networking tools)             │
 │                                                                    │
 │ ➤ SSH session to robot@192.168.137.3                               │
 │   • SSH compression : ✔                                            │
 │   • SSH-browser     : ✔                                            │
 │   • X11-forwarding  : ✘  (disabled or not supported by server)     │
 │   • DISPLAY         : 192.168.2.152:0.0                            │
 │                                                                    │
 │ ➤ For more info, ctrl+click on help or visit our website           │
 └────────────────────────────────────────────────────────────────────┘

Linux ev3dev 4.14.61-ev3dev-2.2.2-ev3 #1 PREEMPT Mon Aug 6 14:22:31 CDT 2018 armv5tejl
_____ _
_____ |__ / | | _____ __
/ _ \ \ / / |
\ / ` |/ _ \ \ / /
| __/\ V / ) | (| | /\ V /
_| _/ |
/ _,_|_
_| _/

Debian stretch on LEGO MINDSTORMS EV3!
Last login: Tue Aug 7 08:30:48 2018 from 192.168.137.2
robot@ev3dev:~$

Thanks

Activity

  1. ndward commented on Dec 29, 2018

    @ndward

    I also continue to have problems with wait_for_bump, wait_for_pressed and wait_for_released. For example this script (launched from VS Code):

    #!/usr/bin/env python3
    from ev3dev2.button import Button
    from ev3dev2.sound import Sound
    
    btn = Button()
    sound = Sound()
    
    btn.wait_for_bump('left')  # Is this line correct?
    sound.beep()
    

    gives this error:
    Traceback (most recent call last):
    File "/home/robot/park/wait_for_bump.py", line 13, in
    btn.wait_for_bump('left')
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 203, in wait_for_bump
    if self.wait_for_pressed(buttons, timeout_ms):
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 191, in wait_for_pressed
    return self._wait(buttons, [], timeout_ms)
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 168, in _wait
    for event in self.evdev_device.read_loop():
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 125, in evdev_device
    raise Exception("%s: could not find evdev device '%s'" % (self, self.evdev_device_name))
    Exception: Button: could not find evdev device 'EV3 brick buttons'

  2. dwalton76 commented on Mar 24, 2019

    @dwalton76
    Collaborator

    @dickric can you post your test.py code? wait_for_bump on an EV3 is working for me.

  3. dwalton76 commented on Mar 24, 2019

    @dwalton76
    Collaborator

    I also continue to have problems with wait_for_bump, wait_for_pressed and wait_for_released. For example this script (launched from VS Code):

    #!/usr/bin/env python3
    from ev3dev2.button import Button
    from ev3dev2.sound import Sound
    
    btn = Button()
    sound = Sound()
    
    btn.wait_for_bump('left')  # Is this line correct?
    sound.beep()
    

    gives this error:
    Traceback (most recent call last):
    File "/home/robot/park/wait_for_bump.py", line 13, in
    btn.wait_for_bump('left')
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 203, in wait_for_bump
    if self.wait_for_pressed(buttons, timeout_ms):
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 191, in wait_for_pressed
    return self._wait(buttons, [], timeout_ms)
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 168, in _wait
    for event in self.evdev_device.read_loop():
    File "/usr/lib/python3/dist-packages/ev3dev2/button.py", line 125, in evdev_device
    raise Exception("%s: could not find evdev device '%s'" % (self, self.evdev_device_name))
    Exception: Button: could not find evdev device 'EV3 brick buttons'

    @ndward are you still seeing this? If so what if you remove VS Code from the picture? I am able to run your script on an EV3, it works as expected.

  4. ndward commented on Mar 24, 2019

    @ndward

    I'm no longer having this problem (launching from VS Code). I'm using kernel 4.14.96-ev3dev-2.3.2-ev3. Thanks to whoever fixed it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions