Skip to content

Instantly share code, notes, and snippets.

@ricklon
Created July 6, 2017 14:25
Show Gist options
  • Save ricklon/3a787eb66c2e818df304936808a3f7c6 to your computer and use it in GitHub Desktop.
Save ricklon/3a787eb66c2e818df304936808a3f7c6 to your computer and use it in GitHub Desktop.
Sanmesh's master button example
import RPi.GPIO as GPIO
import time
import numpy as np
import collect
gpio_collectOn = 18;
gpio_collectOff = 16;
gpio_saveToUsb = 17;
GPIO.setmode(GPIO.BCM)
GPIO.setup(gpio_collectOn, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_collectOn = GPIO.input(gpio_collectOn) #button for collection on
if input_collectOn == False:
collect.collectTeleop(100, 'debug', gpio_collectOff)#number_of_frames, debug
time.sleep(0.2)
input_gpio_saveToUsb = GPIO.input(gpio_saveToUsb ) #button to copy files to USB
if input_collectOn == False:
copytree('test', checkCopy, symlinks=False, ignore=None)
time.sleep(0.2)
def copytree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d, symlinks, ignore)
else:
shutil.copy2(s, d)
"""
Right now I'm saving a numpy as a byte file in .npy format and can both save and load data
Things to save, format:
Webcam image, numpy array?
Current Accel, numpy array?
Current Speed, numpy array?
Current Accel, numpy array?
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment