PID Controlled Ping Pong Ball Juggling Robot With 90FPS Realtime Image Processing

  Рет қаралды 31,309

Electron Dust

Electron Dust

7 жыл бұрын

This is a Raspberry Pi Ping Pong Juggling Robot. This time it doesn't use a plate but a real ping pong racket. I use Nema17 stepper motors for the movements. I bought some belt drive components and ball bearings. I used those to convert the axial motion of the steppers into linear motion. It's the same setup as in an inkjet printer.
The main controller of this project is a Raspberry Pi 2. It has a Raspberry Pi camera module NoIR connected to it. Because it is NoIR, there's no IR filter on the thing. I originally planned to use infrared light to brighten up the ball in front of the camera. But it didn't work well. The IR elements I used were way to weak. The infrared noise in the background (sunlight etc.) would overweight the infrared light getting reflected from the ball. Another problem was, that the IR signal gets picked up on the red-channel of the camera. This means that even if there is no infrared noise from sunlight, the infrared light's intensity still has to surpass the normal red light's intensity to be recognizable. So that idea got dropped. I ended up using the green-channel on the camera with green light from a RGB Power LED pointed at the ping pong ball. Sure enough, normal white light would've done the job as well, but I just happened to have a RGB LED laying around so I ended up with green.
Another important thing is this: You might be asking yourself "Why did you use a light source anyway? Couldn't you just use OpenCV and get the thing to recognize the white ball with normal lightning conditions?". The answer to this is: Probably not. At least not with a Raspberry Pi 2. The reason being that we need 90 fps real-time image processing to track that ball. The image processing has to be done fast. I didn't really use OpenCV for anything at this Point in time but my guess is, that it wouldn't work well, because I don't think I could get the processing rate up to 90 fps with OpenCV. Maybe I am wrong about this, but it was my gut feeling, so I went on to program a really simple algorithm that could take care of the image data really fast. The algorithm looks directly at the data stream, so no conversion to a different datatype (e.g. NumPy) is needed. This is one reason this algorithm is quite fast. The other reason is, of course, that it is a dumb algorithm. All it does is look for a clump of bright green pixels on a fairly black background and then compute the center of it.
After the algorithm extracted 3D coordinates out of the images it examines that data and, in the case the ball is going downwards and gets quite near to the racket, it uses that specific data set in a PID controller to get some useful correction values on the racket as the ball is moving towards it (the machine tries to get the ball into the center of the racket). The movement values are then sent to the Arduino Uno over the serial port. The Arduino Uno runs grbl (a program for running stepper motors very efficiently) and all it does most of the time is waiting for some new instructions from it's master; The Raspberry Pi.
Some lines about the tilting mechanism: The tilt in the racket is produced by different heights of the 3 belts on which the racket is mounted. The joint "belt to racket" is a rather elastic one. This is why a tilted racket can be accomplished without ruining the joints or other parts of the machine.
It's worth mentioning that the thing isn't working perfectly at all. A 2 hour juggling session is definitely not one of the things this machine is capable of doing. It is able to juggle the ball for about 2 mins. Then it makes some misjudgment and the ball drops. So it isn't great. But then again: It only uses one single camera to compute 3D coordinates of a flying object. using 2 cameras would improve the performance. But it would also make the thing more complicated.
The Stepper motors are Nema17 Steppers! It Also uses an Arduino Uno with Arduino CNC-Shield.
The Arduino Stepper Motor Controller uses the great grbl software! here a link:
github.com/grbl/grbl
And here's the complete Raspberry Pi source code (Python3):
github.com/T-Kuhn/PingPongPi
And here's a blog post about the thing:
electrondust.com/2017/10/28/t...
Music:
"Covered In Oil" by Broke For Free
www.brokeforfree.com

