def check_front(): tf = 0.030 init() dist = distance() print 'The distance is now : ', dist if dist <15: print ('Too close,', dist) init() reverse(2) dist = distance() if dist<15: print('Too close,',dist) init() pivot_left(3) init() reverse(2) dist = distance() if dist <15: print('Too close, giving up', dist) sys.exit() if dist>15: print 'The distance is now : ', dist init() forward(tf)
def autonomy(): tf = 0.030 for n in range(10): check_front() init() forward(tf) x = random.randrange(0, 4) print('Random value of X is', x) if x == 0: for y in range(30): check_front() init() forward(tf) elif x == 1: for y in range(30): check_front() init() forward(tf) elif x == 2: for y in range(30): check_front() init() pivot_right(tf) elif x == 3: for y in range(30): check_front() init() pivot_left(tf)
def check_process(): tf = 0.030 init() dist = distance() print 'The distance is now : ', dist if dist < 15: print('Too close,', dist) init() x = random.randrange(0, 2) if x == 0: pivot_left(tf) elif x == 1: pivot_right(tf) test_autonomy()
from picca import prep_del, io from picca.data import forest, delta from func import read_from_spec, read_data, stack_flux, init import fitsio import time import numpy as N import pylab as P import scipy as sp from scipy.interpolate import interp1d import sys print sys.argv[1] # Initialise init() order = 1 mode = 'spec' npix_min = 50 # Create arrays for THID etc from input files DR = sys.argv[1] fname = 'shortqso{}.txt'.format(DR[2:]) THID, PLATE, MJD, FIBERID, RA, DEC, Z = N.loadtxt(fname, unpack = 1) THID = THID.astype(int) PLATE = PLATE.astype(int) MJD = MJD.astype(int) FIBERID = FIBERID.astype(int) # Create shorter arrays for other variables, corresponding to specific THID #T = input("Please enter THING_ID for {}: ".format(DR))
def test_autonomy(): tf = 0.030 init() forward(tf) check_process()
import RPi.GPIO as GPIO import time import os import func import lcd_rpi import serial import lcd_over #inistilize all the pins to low. func.init() GPIO.output(7,GPIO.HIGH) #We start testing the digital I/O, i.e from pin 2 to pin 13 #I/O=13 GPIO.output(3,GPIO.LOW) GPIO.output(5,GPIO.LOW) GPIO.output(8,GPIO.LOW) GPIO.output(10,GPIO.LOW) time.sleep(1) #I/O=12 GPIO.output(3,GPIO.HIGH) GPIO.output(5,GPIO.LOW) GPIO.output(8,GPIO.LOW) GPIO.output(10,GPIO.LOW) time.sleep(1) #I/0=11 GPIO.output(3,GPIO.LOW)