Code Monkey home page Code Monkey logo

turret's Introduction

Some notes


MODULE 1 (WEB)

Simple web app which serves as a controls interface to interact with MODULE 2 (TURRET). User can aim turret with mouse x,y and fire with LMB. Also displays video feed from MODULE 2 (TURRET) IN: User input < from USER OUT: User input > to MODULE 2 (TURRET)

[Client]

Client facing portion, SPA. Let user authenticate. If user authenticated: send user input to server + receive video stream from server. JS: Angular2 framework

Purposes:

  • View feed from turret
  • Interactive turret control
    • X,Y mouse movements (canvas mouse lock)
    • Set manual mode: controlled by user
    • Set auto mode: controlled by MODULE 3 (NEURAL NET) (later)
  • Depending on auth
    • Public: No access (to save bandwidth)
    • Authorized: View and control

[Static/API/WS Server]

Authenticate user. Guard API routes from unauthorized access. Receive and sanitize user input from client. Forward commands to MODULE 2 (TURRET). Receive video stream from MODULE 2 (TURRET) and upload to client. D: vibe.d HTTP/WS framework

Purposes:

  • Serve static content (compiled client bundles)
  • Authentication
    • Don't want randos staring at my backyard and controlling an airsoft turret
  • Session management
  • Sanitize user input commands received from client and forward to MODULE 2 (TURRET)
  • Serve cam feed from MODULE 2 (TURRET) (WebSocket?)

[Database]

MongoDB

Purposes:

  • Store user credentials
  • Store sessions

MODULE 2 (TURRET)

Electronically controlled turret with mounted airsoft gun. 3D printed frame. Powered by Raspberry Pi + Arduino. Rotation controlled by 2 NEMA 17 stepper motors (may need something with more holding torque). Trigger switch actuated with relay. Receives control commands from MODULE 1 (WEB) to control turret. Receives control commands from either MODULE 1 (WEB) or MODULE 3 (CV / NEURAL NETWORK) to control turret (depending if manual or auto mode). IN: User input < from MODULE 1 (WEB) OUT: Video stream > to MODULE 1 (WEB)

[Raspberry Pi]

Background application running on RPi which accepts input values from MODULE 1 (WEB) via IPC. Sends commands to Arduino via USB serial connection in format defined below in Arduino section. Python

Purposes:

  • Receive commands from MODULE 1 (WEB)
    • X,Y acceleration values
    • Fire
  • Send commands to Arduino
  • Send webcam feed to MODULE 1 (WEB)
  • Act as “network bridge” between Arduino and MODULE 1 (WEB)
    • Cheaper, easier than connecting an Arduino to the internet.
    • May run into minor latency issues because not realtime OS

[Arduino]

Interface for stepper motors, trigger relay. Interprets commands received from USB serial connection and performs appropriate action (e.g. rotate turret on ? axis in ? direction by ? degrees, fire). TODO: stepper motor controllers, battery config C++

Purposes:

  • Read 4-byte command from USB serial stream
  • Control turrets
    • Stepper motor rotation
    • Firing

Input Format/Protocol

(assuming reliable multi-byte serial stream - order of bytes sent preserved): Input Serial Stream: 32-bit wide binary string Masks: 0x0000 = EMPTY PADDING (START OF COMMAND) 0x0F00 = ROTATE X (-128, 127) 0x00F0 = ROTATE Y (-128, 127) 0x000F = TRIGGER STATE (1, 255) (END OF COMMAND) First byte is ignored, only used to determine start of 32-bit binary string Second byte cast to signed 8-bit integer as X axis desired rotation Third byte cast to signed 8-bit integer as Y axis desired rotation Fourth byte cast to unsigned 8-bit integer as trigger state where 1 = off, 255 = on. Must not be zero.


##MODULE 3 (CV/NEURAL NET) [Later]

[Service]

C++/Python: OpenCV framework?

Purposes:

  • Automatic motion detection
  • Send commands (rotate, fire) to Module 2 Raspberry Pi

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.