apssouza22 / smart-drone

This project leverage Machine learning/Computer vision to make a low-cost Drone smarter and autonomous.
MIT License
26 stars 9 forks source link

Pygame Crashes #4

Open aliiikz opened 1 year ago

aliiikz commented 1 year ago

Hi Alexsandro, Your project is awesome, but I have come across some problems regarding running the project

Environment: OS: Ubuntu 20.04 Python Version: 3.8.10 Pip Version: 22.3.1 Cuda: 11.0.3

Pip list:

Package                 Version
----------------------- -------------
absl-py                 0.15.0
aiohttp                 3.8.3
aiohttp-cors            0.7.0
aioice                  0.7.6
aiortc                  1.4.0
aiosignal               1.3.1
apturl                  0.5.2
asttokens               2.2.1
astunparse              1.6.3
async-timeout           4.0.2
attrs                   22.2.0
av                      10.0.0
backcall                0.2.0
bcrypt                  3.1.7
blinker                 1.4
Brlapi                  0.7.0
cachetools              5.3.0
certifi                 2019.11.28
cffi                    1.15.1
chardet                 3.0.4
charset-normalizer      2.1.1
chrome-gnome-shell      0.0.0
Click                   7.0
colorama                0.4.3
comm                    0.1.2
command-not-found       0.3
ConfigArgParse          1.2.3
contourpy               1.0.7
cryptography            39.0.0
cupshelpers             1.0
cycler                  0.11.0
dataclasses             0.6
dbus-python             1.2.16
debugpy                 1.6.4
decorator               5.1.1
defer                   1.0.6
distlib                 0.3.6
distro                  1.4.0
distro-info             0.23ubuntu1
djitellopy              1.5
dnspython               2.3.0
duplicity               0.8.12.0
entrypoints             0.3
evdev                   1.6.1
executing               1.2.0
fasteners               0.14.1
filelock                3.8.2
flatbuffers             23.1.21
fonttools               4.38.0
frozenlist              1.3.3
future                  0.18.2
gast                    0.3.3
google-auth             2.16.0
google-auth-oauthlib    0.4.6
google-crc32c           1.5.0
google-pasta            0.2.0
grpcio                  1.32.0
h5py                    2.10.0
httplib2                0.14.0
idna                    2.8
importlib-metadata      6.0.0
ipykernel               6.19.4
ipython                 8.7.0
jedi                    0.18.2
jupyter_client          7.4.8
jupyter_core            5.1.0
Keras-Preprocessing     1.1.2
keyring                 18.0.1
kiwisolver              1.4.4
language-selector       0.1
launchpadlib            1.10.13
lazr.restfulclient      0.14.2
lazr.uri                1.0.3
lockfile                0.12.2
louis                   3.12.0
macaroonbakery          1.3.1
Mako                    1.1.0
Markdown                3.4.1
MarkupSafe              2.1.2
matplotlib              3.6.3
matplotlib-inline       0.1.6
mediapipe               0.9.0.1
monotonic               1.5
multidict               6.0.4
nest-asyncio            1.5.6
netifaces               0.10.4
numpy                   1.19.3
oauthlib                3.1.0
olefile                 0.46
opencv-contrib-python   4.7.0.68
opencv-python           4.7.0.68
opt-einsum              3.3.0
packaging               22.0
paramiko                2.6.0
parso                   0.8.3
pexpect                 4.6.0
pickleshare             0.7.5
Pillow                  7.0.0
pip                     22.3.1
platformdirs            2.6.0
prompt-toolkit          3.0.36
protobuf                3.20.3
psutil                  5.9.4
pure-eval               0.2.2
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pycairo                 1.16.2
pycparser               2.21
pycups                  1.9.73
pyee                    9.0.4
pygame                  2.1.2
Pygments                2.13.0
PyGObject               3.36.0
PyJWT                   1.7.1
pylibsrtp               0.8.0
pymacaroons             0.13.0
PyNaCl                  1.3.0
pynput                  1.7.6
pyOpenSSL               23.0.0
pyparsing               3.0.9
pyRFC3339               1.1
python-apt              2.0.1
python-dateutil         2.8.2
python-debian           0.1.36ubuntu1
python-xlib             0.33
pytz                    2019.3
pyxdg                   0.26
PyYAML                  5.3.1
pyzmq                   24.0.1
reportlab               3.5.34
requests                2.22.0
requests-oauthlib       1.3.1
requests-unixsocket     0.2.0
rsa                     4.9
screen-resolution-extra 0.0.0
SecretStorage           2.3.1
setuptools              45.2.0
simple-pid              1.0.1
simplejson              3.16.0
six                     1.15.0
stack-data              0.6.2
systemd-python          234
tellopy                 0.6.0
tensorboard             2.11.2
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
tensorflow              2.4.1
tensorflow-estimator    2.4.0
termcolor               1.1.0
tornado                 6.2
traitlets               5.8.0
typing-extensions       3.7.4.3
ubuntu-advantage-tools  27.12
ubuntu-drivers-common   0.0.0
ufw                     0.36
ujson                   5.7.0
unattended-upgrades     0.1
urllib3                 1.25.8
usb-creator             0.3.7
vboxapi                 1.0
virtualenv              20.17.1
wadllib                 1.3.3
wcwidth                 0.2.5
Werkzeug                2.2.2
wheel                   0.38.4
wrapt                   1.12.1
xkit                    0.0.0
yarl                    1.8.2
youtube-dl              2021.12.17
zipp                    3.11.0
  1. When I run pip3 install -r requirements.txt it gives me this error: Output:

    ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
    ERROR: No matching distribution found for cv2

    Solution: When I remove cv2 from requirements file the problem was resolved. cv2 requires opencv-python which you have included in requirements file

  2. When I run python3 main.py it gives me this error: output:

    pygame 2.1.2 (SDL 2.0.16, Python 3.8.10)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    Starting mocked drone
    _channels_used 0
    _channels_used 1
    INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
    [ WARN:0@1.572] global /io/opencv/modules/videoio/src/cap_v4l.cpp (889) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
    0 0 0 0

    My Solution: It because there are two VideoCapture on the project, to resolve this issue i commented self.cap = cv2.VideoCapture(0) in the video.py, line 8 and the problem went away. but I have no Idea if this is one of the reasons for pygame not working. the ouput:

    pygame 2.1.2 (SDL 2.0.16, Python 3.8.10)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    Starting mocked drone
    _channels_used 0
    _channels_used 1
    INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
    0 0 0 0
  3. the pygame window comes up but it doesn't work, after couple of seconds it gives me this: Screenshot from 2023-01-27 16-18-38

