def __init__(self): #オブジェクトの生成 self.rightmotor = motor.motor(ct.const.RIGHT_MOTOR_IN1_PIN, ct.const.RIGHT_MOTOR_IN2_PIN, ct.const.RIGHT_MOTOR_VREF_PIN) self.leftmotor = motor.motor(ct.const.LEFT_MOTOR_IN1_PIN, ct.const.LEFT_MOTOR_IN2_PIN, ct.const.LEFT_MOTOR_VREF_PIN) self.gps = gps.GPS() self.bno055 = bno055.BNO055() self.radio = radio.radio() self.RED_LED = led.led(ct.const.RED_LED_PIN) self.BLUE_LED = led.led(ct.const.BLUE_LED_PIN) self.GREEN_LED = led.led(ct.const.GREEN_LED_PIN) #開始時間の記録 self.startTime = time.time() self.timer = 0 self.landstate = 0 #landing stateの中でモータを一定時間回すためにlandのなかでもステート管理するため self.v_right = 100 self.v_left = 100 #変数 self.state = 0 self.laststate = 0 self.landstate = 0 #stateに入っている時刻の初期化 self.preparingTime = 0 self.flyingTime = 0 self.droppingTime = 0 self.landingTime = 0 self.pre_motorTime = 0 self.waitingTime = 0 self.runningTime = 0 self.goalTime = 0 #state管理用変数初期化 self.countPreLoop = 0 self.countFlyLoop = 0 self.countDropLoop = 0 self.countGoal = 0 self.countAreaLoopEnd = 0 # 終了判定用 self.countAreaLoopStart = 0 # 開始判定用 self.countAreaLoopLose = 0 # 見失い判定用 self.countgrass = 0 #GPIO設定 GPIO.setmode(GPIO.BCM) #GPIOの設定 GPIO.setup(ct.const.FLIGHTPIN_PIN, GPIO.IN) #フライトピン用 date = datetime.datetime.now() self.filename = '{0:%Y%m%d}'.format(date) self.filename_hm = '{0:%Y%m%d%H%M}'.format(date) if not os.path.isdir( '/home/pi/Desktop/wolvez2021/Testcode/EtoEtest/%s/' % (self.filename)): os.mkdir('/home/pi/Desktop/wolvez2021/Testcode/EtoEtest/%s/' % (self.filename))
def __init__(self): self.gps = gps.GPS() self.radio = radio.radio() #開始時間の記録 self.startTime = time.time() self.timer = 0
def status(): tData={} ts=[] sw=[] pr=[] # internal temp for i,f in enumerate(config.TEMP_SENSORS): t=util.getTemperature(i) s='N/A' if t is None else "%2.1f" % t ts.append([f,config.TEMP_ALIAS[i],s]) # external temp r=radio.radio() t=r.getTemp(2) s='N/A' if t is None else "%2.1f" % t ts.append(['nrf24l01+','Exterior',s]) for i in config.LINES.items(): t=util.nvl(util.getLight(i[1]),'N/A') sw.append([i[0],i[1],t]) p1=bmp180.BMP180() if p1._device._address: px="0x%x" % p1._device._address p2=util.nvl(util.getPressure(),'N/A') pr.append(['Presion',px,p2]) tData={ 'ts':ts, 'sw':sw, 'pr':pr } return render_template('s.html',**tData)
def __init__(self): self.radio = radio.radio([0xa7, 0xa7, 0xa7, 0xa7, 0xaa]) self.swarm = [ #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x01]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x02]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x03]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x04]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x05]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x06]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x07]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x08]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x09]) ] self.bpm = 150 self.beat = 0 self.beats_per_cycle = 1 self.ms_per_beat = self.bpm_to_mspb(self.bpm) self.last_sync = time.time() self.weft_swarm = [0, 1, 2, 3] self.warp_swarm = [4, 5, 6, 7] self.state = "weft-walking" self.compiler = yarn.compiler() self.osc_server = OSCServer(("0.0.0.0", 8000)) self.osc_server.timeout = 0 self.osc_server.addMsgHandler("/sync", sync_callback) self.sync_pos = 0 # load code here self.swarm[0].load_asm("../asm/led_flash.asm", self.compiler, self.radio)
def index(): now=datetime.datetime.now().strftime(config.DATEFORMAT) # cloud TS service status cloud='on' if util.isCloudActive() else 'off' # temperature fTemp1=util.getTemperature(0) temp1="%2.1f" % fTemp1 # external temp r=radio.radio() t=r.getTemp(2) text='N/A' if t is None else "%2.1f" % t # pressure p1=util.getPressure() # light s1=util.getLight(config.LINES['R1LINE']) # last time the ligth was switched off lastoff=util.db_getvalue(config.DB_LIGHTSOFF) if lastoff is None: loe='<no disponible>' else: loe=lastoff tData={ 'temp1':temp1, 'text':text, 'pres1':p1, 's1':s1, 'time':now, 'loe':loe, 'cloud':cloud } return render_template('index.html',**tData)
def __init__(self): #オブジェクトの生成 #self.rightmotor = motor.motor(ct.const.RIGHT_MOTOR_VREF_PIN,ct.const.RIGHT_MOTOR_IN1_PIN,ct.const.RIGHT_MOTOR_IN2_PIN) #self.leftmotor = motor.motor(ct.const.LEFT_MOTOR_VREF_PIN,ct.const.LEFT_MOTOR_IN1_PIN,ct.const.LEFT_MOTOR_IN2_PIN) self.gps = gps.Gps() #self.bno055 = bno055.BNO() self.radio = radio.radio() #self.ultrasonic = ultrasonic.Ultrasonic() #self.RED_LED = led.led(ct.const.RED_LED_PIN) #self.BLUE_LED = led.led(ct.const.BLUE_LED_PIN) #self.GREEN_LED = led.led(ct.const.GREEN_LED_PIN) #開始時間の記録 self.startTime = time.time() self.timer = 0 """
def __init__(self, mcclog, outqueue, conf): # Delayed import as ephem should not be required if tracking is not used import ephem import tle import rotor import radio #import ephem threading.Thread.__init__(self, None) self.mcclog = mcclog self.outqueue = outqueue self.spacecraft = conf.spacecraft self.frequency = conf.frequency # Create observer self.obs = ephem.Observer() self.obs.lat = conf.gslat self.obs.long = conf.gslong self.obs.elevation = conf.gselv self.obs.date = ephem.now() self.obs.pressure = 0 self.obs.horizon = math.radians(0.0) self.minelv = math.radians(conf.minelv) # Create event object self.event = threading.Event() # Update TLE self.tle = tle.tle(self.mcclog, conf) self.tle.update() # Create rotor self.rotor = rotor.rotor(self.mcclog, conf) # Create radio self.radio = radio.radio(self.mcclog, self.outqueue, conf) # Start TLE auto updater self.tle.auto_enable() # Set thread state - self.daemon is important! self.daemon = True self.running = True # Start thread self.start()
def __init__(self, callsign): self.callsign = callsign self.txQueue = [] self.currenttx = None self.radioStatus = False self.currentMode = None self.errors = [] self.alerts = [] self.radio = radio.radio() for i in range(3): logger.debug('Configuring the radio.') self.radioStatus = self.radio.configureModule() if self.radioStatus == True: break if self.radioStatus == False and i == 2: logger.critical("Radio module configuration failed")
def __init__(self): self.radio = radio.radio([0xa7, 0xa7, 0xa7, 0xa7, 0xaa]) self.swarm = [ robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x01]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x02]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x03]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x04]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x05]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x06]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x07]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x08]) ] self.compiler = yarnasm.compiler() self.lisp_fifo_name = "../fifo/lisp_fifo" self.asm_fifo_name = "../fifo/asm_fifo" os.remove(self.lisp_fifo_name) os.remove(self.asm_fifo_name) os.mkfifo(self.lisp_fifo_name) os.mkfifo(self.asm_fifo_name) # start compiler subprocess.Popen(['racket', '../compiler/yarnc.scm'])
def __init__(self): self.radio = radio.radio([0xa7, 0xa7, 0xa7, 0xa7, 0xaa]) self.swarm = [ #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x01]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x02]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x03]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x04]), robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x05]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x06]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x07]), #robot.robot([0xa7, 0xa7, 0xa7, 0xa7, 0x08]) ] self.bpm = 150 self.beat = 0 self.beats_per_cycle = 1 self.ms_per_beat = self.bpm_to_mspb(self.bpm) self.last_sync = time.time() self.last = "" self.compiler = yarn.compiler() self.osc_server = OSCServer(("0.0.0.0", 8000)) self.osc_server.timeout = 0 self.osc_server.addMsgHandler("/sync", sync_callback) self.sync_pos = 0 self.ms_per_step = (frequency * len(i2c_addrs)) * 1000 self.ms_per_step /= 8 print(self.ms_per_step) # load code here #for r in self.swarm: # r.load_asm("../asm/pm.asm",self.compiler,self.radio) # r.write(13,self.ms_per_step,self.radio) self.grid = tangible.sensor_grid(16, layout, tokens) self.last = "" self.next_address = 0 self.seq = 0
for channel in channelChanges: channelDif = channelChanges[channel]['dif'] if channelDif > heighestDif: print("current channel is " + str(channel)) print(str(channelDif) + " > " + str(heighestDif)) heighestChannel = channel return heighestChannel try: init = own['init'] radio = g['radio'] except: own['init'] = True own['state'] = NO_CAL g['radio'] = r.radio(cont.sensors["Joystick"]) radio = g['radio'] own['calChannel'] = 0 own['rawInputs'] = radio.getAllRawinputs(cont.sensors["Joystick"]) if own['state'] == START_CAL: own['timer'] = 0.00 own['state'] = ROLL_SELECT #initialize own['channelChanges'] = {} for i in range(0, len(own['rawInputs'])): channelValue = own['rawInputs'][i] own['channelChanges'][i] = { 'min': own['rawInputs'][i], 'max': own['rawInputs'][i], "dif": 0
from radio import radio r1 = radio(1, 1) r1.turnOn() print(r1) r1.volumeUp() r1.volumeUp() r1.volumeUp() print(r1) r1.stationUp() r1.stationUp() r1.stationUp() r1.stationUp() r1.stationUp() r1.stationUp() r1.stationUp() r1.stationUp() print(r1) r1.turnOff() print(r1) r1.volumeUp() r1.volumeUp() print(r1) r1.stationDown() r1.stationDown() print(r1)
else: params = urllib.urlencode({'field1': temp1, 'field2': temp2, 'field3': pressure, 'field4': temp3, 'field5': temp4, 'key':'M3WA24ZHF4KDYM56'}) headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} conn = httplib.HTTPConnection("api.thingspeak.com:80") conn.request("POST", "/update", params, headers) response = conn.getresponse() print response.status, response.reason data = response.read() conn.close() except Exception: pass #sleep for 300 seconds (api limit of 15 secs) if __name__ == "__main__": # start checks - print data at startup radio=radio.radio() temp1=util.getTemperature(0) temp2=util.getTemperature(1) temp3=util.getTemperature(2) pressure=util.getPressure() temp4=radio.getTemp() print temp1," degrees" print temp2," degrees" print temp3," degrees" print pressure, " mbar" if radio is None: params = urllib.urlencode({'field1': temp1, 'field2': temp2, 'field3': pressure, 'field4': temp3, 'key':'M3WA24ZHF4KDYM56'}) else: params = urllib.urlencode({'field1': temp1, 'field2': temp2, 'field3': pressure, 'field4': temp3, 'field5': temp4, 'key':'M3WA24ZHF4KDYM56'}) print temp4," degrees" print params
print("**SOLO DEBE CONTENER NUMEROS**") streamDePaga = int(input("Ingrese el número de stream que tuvo en plataformas de paga: ")) s = streaming(streamYT, remix, streamDePaga) s.agregar() try: radioPop = int(input("Ingrese el número de veces que se paso por la radio Pop: ")) except: print("**SOLO DEBE CONTENER NUMEROS**") radioPop = int(input("Ingrese el número de veces que se paso por la radio Pop: ")) try: radioAC = int(input("Ingrese el número de veces que se paso por la radio AC: ")) except: print("**SOLO DEBE CONTENER NUMEROS**") RadioAC = int(input("Ingrese el número de veces que se paso por la radio AC: ")) r = radio(radioPop, radioAC) r.agregar() try: digitalSales = int(input("Ingrese el número de ventas digitales obtenidas: ")) except: print("**SOLO DEBE CONTENER NUMEROS**") digitalSales = int(input("Ingrese el número de ventas digitales obtenidas: ")) try: fisicalSales = int(input("Ingrese el número de ventas fisicas obtenidas: ")) except: print("**SOLO DEBE CONTENER NUMEROS**") fisicalSales = int(input("Ingrese el número de ventas fisicas obtenidas: ")) sa = sales(digitalSales, fisicalSales) sa.agregar()
levels.append(float(ra.getlevel())) # gather statistics timeleft = transit.end - now minutes = int(timeleft / 60) seconds = int(timeleft - minutes * 60) writeline("Tracking %s LOS: %s, %s %02.3f/%02.3f @ %d + %d" % ( name, lostime, "%03d:%02d" % (minutes, seconds), observe['elevation'], transit.peak()['elevation'], f, freqadjust )) time.sleep(UPDATEINTERVAL) if __name__ == "__main__": writeline("Initializing radio connection") logging.info("Starting up") ra = radio.radio() ra.init() ra.mode(ra.MODE_CWL) try: # graceful exit at Crtl+C curses.wrapper(main) except KeyboardInterrupt: ra.los() ra.close() logging.info("Exiting") print ""
def __init__(self): super().__init__() self.ui = radioDialog.Ui_Dialog() self.ui.setupUi(self) self.radio = radio.radio(self.ui, self) self.show()