amhsrobotics4681 / 2020-First-Rise

File Repoitory for 2020 First Robotics 4681 Team
1 stars 0 forks source link

Vision Tracking #2

Closed cmarley3-14 closed 4 years ago

cmarley3-14 commented 4 years ago

Guide to posting: Just paste links with a brief description of what help it provides.

https://github.com/Wesley-Karkiewicz/6060-Snake-Eyes
This team successfully implemented a tracking system that coordinates between the RasberryPi and the driver station. Something I might note is the use of NetworkTables in the Python code (RasberryPi subfolder) and the java code (Auto_V1 subfolder).

cmarley3-14 commented 4 years ago

https://www.chiefdelphi.com/t/best-method-for-vision/161417/9 A step by step on cv vision programming in Python. Nothing that's already been done, but it provides some background info that I found helpful.

cmarley3-14 commented 4 years ago

It looks like NetworkTables is the way to go. Connect the RPi to the radio, via Ethernet, and send data to the roboRIO. Programs that do a sort of vision tracking already exist, so we may not need to "reinvent the wheel" so to speak. We need the RPi ASAP though, or else all falls to pieces...

https://docs.wpilib.org/en/latest/docs/software/vision-processing/raspberry-pi/index.html ^ FRC docs for RaspberryPi vision processing.

https://github.com/MRT3216/MRT3216-2019-DeepSpace/blob/master/Vision/ChickenVision.py#L351 https://github.com/team3997/ChickenVision ^^ Reflective Tape specific vision tracking (possibly deprecated) ^ Team that developed vision tracking with openCV stuff. the pdf is a nice read

https://opensight-cv.github.io/ https://chameleon-vision.readthedocs.io/en/latest/getting-started/robot-code-example.html ^ other vision processing programs

sprice134 commented 4 years ago

http://programming.sdarobotics.org/more/raspberry-pi-vision-processing/ Arguably a better way to go about it, but entirely someone else's and I have no idea how it works cuz its an entire raspberry pi image not a program

sprice134 commented 4 years ago

I agree we need the raspberry PI asap. I will talk to Knox but I have one I will bring in if we still don't have it, the other issue is a monitor I was thinking about just setting up SSH on it which would solve some of the issues

sprice134 commented 4 years ago

Using Screen: Install Raspbian Connect to monitor, internet, keyboard and mouse Open terminal and enter: sudo rm -rf LCD-show git clone https://github.com/goodtft/LCD-show.git chmod -R 755 LCD-show cd LCD-show/ sudo ./MHs35-show

https://www.okdo.com/gettingstartedpi4/ Boot Raspberry Pi, Open Raspberry Pi Configuration Tool from Main menu and enable camera module

cmarley3-14 commented 4 years ago

https://stackoverflow.com/questions/33068758/what-is-the-difference-between-pip-install-and-sudo-pip-install

https://github.com/jrosebr1/imutils/issues/39
sudo -H pip3 install imutils is a suggestion given above.
Ignore the workon stuff because we aren't using a virtual environment as far as I know.
repeated similarly in https://www.raspberrypi.org/forums/viewtopic.php?t=86694 with sudo pip-3.X install XXXXXXXX

https://www.raspberrypi.org/forums/viewtopic.php?t=78921
Suggests that we should take the downloaded file in the Python2.7 file and move it to the Python3 file
https://www.raspberrypi.org/documentation/linux/usage/commands.md
^ Would be cp FILELOCATION_A FILELOCATION_B rather than using the mv command. Last resort.

Do we need the frcvision image or can we just run the program raw on the rpi and send stuff over networktables?

cmarley3-14 commented 4 years ago

example of pip
Just something I did at home to work with the Python. Notice how both pip and pip3 both work as commands.
Food for thought

sprice134 commented 4 years ago

IMPORTANT SOLUTION https://docs.wpilib.org/en/latest/docs/software/vision-processing/introduction/cameraserver-class.html

cmarley3-14 commented 4 years ago

to help with rewriting vision tracking python program

We don't need picamera module because WPILib provides a library for it. See the two (unstruck) links below.
(Source: camera = cs.UsbCamera("usbcam", 0) https://github.com/wpilibsuite/FRCVision-pi-gen/issues/128) https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/

Provides example code of how to create a Python camera input program when running FRCVision. It may as well be helpful to copy and paste a lot into the already developed ball_tracking.py program. https://github.com/wpilibsuite/FRCVision-pi-gen/releases/download/v2020.2.1/python-multiCameraServer.zip

Code that another team developed that initializes a camera. https://github.com/Wesley-Karkiewicz/6060-Snake-Eyes/blob/master/RaspberryPi/Python/Ball_Tracking_on_Pi.py#L227-L232

Search results for a few many other worries (mostly involving USB cam). In the likely event we keep failing, whelp.: https://www.chiefdelphi.com/search?q=raspberry%20pi%20usb%20camera%20code