Пікірлер: 24
@pinolux21
@pinolux21 3 жыл бұрын
You are an excellent electronic, mathematician and programmer. Congratulations incredible what you achieved !!
@Peter-sj6yn
@Peter-sj6yn 7 жыл бұрын
Nice Video! I like the way the bounce height varies.
@ElectronDust
@ElectronDust 7 жыл бұрын
Thanks Peter!
@KulbirAhluwalia
@KulbirAhluwalia 5 жыл бұрын
Holy Table Tennis! Damn!
@thezone363
@thezone363 7 жыл бұрын
this is sick I might want to try this for a group project with some friends
@MrKnutriis
@MrKnutriis 4 жыл бұрын
thezone363 how did it go?
@helxsz
@helxsz 7 жыл бұрын
wonderful work !!!
@ElectronDust
@ElectronDust 7 жыл бұрын
Thank you!
@OussamaOusmoi
@OussamaOusmoi 7 жыл бұрын
Awesome !
@3bschool995
@3bschool995 4 жыл бұрын
Nice bro keep going.
@demej00
@demej00 5 жыл бұрын
Great project. Would be interesting to use a machine learning algorithm and see if it can break that 2 min barrier.
@ElectronDust
@ElectronDust 5 жыл бұрын
There sure is room for improvement. Although I am a bit worried about the data. I've got a feeling that the problem isn't so much the controlling algorithm (in this case it is a PID controller), but rather the data being too rough.
@revimfadli4666
@revimfadli4666 4 жыл бұрын
@@ElectronDust what about machine learning to un-rough the data?
@pedrorafaelvidalarias6517
@pedrorafaelvidalarias6517 7 жыл бұрын
Great video! I would like to see this on your robotic arm.
@ElectronDust
@ElectronDust 7 жыл бұрын
Hey Pedro! The robot arm is way to weak to hold that racket. ^^
@pedrorafaelvidalarias6517
@pedrorafaelvidalarias6517 7 жыл бұрын
Yes but if a larger robotic arm is used so that it could manipulate the racket. Would it be possible?
@ElectronDust
@ElectronDust 7 жыл бұрын
Yes. I think there are some people doing that here on KZbin. If you use an industrial robot arm it shouldn't be a problem at all. ^^
@pedrorafaelvidalarias6517
@pedrorafaelvidalarias6517 7 жыл бұрын
I see. I hope you upload more videos about this. Excellent work. Thank you!
@ElectronDust
@ElectronDust 7 жыл бұрын
Oh. Thank you! Glad you like it.
@ipadize
@ipadize 5 жыл бұрын
1900: We will have flying Cars in the future! now:...
@Chris-bg8mk
@Chris-bg8mk 4 жыл бұрын
What language did you code it in? C? Assembly?
@user255
@user255 4 жыл бұрын
Python.
@user-ks8qn5sz5b
@user-ks8qn5sz5b 8 ай бұрын
In your Arduino code there are so many code we can't understand how you juggling the platform . in your readme file, it is also not mention that how to approch your code, can you please send me code of arduino because we are building same thing for our courser project
@indiarobotschool9680
@indiarobotschool9680 4 жыл бұрын
Bro where u study help
The Octo-Bouncer: Advanced Bouncing Patterns
4:59
Electron Dust
Рет қаралды 351 М.
Getting Started with Image Processing
13:08
MATLAB
Рет қаралды 76 М.
Heartwarming: Stranger Saves Puppy from Hot Car #shorts
00:22
Fabiosa Best Lifehacks
Рет қаралды 19 МЛН
Каха ограбил банк
01:00
К-Media
Рет қаралды 11 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 170 #shorts
00:27
I tried OVERPOWERING my Vacuum! (Homemade Turbine)
11:42
GreatScott!
Рет қаралды 1,8 МЛН
Ping Pong Inventions that are on the Next Level
9:21
Pongfinity
Рет қаралды 2,5 МЛН
Что не так с электрофорной машиной?
32:47
Павел Gen
Рет қаралды 120 М.
The Octo-Bouncer
4:26
Electron Dust
Рет қаралды 4,8 МЛН
COMMUNISM vs CAPITALISM: Who Made Better Power Tools?
24:39
The Doubtful Technician
Рет қаралды 561 М.
PID Controlled Ping Pong Ball juggling Robot
3:00
Electron Dust
Рет қаралды 71 М.
These Keys Shouldn't Exist | Nostalgia Nerd
19:32
Nostalgia Nerd
Рет қаралды 644 М.
Ball on plate control
4:50
TS 177
Рет қаралды 28 М.
The Cubli: a cube that can jump up, balance, and 'walk'
2:37
Gajamohan Mohanarajah
Рет қаралды 15 МЛН
Что еще за съемные фронталки от Vivo? #vivo
0:41
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1 МЛН
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
ЗЕ МАККЕРС
Рет қаралды 176 М.
Как слушать музыку с помощью чека?
0:36