ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
422 stars 146 forks source link

automaticaddison robot #773

Open jrrobb85 opened 3 years ago

jrrobb85 commented 3 years ago

I am trying to control my automaticaddison robot with Wiimote controller. I have followed instructions to install cwiid library but when I operate the code to remote control I get the following error message.

pi@raspberrypi:~/robot $ python3 remote_control.py
Traceback (most recent call last):
  File "remote_control.py", line 2, in <module>
    import cwiid
ModuleNotFoundError: No module named 'cwiid'

When I delete the "import cwiid" i then get the error message as follows.

pi@raspberrypi:~/robot $ python3 remote_control.py
Press and hold the 1+2 buttons on your Wiimote simultaneously
Traceback (most recent call last):
  File "remote_control.py", line 5, in <module>
    wii = cwiid.Wiimote()
NameError: name 'cwiid' is not defined

The Wiimote controller is paired with the Raspberry Pi.

Can you help an 88 year old who is trying to keep the little grey cells working?

dlech commented 3 years ago

I would try to pair the Wimote like this: https://wiki.archlinux.org/title/XWiimote#Connect_the_Wii_Remote

Then just use the generic Linux input system instead of cwiid.

jrrobb85 commented 3 years ago

Hi David, Many thanks for responding to my cry for help. Unfortunately your solution didn’t work. My Wiimote is paired with the Rasspberry Pi, listed as an RVL-CNT-01. I am following automaticaddison’s article on building a robot. The code is as follows for using the Wiimote control.

import gpiozero import cwiid

robot = gpiozero.Robot(left=(17,18), right=(27,22))

print("Press and hold the 1+2 buttons on your Wiimote simultaneously") wii = cwiid.Wiimote() print("Connection established") wii.rpt_mode = cwiid.RPT_BTN

while True: buttons = wii.state["buttons"]

          if (buttons & cwiid.BTN_LEFT):
                         robot.left()
          if (buttons & cwiid.BTN_RIGHT):
                         robot.right()
          if (buttons & cwiid.BTN_UP):
                         robot.forward()
          if (buttons & cwiid.BTN_DOWN):
                         robot.backward()
          if (buttons & cwiid.BTN_B):
                         robot.stop()

@.:~/robot $ python3 remote_control.py Traceback (most recent call last): File "remote_control.py", line 2, in import cwiid ModuleNotFoundError: No module named 'cwiid' @.:~/robot $

Connection will not be established. I have gone through the process for installing the cwiid library as follows. sudo apt-get install bison flex automake libbluetooth-dev aclocal autoconf ./configure make

Any other suggestions? Regards, Jim Robb.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

+

From: David @.> Sent: 23 May 2021 20:50 To: @.> Cc: @.>; @.> Subject: Re: [ev3dev/ev3dev-lang-python] automaticaddison robot (#773)

I would try to pair the Wimote like this: https://wiki.archlinux.org/title/XWiimote#Connect_the_Wii_Remote

Then just use the generic Linux input system instead of cwiid.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ev3dev/ev3dev-lang-python/issues/773#issuecomment-846615326, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKWQZT2EYC44YBQ3UGZNIO3TPFMCBANCNFSM45LQODKQ.

GrahamSH-EXB commented 3 years ago

Since cwiid is a pip library, you should ssh into the robot (using vscode) and run pip install cwiid. Then try running your program

jrrobb85 commented 3 years ago

Hi Graham, Many thanks for your effort to help solve this problem. Unfortunately this also did not work. I attach a snip of the result for your info. Regards, @.***D7727D.47900BE0]

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: @.> Sent: 05 July 2021 20:39 To: @.> Cc: @.>; @.> Subject: Re: [ev3dev/ev3dev-lang-python] automaticaddison robot (#773)

Since cwiid is a pip library, you should ssh into the robot (using vscode) and run pip install cwiid. Then try running your program

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ev3dev/ev3dev-lang-python/issues/773#issuecomment-874298287, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKWQZT2EPSDDXANIXWQ7M5LTWIC7ZANCNFSM45LQODKQ.