def __init__(self): super().__init__() robot = DriveBot(initSuper=False) self.addModule(robot) self.addModule(DebugMode(robot)) self.addModule(Climber(initSuper=False)) self.addModule(Shooter(initSuper=False))
def __init__(self): """Initialize the game and create game resources.""" pygame.init() self.settings = Settings() self.screen = pygame.display.set_mode((self.settings.screen_width,self.settings.screen_height)) pygame.display.set_caption("Sideways Shooter") # Create an instance to store game statistics, and create a scoreboard. self.stats = GameStats(self) self.sb = Scoreboard(self) self.shooter = Shooter(self) self.lines = pygame.sprite.Group() self.bullets = pygame.sprite.Group() self.bulletbs = pygame.sprite.Group() self.balls = pygame.sprite.Group() self.ball2s = pygame.sprite.Group() self._create_fleet() self._create_fleet2() # Make the play button. self.play_button = PlayButton(self, "Right wheel to play") # Make the Settings button. self.settings_button = SettingsButton(self, "Settings") # Make the setttings menu. self.settings_menu = SettingsMenu(self, "fast or slow press y or n") # Make the speed button. self.speed_button = SpeedButton(self, "you have selected the fast option") # Make the second speed button. self.speed_button2 = SpeedButton2(self, "You have selected the slower options")
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ self.driver_stick = wpilib.Joystick(0) self.codriver_stick = wpilib.Joystick(1) self.left_shooter_motor = ctre.WPI_TalonSRX(0) self.left_drivetrain_motor = ctre.WPI_TalonSRX(1) self.right_drivetrain_motor = ctre.WPI_TalonSRX(2) self.right_shooter_motor = ctre.WPI_TalonSRX(3) self.intake_motor = wpilib.Spark(8) self.arm_pivot_motor = wpilib.Spark(6) self.arm_lock_motor = wpilib.Spark(5) self.timer = wpilib.Timer() #self.navx = navx.AHRS.create_spi() self.duration = 20 self.drivetrain = DriveTrain(self.left_drivetrain_motor, self.right_drivetrain_motor) self.shooter = Shooter(self.intake_motor, self.left_shooter_motor, self.right_shooter_motor) self.arm = Arm(self.arm_pivot_motor, self.arm_lock_motor)
def robotInit(self): super().__init__() # Instances of classes # Instantiate Subsystems #XXX DEBUGGING self.drivetrain = Drivetrain(self) self.shooter = Shooter(self) self.carrier = Carrier(self) self.feeder = Feeder(self) self.intake = Intake(self) #self.winch = Winch(self) #self.climber = Climber(self) #self.climber_big = Climber_Big(self) #self.climber_little = Climber_Little(self) # Instantiate Joysticks self.left_joy = wpilib.Joystick(1) self.right_joy = wpilib.Joystick(2) # Instantiate Xbox self.xbox = wpilib.Joystick(3) # Instantiate OI; must be AFTER joysticks are inited self.oi = OI(self) self.timer = wpilib.Timer()
def __init__(self, fullscreen, sceneName=None): # Start Panda preSetWindowIcon("media/heavy_destruction.ico") ShowBase() # Some non-gameplay setup. self.name = "Heavy Destruction" self.version = 1.0 base.setBackgroundColor(0, 0, 0) centerWindow() render.setAntialias(AntialiasAttrib.MAuto) if fullscreen: toggleFullscreen() self.setupKeys() self.setupFps() self.setupTitle() # Setup game objects. self.world = World(self) self.character = Character(self.world) self.cameraHandler = CameraHandler(self.character) self.shooter = Shooter(self.character) # Select a scene. if sceneName == "balls": self.scene = scene.FallingBalls(self.world, render, self.cameraHandler, self.character) else: self.scene = scene.BasicWall(self.world, render, self.cameraHandler, self.character)
def prep_shooters(self): """Show how many shooters are left.""" self.shooters = Group() for shooter_number in range(self.stats.shooters_left): shooter = Shooter(self.ss_game) shooter.rect.x = 10 + shooter_number * shooter.rect.width shooter.rect.y = 100 self.shooters.add(shooter)
def __init__(self): """Initialize the game properties""" pygame.init() self.screen = pygame.display.set_mode((1200, 800)) self.bg_colour = (200, 175, 220) pygame.display.set_caption('Contra') self.shooter = Shooter(self)
def __init__(self, screen): self.targets = [] self.eat_food = [] self.eat_count = 0 self.screen = screen self.shooter = Shooter(self.screen) self.mouth = Mouth(screen) self.total_score = 0 self.final_score = 0 self.eating = False self.chew_timer = 0 self.spawn_count = 0
def execute(self, base_path, signal, subjects, window, window_overlap, selector, use_classifiers, with_all_signals, times): self.subjects = subjects self.window = window self.window_overlap = window_overlap self.selector = selector self.with_all_signals = with_all_signals predicts_rf = [] predicts_clf = [] predicts_nbrs = [] predicts_shooter = [] testings = [] for sub in subjects: print('sujeito = ', sub) training_labels, training_features = self.get_data(base_path, signal, sub, 'training') testing_labels, testing_features = self.get_data(base_path, signal, sub, 'testing') if (np.isscalar(training_features[0])): training_features = training_features.reshape(-1,1) testing_features = testing_features.reshape(-1,1) testings.insert(sub, testing_labels) if 'forest' in use_classifiers: rf = RandomForestClassifier(n_estimators=100, max_depth=5, oob_score=True) rf = rf.fit(training_features, training_labels) predictions = rf.predict(testing_features) predicts_rf.insert(sub, predictions) predicts_rf_subject = predictions if 'svm' in use_classifiers: clf = svm.SVC(gamma='scale', C=4) clf = clf.fit(training_features, training_labels) predictions = clf.predict(testing_features) predicts_clf.insert(sub, predictions) predicts_clf_subject = predictions if 'knn' in use_classifiers: knn = KNeighborsClassifier(n_neighbors=11, weights='distance', algorithm='auto', metric='euclidean') knn = knn.fit(training_features, training_labels) predictions = knn.predict(testing_features) predicts_nbrs.insert(sub, predictions) predicts_nbrs_subject = predictions if 'shooter' in use_classifiers: shoot2 = Shooter() predictions = shoot2.choose(predicts_rf_subject, predicts_nbrs_subject, predicts_clf_subject) predicts_shooter.insert(sub, predictions) return predicts_rf, predicts_clf, predicts_nbrs, predicts_shooter, testings
def to_shooter(list): """ creates a shooter with a list of a shooter information """ s = Shooter(screen, list[0], list[1]) for tup in list[2]: s.stack.append(Bullet(screen, tup[0], tup[1], tup[2], tup[3],tup[4])) s.color = list[3] s.angle = list[4] s.life = list[5] s.score = list[6] s.X_BOUND = X_BOUND s.Y_BOUND = Y_BOUND return s
def do_client(new_sock): """ ~main server's loop~ for each client - send his shooter and all shooters in arena after some update, and checks """ me = Shooter(None, 500, 30) me.set_new_color() while not get_approval(me): me.set_new_color() me.set_random_position(X_BOUND, Y_BOUND) shooters.append(me) Done = False while not Done: try: to_send = shooters_to_send(me) if me.life <= 0: Done = True to_send = "LOS" elif me.life < 100: me.life += 0.01 to_send = json.dumps(to_send) new_sock.send(to_send) recv = new_sock.recv(1024) if recv == "CLD": #stands for - CLient Disconnected print "Client Disconnected" Done = True else: recv = json.loads(recv) me.angle = recv[0] presses = recv[1::] control_player(presses, me) me.move_shot() update_shooters(me) check_hits(me) except: print "closing current socket because of technical issues" Done = True shooters.remove(me) new_sock.close()
def robotInit(self): """Initialization method for the Frobo class. Initializes objects needed elsewhere throughout the code.""" # Initialize Joystick self.controller = Joystick(Values.CONTROLLER_ID) # Initialize Drive Sub-System self.drive = FroboDrive(self, Values.DRIVE_LEFT_MAIN_ID, Values.DRIVE_LEFT_SLAVE_ID, Values.DRIVE_RIGHT_MAIN_ID, Values.DRIVE_RIGHT_SLAVE_ID) # Initialize Shooter Sub-System self.compressor = wpilib.Compressor() self.shooter = Shooter(self, Values.SHOOT_FRONT_ID, Values.SHOOT_BACK_ID, Values.SHOOT_SOLENOID_FORWARD_CHANNEL_ID, Values.SHOOT_SOLENOID_REVERSE_CHANNEL_ID)
def one_classifier_and_decision(self, selection, number): print('Begining ' + str(number) + ' - todos com decisão ' + selection + ' ') shoot2 = Shooter() ecg_predicts_rf, ecg_predicts_clf, ecg_predicts_nbrs, ecg_predicts_shooter, ecg_testings = self.individual( 'ecg', selection, 0, True, ['svm']) eda_predicts_rf, eda_predicts_clf, eda_predicts_nbrs, eda_predicts_shooter, eda_testings = self.individual( 'eda', selection, 0, True, ['forest']) # emg_predicts_rf, emg_predicts_clf, emg_predicts_nbrs, emg_predicts_shooter, emg_testings = self.individual('emg', selection, 0, True, ['svm']) resp_predicts_rf, resp_predicts_clf, resp_predicts_nbrs, resp_predicts_shooter, resp_testings = self.individual( 'resp', selection, 0, True, ['svm']) # decision_predicts = [] # i = 0 # j = 0 # for i in range(self.CLASSIFICATION_TIMES): # decision_predicts.insert(i, []) # for j in range(len(self.BASE_SUBJECTS)): # decisao = shoot2.choose(ecg_predicts_clf[i][j], eda_predicts_rf[i][j], emg_predicts_clf[i][j]) # decision_predicts[i].insert(j, decisao) # evaluate = Evaluator() # evaluate.report(self.BASE_SUBJECTS, self.CLASSIFICATION_TIMES, ecg_testings, ecg_predicts_clf, eda_predicts_rf, emg_predicts_clf, decision_predicts, '/Volumes/My Passport/TCC/Resultados3/TODOS_' + str(number) + '_' + selection + '_1.csv') decision_predicts2 = [] i = 0 j = 0 for i in range(self.CLASSIFICATION_TIMES): decision_predicts2.insert(i, []) for j in range(len(self.BASE_SUBJECTS)): decisao = shoot2.choose(ecg_predicts_clf[i][j], eda_predicts_rf[i][j], resp_predicts_clf[i][j]) decision_predicts2[i].insert(j, decisao) evaluate = Evaluator() evaluate.report( self.BASE_SUBJECTS, self.CLASSIFICATION_TIMES, ecg_testings, ecg_predicts_clf, eda_predicts_rf, resp_predicts_clf, decision_predicts2, '/Volumes/My Passport/TCC/Resultados3/TODOS_' + str(number) + '_' + selection + '_2.csv')
def __init__(self): super().__init__() self.drive_stick = wpilib.Joystick(1) self.arm_stick = wpilib.Joystick(2) self.front_right_motor = wpilib.Jaguar(2) self.front_left_motor = wpilib.Jaguar(1) self.back_left_motor = wpilib.Jaguar(3) self.back_right_motor = wpilib.Jaguar(4) self.intake_wheels_motor = wpilib.Jaguar(10) self.intake_arm_motor = wpilib.Jaguar(6) self.shooter_servo = wpilib.Servo(7) self.shooter_motor = wpilib.Jaguar(5) self.encoder = wpilib.Encoder(1, 2, True) self.mecanum_drive = MecanumDrive(self.front_right_motor, self.front_left_motor, self.back_right_motor, self.back_left_motor, self.drive_stick) self.intake = Intake(self.intake_wheels_motor, self.intake_arm_motor, self.arm_stick) self.shooter_service = ShooterService(self.shooter_motor, self.shooter_servo, self.arm_stick) self.shooter = Shooter(self.shooter_motor, self.encoder, self.shooter_servo, self.arm_stick, self.shooter_service) self.autonomous = Autonomous(self.shooter_service, self.intake_arm_motor, self.front_left_motor, self.front_right_motor, self.back_left_motor, self.back_right_motor)
def run_game(): # determine the pygame window position x = 100 y = 45 os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (x, y) # Initialize game and create a screen object. pygame.init() programIcon = pygame.image.load('images/covid_ic.png') pygame.display.set_icon(programIcon) ai_settings = Settings() screen = pygame.display.set_mode((ai_settings.screen_width,ai_settings.screen_height)) pygame.display.set_caption("Corona Epidemic") # Make the play button. play_button = Button(ai_settings, screen, "Play") # Create an instance to store game statistics. stats = GameStats(ai_settings) sb = Scoreboard(ai_settings, screen, stats) # Make a shooter. shooter = Shooter(ai_settings, screen) # Make a group to store bullets in. bullets = Group() covids = Group() # Create the fleet on covids. gf.create_fleet(ai_settings, screen, shooter, covids) # Start the main loop for the game. while True: gf.check_events(ai_settings, screen, stats, sb, play_button, shooter, covids, bullets) if stats.game_active: shooter.update() gf.update_bullets(ai_settings, screen, stats, sb, shooter, covids, bullets) gf.update_covids(ai_settings, screen, stats, sb, shooter, covids, bullets) gf.update_screen(ai_settings, screen, stats, sb, shooter, covids, bullets, play_button)
def __init__(self): # Setting up the screen pygame.init() self.settings = Settings() self.screen = pygame.display.set_mode( (self.settings.screen_width, self.settings.screen_height)) pygame.display.set_caption('SpaceShooter') self.stats = Stats(self) self.space_bg = Space(self) self.shooter = Shooter(self) # Create a list that will store the lasers self.lasers = pygame.sprite.Group() self.spaceships = pygame.sprite.Group() self.display_shooters = pygame.sprite.Group() self._create_fleet() self._display_shooters() self.button = Button(self, 'Play') self.quitbutton = QuitButton(self, 'Quit') self.sb = Scoreboard(self)
def run_game(): pygame.init() target_settings = Settings() screen = pygame.display.set_mode( (target_settings.screen_width, target_settings.screen_height)) pygame.display.set_caption("Shoot The Box") play_button = Button(target_settings, screen, "Start") stats = GameStats(target_settings) sb = Scoreboard(target_settings, screen, stats) shooter = Shooter(target_settings, screen) target = Target(target_settings, screen) bullets = Group() while True: gf.check_events(target_settings, stats, screen, sb, shooter, target, bullets, play_button) if stats.game_active: shooter.update() gf.update_bullets(target_settings, stats, screen, sb, shooter, target, bullets) gf.update_target(target_settings, target) gf.update_screen(target_settings, stats, screen, sb, shooter, target, bullets, play_button)
def run_game(): pygame.init() sideway_shooter = Settings() screen = pygame.display.set_mode(( sideway_shooter.width, sideway_shooter.height)) pygame.display.set_caption("__Hjira__") shooter = Shooter(screen) bullets = Group() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: shooter.moving_up = True if event.key == pygame.K_DOWN: shooter.moving_down = True elif event.key == pygame.K_SPACE: new_bullet = Bullet(screen, sideway_shooter, shooter) bullets.add(new_bullet) elif event.type == pygame.KEYUP: if event.key == pygame.K_UP: shooter.moving_up = False if event.key == pygame.K_DOWN: shooter.moving_down = False shooter.update() screen.fill(sideway_shooter.bg_color) shooter.belitme() bullets.update() for bullet in bullets.sprites(): bullet.draw_bullet() for bullet in bullets.copy(): if bullet.rect.top <= 0: bullets.remove(bullet) print(len(bullets)) pygame.display.flip()
def setUp(self): self.jake = Shooter('Jake') print(self.mock_data) self.mock_data = [1, 2, 3, 4, 5]
shooter_group = Group() logo = Group() gui = GUI() Label('name_game', logo, settings) Label('centipede', logo, settings) b1 = Button((settings.screen_width // 2 - 150, settings.screen_height // 2 - 100, 400, 100), 'start') b2 = Button((settings.screen_width // 2 - 150, settings.screen_height // 2 + 100, 400, 100), 'exit') gui.add_element(b1) gui.add_element(b2) centipede = Centipede([speed, 0], [300, 0], screen, 7) gf.make_mushrooms(settings, mushrooms, 15) shooter = Shooter(settings, screen) cursor = pygame.sprite.Sprite() cursor.image = pygame.transform.scale( pygame.image.load("./data/foto/arrow.png"), (50, 50)) cursor.rect = cursor.image.get_rect() shooter_group.add(shooter) all_sprites.add(shooter) all_sprites.add(centipede) no_control_player = [centipede] image_text_lose = pygame.transform.scale( pygame.image.load("./data/foto/game_over.png"), (900, 800)) rect = image_text_lose.get_rect() rect.centerx = settings.screen_width // 2
def test_get_cash(self): jake = Shooter('Jake') self.jake.get_cash(500) self.assertEqual(self.jake.money, 1500) print(self.mock_data)
def shooter3(self): self.shooter = Shooter(self)
def brain(self): shooter = Shooter() gameOver = False self.ships = self.getShips(self.amountOfShips) #places ships print(self.allShipCoordinates) while (not gameOver): #Bots turn print("My turn!") if not shooter.currentTarget: # if currentTarget is empty, meaning that ship hasn't been located coords = shooter.getRandomCoords() self.sendShootingCoordinatesToOpponent(coords) print("HIT, MISS OR SUNK?") answer = self.getOpponentResponse() if answer == "MISS": shooter.missed.append(coords) elif answer == "HIT": shooter.hits.append(coords) shooter.currentTarget.append(coords) elif answer == "SUNK": self.enemyShipsSunk += 1 shooter.hits.append(coords) shooter.reset() else: #if currentTarget isn't empty, meaning that ship has been located coords = shooter.getTargetCoords(shooter.shootingDirection, shooter.currentTarget[-1]) self.sendShootingCoordinatesToOpponent(coords) answer = self.getOpponentResponse() if answer == "MISS" and len( shooter.currentTarget ) == 1: #if there's only been one hit, meaning that the bot is finding out if the ship lays vertically or not shooter.missed.append(coords) shooter.changeDirection() #update shootingDirection elif answer == "MISS" and len( shooter.currentTarget ) > 1: #if there's been more than one hit, meaning that the bot is shooting directly at the ship and has now found the end of it if shooter.endOfShipReached == True: #if the end of the ship has already been reached, then this is the second time, and something is wrong, since both ends have been found but there's been no SUNK print( "END OF SHIP HAS BEEN FOUND TWICE, SOMETHING IS WRONG!!!!!!!!" ) sys.exit() else: #if this is the first time the end of the ship has been reached shooter.endOfShipReached = True shooter.missed.append(coords) shooter.currentTarget = list( reversed(shooter.currentTarget) ) #reverse currentTarget so that next time the bot will shoot from the other end shooter.reverseDirection( ) #reverse the shooting direction so that next time the bot will shoot in the other direction elif answer == "HIT": shooter.hits.append(coords) shooter.currentTarget.append(coords) elif answer == "SUNK": self.enemyShipsSunk += 1 shooter.hits.append(coords) shooter.reset() #Bots turn ends, check for game over gameOver = self.isGameOver() if gameOver == True: print("I WIN!") break #Opponents turn print("Your turn. Send coords: x,y") opcoords = self.getOpponentCoords() botAnswer = self.hitMissOrSunk(opcoords) if botAnswer == "SUNK": self.myShipsSunk += 1 print(botAnswer) #Opponents turn end, check for game over gameOver = self.isGameOver() if gameOver == True: print("I LOSE!") break print("GAME IS OVER")
X_BOUND = SCREEN_WIDTH*2 Y_BOUND = SCREEN_HEIGHT*2 screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) clock = pygame.time.Clock() #____________________________________________________________game_loop_____ quit = False while not quit: show_start_screen() sock = socket.socket() sock.connect((ip, port)) me = Shooter(screen, 500, 30) shooters = [] x_screen_delta = me.x - SCREEN_WIDTH / 2 y_screen_delta = me.y - SCREEN_HEIGHT / 2 defeat = False done = False while not done: #acctual game play loop try: set_background(x_screen_delta, y_screen_delta) recv_info() press = get_events()
def __init__(self): ## sets dimension of the screen and the background pygame.init() self.w = 900 self.h = 600 self.screen = pygame.display.set_mode((self.w, self.h), pygame.FULLSCREEN) self.background = pygame.image.load("background.png") ## creates all the objects and lists needed for the game self.player = Player(self.w, self.h, self.background) self.shooter = Shooter(self.player.x, self.player.y, self.player.d) self.shield = Shield(self.player.x, self.player.y, self.player.d) self.generator = Generator(self.player.x, self.player.y, self.player.d) self.bullet = Bullet(self.shooter.x, self.shooter.y, self.shooter.image_rotation) self.enemies = [Enemy(self.w, self.h)] self.enemies_2 = [] self.counter_enemies_2_dead = 0 self.collectible = Collectible(self.w, self.h) self.ray = Ray(self.w, self.h) ## loads energy image and sets its default value self.energy_5 = pygame.image.load("energy_5.png") self.energy = 100 ## sets all default values self.points = 0 self.killed_big_enemies = 0 self.killed_small_enemies = 0 self.rays_collected = 0 self.collectibles_collected = 0 ## initializes fonts and creates the first text font = pygame.font.SysFont("comic", 64) self.font = pygame.font.SysFont("arial", 10) text = font.render("Click to play", True, (255, 255, 255)) ## loads sound self.sound = pygame.mixer.Sound("blip.wav") ## sets timer and default timer variables self.clock = pygame.time.Clock() self.timer = 0 self.seconds = 0 self.minutes = 0 ## manages beginning screen and first inputs beginning = True while beginning: self.screen.fill((0, 0, 0)) self.screen.blit(text, ((self.w / 2) - 150, (self.h / 2) - 64)) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.display.quit() if event.type == pygame.MOUSEBUTTONUP: beginning = False self.screen.blit(self.background, (0, 0)) self.screen.blit(self.player.images[1], (self.player.x, self.player.y)) self.screen.blit(self.shooter.image, (self.shooter.x, self.shooter.y)) self.running() pygame.display.update()
win = window.Window(width=500, height=500, vsync=False, resizable=True) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # needed so that egi knows where to draw egi.InitWithPyglet(win) # prep the fps display fps_display = clock.ClockDisplay() # register key and mouse event handlers win.push_handlers(on_key_press) win.push_handlers(on_resize) # create a world for agents world = World(500, 500) # add one agent world.target = Target(world, 10, 10) world.shooter = Shooter(world, 10, 0.01) # unpause the world ready for movement world.paused = False shooter_controller = StateMachineAgent(world.shooter) while not win.has_exit: win.dispatch_events() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # show nice FPS bottom right (default) delta = clock.tick() world.update(delta) world.render() shooter_controller.change_state() fps_display.draw() # swap the double buffer
def __init__(self, imagenDeInicializacion, areaProtegida, areaDeConfirmacion, areaDeInteresPlacas=[[0, 0], [2592, 1944]], framesPorSegundo=10, nombreCarpetaAlmacenamiento='casosReportados', modoDebug=False): # REGISTROS AUTOMOVILES: self.numeroDePuntosASeguir = 3 self.miReporte = MiReporte(levelLogging=logging.INFO, nombre=__name__) self.areaDeResguardo = AreaDeResguardo(imagenDeInicializacion, self.numeroDePuntosASeguir, areaProtegida, areaDeConfirmacion) self.areaDeConfirmacion = np.array(areaDeConfirmacion) self.poligonoProtegidoParaVisualizacion = np.array(areaProtegida) self.reporteVideo = [] # Minimo 9 frames Maximo 15 frames self.misInfracciones = [] # Parametros auxiliares self.numeroDeFrame = 0 self.framesPorSegundoEnVideo = framesPorSegundo self.ultimaVelocidad = 0 self.widerVideo = 6 # aumenta el numero de frames al inicio y al final del video self.formaOndaDebug = [] self.infraccionesConfirmadas = 0 self.infraccionesDescartadasPorTiempo = 0 self.infraccionesDescartadasPorEstacionario = 0 self.infraccionesDescartadasGiro = 0 self.numeroInfraccionesTotales = 0 # Variables de reporte: self.reportarDebug = modoDebug # El directorio por defecto sera uno u otro en la memoria USB # Estas variables son auxiliares para definir la variable que sera de reporte en cuanto se sepa si hay unidad flash introducida self.nombreDirectorioLocal = os.getenv( 'HOME') + '/trafficFlow/prototipo11' self.nombreDirectorioUSB = '/media/' + os.getenv('HOME').split( '/')[-1] + '/usbName' if os.path.exists(self.nombreDirectorioUSB): self.carpetaDeReporte = self.nombreDirectorioUSB + '/' + nombreCarpetaAlmacenamiento self.miReporte.info( 'Encontrada unidad USB, guardando informacion en el medio: ' + self.carpetaDeReporte) self.carpetaDeReporteDebug = self.nombreDirectorioUSB + '/debug' else: self.carpetaDeReporte = self.nombreDirectorioLocal + '/' + nombreCarpetaAlmacenamiento self.miReporte.info( 'No se detectó unidad USB, guardando archivos de forma local:' + self.carpetaDeReporte) self.carpetaDeReporteDebug = self.nombreDirectorioLocal + '/casosDebug' if not os.path.exists(self.carpetaDeReporte): try: os.makedirs(self.carpetaDeReporte) except Exception as e: self.miReporte.error('ERROR, No pude crear el directorio ' + self.carpetaDeReporteDebug + ' por: ' + str(e)) if not os.path.exists(self.carpetaDeReporteDebug): try: os.makedirs(self.carpetaDeReporteDebug) except Exception as e: self.miReporte.error('ERROR, No pude crear el directorio ' + self.carpetaDeReporteDebug + ' por: ' + str(e)) # Si estoy en el raspberry creo la clase shooter self.miComputadora = os.uname()[1] if self.miComputadora == 'raspberrypi': #print('ESTOY TRABAJANDO EN LA PI, CREANDO SHOOTER SHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOTER') self.miCamara = Shooter(cutPoly=areaDeInteresPlacas) self.miReporte.debug('Creada camara de alta resolucion') # Creo las carpetas de reporte actual y para el debug, por ahora la misma self.fechaReporte = datetime.datetime.now().strftime( '%Y-%m-%d-%H-%M-%S') self.carpetaDeReporteActual = self.carpetaDeReporte + '/' + self.fechaReporte self.carpetaDeReporteActualDebug = self.carpetaDeReporteDebug + '/' + self.fechaReporte