Coder Social home page Coder Social logo

jdomian / mfsb Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7.49 MB

Mutha F'ing Space Blaster - A Raspberry Pi Zero 2 W based, 3D printed, ammo counting, Tensorflow-based targeting computer that can curve Nerf Rival rounds while tracking targets... blaster attachment.

CSS 10.76% HTML 23.75% JavaScript 55.40% Python 8.86% Shell 1.23%

mfsb's Introduction

MFSB

Mutha F'ing Smart Blaster - A Raspberry Pi Zero 2 W based, 3D printed, ammo counting, Tensorflow-based targeting computer that can curve Nerf Rival rounds while tracking targets... blaster attachment.

Helper Commands

Run these after SSH into the MFSB to reboot Chromium and other service needed to run the devices.

#Shutdown Raspberry Pi, right now!
sudo shutdown -h now

# List all processes running, like NodeJS server, then find the process number.
ps aux | grep node
# Kill the process you just found by its ID
kill -9 491

# See how long all startup processes take on OS load. Disable some later to speed up boot times
systemd-analyze blame

# Run NodeJS webserver to MFSB located at /home/pi/MFSB.webserver.js
sudo node /home/pi/MFSG/webserver.js

# Start the Camera module for MFSB
sudo node node_modules/raspberrypi-node-camera-web-streamer/index.js

# Refresh the browser for MFSB, this simulates pressing "F5" to refresh the browser
DISPLAY=:0 xdotool key F5

Debugging

  1. Start MFSB Pi with standard USB Micro, or from switch on side of PiSugar2 installed in hull
  2. SSH into MFSB with username pi@<IP.AD.DR.ESS>:8080
  3. Wait for boot into interface for ammo counter
  4. Use a browser to go to IP address of your device in your LAN, with port 8080 for Chromium interface

Hardware

Software Components

Startup "Linked" Files

Created some "linked" files in the root of the repo. These change the startup behavior of what loads on boot, such as the Chromium auto boot in kiosk mode, the display driver and nodejs server.

  • boot-config --> linked to the root pi /book/config.txt with setting for HDMI display overrides, overclocking and Waveshare LED Display resolution settings and orientation.
  • kiosk-autostart --> linked to /etc/xdg/openbox/autostart which contains the Chromium browser settings to auto start Chromium in fullscreen, kiosk mode and with autoplay for mp4s enabled.
  • pi-startup --> linked to /etc/rc.local which contains scripts needed to start the drivers built from fbcp-ili9341, start the nodejs server, start socket.io for GPIOs, start the webserver to serve pages and to startup the camera module, all of this on initial boot.

##kiosk-autostart Setup The following is what startx uses to load chromium with arguments to avoid CORS and allow local files access.

# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms

# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp

# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

# Debugging not on boot with window and not kiosk
#chromium-browser 'http://localhost:8080'

# Fullscreen kiosk with no bars
chromium-browser --disable-infobars --disable-web-security --allow-file-access-from-files --kiosk --autoplay-policy=no-user-gesture-required 'http://localhost:8080'

##rc.local Setup

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# 1 - Start 1.3in LCD driver and clone output to micro display
sudo /home/pi/fbcp-ili9341/build/fbcp-ili9341 &

# 2 - Start NodeJS webserver for chromium. This also starts GPIO Pin Service for buttons
su pi -c 'node /home/pi/MFSB/www/webserver.js < /dev/null &'

# 3 - Start UI via Chromium Kisok Mode. This was moved to /home/pi/.bash_profile -- COMMAND: [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor &

# 4 - Starts basic MJPEG Raspberry Pi Web Cam Streamer as <img src="http://<server_address>/stream.mjpg" />
#su pi -c 'sudo node /home/pi/node_modules/raspberrypi-node-camera-web-streamer/index.js < /dev/null &'

# IN DEVELOPMENT--- 5 - Starts HTML5 <video> h.264 encoded video stream to use with Tensorflow AI
#su pi -c 'python3 /home/pi/fmp4streamer/fmp4streamer.py < /dev/null &'
#su pi -c 'python3 MFSB/www/public/trackingCamera/server.py < /dev/null &'

# remote debugging in chrome on desktop over at port 9223
#su pi -c 'ssh -L 0.0.0.0:9223:localhost:9222 localhost -N < /dev/null &'

mfsb's People

Contributors

jdomian avatar

Stargazers

Lantern Master  avatar

Watchers

 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.