This is the part where i got stuck. It crashes and tells me to force quit. Also I have a Dji Tello, but I have not tested it on my drone.

JaeMyoungKIM commented 1 year ago

Hi Alexsandro and Ali, Thank you for your awesome projects. I have tried to run your programs, but I have a problem.

I can't see 'My image window' because of the stuck in cv2.imshow('My image', frame). How can I solve this problem?

Monk drone and a Tello drone have same symthom.

Any ideas or clues would be greatly appreciated.

From Brion KIM

apssouza22 commented 1 year ago

Hi @aliiikz I have removed the cv2 dependency. Thx

Regarding your camera problem, it seems to be something on your computer since it works fine for me(Mac). I suggest you try to create another project and play with cv2 and your camera. It should be very simple. Once you manage to run it on another project, you can bring the learning and adjust it to this project

apssouza22 commented 1 year ago

@JaeMyoungKIM I suggest you do the same. Make sure you can make cv2 and the camera work than try o fix it in the project

JaeMyoungKIM commented 1 year ago

@apssouza22 I had installed your requirements without cv2. cv2 is not a python package. Isn't cv2 interchangeable with opencv-python? I have tried to use opencv-python version 3.x and recent 4.x, but they have the same above problem. Please let me know how to make cv2. I am going to run your code on Mac. Thank you very much. From Brion KIM

apssouza22 commented 1 year ago

Yeah. It requires both. Opencv-python is just a python wrapper for opencv. Opencv is written in C and need to be installed. Please search how to install opencv/cv2 for your environment. How I said before, create another project and make sure you have opencv working on your laptop.

JaeMyoungKIM commented 1 year ago

Thank you very much for your kind guidelines. I couldn't run in Mac because of my old iOS version, but I succeeded in running with anaconda environment.

sree3333 commented 1 year ago

Thank you very much for your kind guidelines. I couldn't run in Mac because of my old iOS version, but I succeeded in running with anaconda environment.

Hi @JaeMyoungKIM @apssouza22 , could you please let me know how it worked for you? I am trying to run it on windows but its not getting the video feed. While if I run a simple separate code for video feed from the drone it is working. It is just not working in the project.

JaeMyoungKIM commented 1 year ago

As I remember, opencv installed in ubuntu did not work normally. When I tried it in the Anaconda environment, it worked normally.

JaeMyoung KIM

2023년 6월 7일 (수) 오후 9:30, sree3333 @.***>님이 작성:

Thank you very much for your kind guidelines. I couldn't run in Mac because of my old iOS version, but I succeeded in running with anaconda environment.

Hi @JaeMyoungKIM https://github.com/JaeMyoungKIM @apssouza22 https://github.com/apssouza22 , could you please let me know how it worked for you? I am trying to run it on windows but its not getting the video feed. While if I run a simple separate code for video feed from the drone it is working. It is just not working in the project.

— Reply to this email directly, view it on GitHub https://github.com/apssouza22/smart-drone/issues/4#issuecomment-1580719375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEMGL7NFIRXQYNWVU2ECVTXKBX6XANCNFSM6AAAAAAUIVRHKE . You are receiving this because you were mentioned.Message ID: @.***>

--

김재명 연구전문위원/공학박사

초지능창의연구소/모빌리티로봇연구본부/울산지능화융합연구실

ETRI

010-9413-4286 (울산 052-240-3021, 대전 042-860-5042)

@. @.> / @.** **@.> / **@. @.>*