GithubHelp home page GithubHelp logo

tqz / auto-targeting-turret Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomash1234/auto-targeting-turret

0.0 0.0 0.0 8 KB

Code used for this video: https://www.youtube.com/watch?v=S3CwzkT6cK4

License: MIT License

C++ 24.48% Python 75.52%

auto-targeting-turret's Introduction

Auto-Targeting Nerf Turret

Here is the code used to create this project https://www.youtube.com/watch?v=S3CwzkT6cK4

Youtube video

Note: This code is not perfect. I did not want to publish it, but I got many requests to share this code.

Hardware

See video

  • Wemos D1 Wifi
  • 3x Mini servo
  • Laser diod
  • Cheap webcam
  • Nerf pistol

Code

  • AutomaticGun/AutomaticGun.ino - Arudino code
  • PythonScripts/control.py - Communication between computer and turret
  • PythonScripts/camera.py (main) - Detecting target and laser dot, moving turret towards the target - Run this code
  • PythonScripts/manual_control.py - For debugging purpose, Moving turret using WSAD and enter to shoot

Detection & Targeting

  • The target must be a well visible fairly big circle
  • A circle is detected in the image, if center of circle is stable for few frames, turrets starts moving towards it
  • Laser dot should be small red dot
  • The script tries to get the laser dot into the circle
  • If the dot is inside the circle and close to the center for few frames, the trigger is pulled

Communication

  • Communication between computer and Wemos d1 is implemented using UDP packets, computer and Wemos must be connect to the same network
  • Every packet contains 3 bytes - [KEY=44, Action code, Value]
  • Rotate (yaw) - [44, 120, [angle in degrees 0-180]]
  • Pitch - [44, 88, [angle in degrees 0-180]]
  • Reset the trigger - [44, 44, 0]
  • Pull the trigger - [44, 44, 64]

Notes

  • key Q - quit
  • class Recorder in camera.py can be used for recording videos
  • Packages - Numpy and Opencv is required for this project

auto-targeting-turret's People

Contributors

tomash1234 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.