Giter Club home page Giter Club logo

ping-pong's Introduction

#Ping Pong

This is an implementation for a robot to play ping pong.

###Overview of program This program uses a webcam to track movement of items of a selected color (default is red). It will then decide what area is moving the most, and tell the robotic arms where to go.

There are two dots that jump around the output feed: a green dot and a white dot. The green dot is where the program thinks the most motion (for the chosen color) is. The white dot is a little more conservative than the green dot, in that it won't move too far at a time. This is for possible sanity checks for where the object being tracked could be, because the object can only move so far at a time.

There are also a couple gray lines. These represent the linear actuators that the robot uses. These are what will position the ping pong paddle (the blue dot). On the Raspberry Pi, the frame rate is slow enough that it simulates where the arms are. On a computer, the frame rate is too high and the arms will jump all over.

###Running the program To run this program, run testDependencies.py to check that all the required libraries are installed (see Dependencies for more details). If that works, then run pingpong.py. This will begin the program, defaulting to motion detection of red objects. See Supported Colors for more information.

###Supported Colors: The following eight colors are supported:

  • Red, orange, and yellow are easily seen, but have a fair amount of noise and overlap.
  • Blue and aqua work fairly well.
  • Purple and pink detection can depend on the lighting.
  • Green color detection doesn't work too well, except for light green.

Use the first letter of a color to select it for color detection. Pink is selected with 'i'.

###Dependencies This program uses python 2.7. Please make sure you're using the correct version. You can check this with python -V or python --version. The following libraries are required to run this program.

  • opencv: This is the image processing library. This is central to the program.
  • numpy: This works with opencv.
  • time and math: These are general libraries for the program.
  • RPi.GPIO: This is a library for running the program on a Raspberry Pi, which is the hardware side of the project. If this is not installed, the program will run in simulation mode.

Time and math should be installed already on linux.

To install opencv and numpy on linux, run sudo apt-get install -y python-numpy python-opencv.

ping-pong's People

Contributors

asinck avatar thislsausername avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Sam Friedman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.