Example #1
0
    def run(self):
        try:
            self.setup()
            self.feedback.play('intro').get()

            if config.getboolean('main', 'emulator'):
                from gi.repository import Gtk
                import emulator

                window = emulator.EmulatorWindow()
                window.connect('delete-event', Gtk.main_quit)
                window.show_all()
                Gtk.main()
            else:
                main_loop = GObject.MainLoop()
                main_loop.run()
        except KeyboardInterrupt:
            pass
        except Exception, e:
            logger.exception(e)
            self._play_error()

            holdoff = config.getfloat('main', 'error_holdoff_time')
            if holdoff > 0:
                logger.info('Waiting %.2fs before exiting' % holdoff)
                time.sleep(holdoff)

            self.teardown()
            return 1
Example #2
0
def set_config(config):
    envName = "Environment Values"
    AHit.goal_x = config.getint(envName, "goal_x")
    AHit.goal_y = config.getint(envName, "goal_y")
    AHit.goal_z = config.getint(envName, "goal_z")

    AHit.shot_off_x = config.getint(envName, "shot_off_x")
    AHit.shot_off_z = config.getint(envName, "shot_off_z")

    AHit.magic_vel = config.getfloat(envName, "magic_vel")
    APosition.magic_vel = config.getfloat(envName, "magic_vel")
    magic_vel = 0.0043527

    AHit.normal_g = config.getfloat(envName, "normal_g")

    AHit.cutoff_time_to_goal = config.getfloat("Shot Detection", "cutoff_time_to_goal")
Example #3
0
	def move(self, ms):
		s = ms/1000.0
		dx, dy = self.velocity

		# obey gravity
		dy += config.getfloat('Physics','gravity') * s
		dy = copysign(min(config.getfloat('Physics','terminal_velocity'), abs(dy)), dy)
		self.velocity = dx,dy

		dx *= s
		dy *= s

		# Hard limit on speed
		v = ((dx **2) + (dy**2)) ** 0.5
		if abs(dy) > 15:
			debug('woosh')
			#dx = round(abs(dx) * 15.0 / v)
			dy = 15
			#dy = round(abs(dy) * 15.0 / v)

		self.displace(dx, dy)
		self.debug()
Example #4
0
    def setup(self):
        self.components = [
                Component('feedback', player.FeedbackPlayer,
                        assets_base_path=config.get('feedback_player', 'assets_base_path'),
                        volume=config.getfloat('feedback_player', 'volume'))
                ]

        if not config.getboolean('main', 'emulator'):
            self.components.append(Component('smc', smc.SMC, port=config.get('smc', 'serial_port')))

        self.components += [
                Component('playlist', playlist.PlaylistFetcher),
                Component('stations_pool', stationspool.StationsPool,
                        base_url=config.get('stations_pool', 'base_url'),
                        auth_code=get_auth_code()),
                Component('player', player.StreamPlayer),
                Component('main_controller', MainController, plumbing=self)
        ]

        for component in self.components:
            component.start()
            self.__dict__[component.tag] = component.proxy
Example #5
0
    _path = ''#'/content/drive/My Drive/Colab Notebooks/myblast/'
    
    config = configparser.ConfigParser()
    config.read(_path+'mixed_15720.ini')
    #gpu_tracker.track()
    encoder = model.get_encoder(config, "M")
    discriminator = model.get_discriminator(config)
    generator = model.get_generator(config)
    if torch.cuda.is_available():
        encoder = encoder.cuda()
        discriminator = discriminator.cuda()
        generator = generator.cuda()
    #classifier = model.get_classifier(config).cuda()
    #gpu_tracker.track()
    #optimC = optim.Adam(classifier.parameters(), lr=config.getfloat('training', 'lr'))
    optimE = optim.Adam(encoder.parameters(), lr=config.getfloat('training', 'lr')*0.01) 
    optimG = optim.Adam(generator.parameters(), lr=config.getfloat('training', 'lr'))
    optimD = optim.Adam(discriminator.parameters(), lr=config.getfloat('training', 'lr'))

    '''
    Quake_Smart_seq2 = data.read_dataset(_path+"../data/Quake_Smart-seq2/data.h5")
    Quake_10x = data.read_dataset(_path+"../data/Quake_10x/data.h5")
    merge = {"A":Quake_Smart_seq2, "B":Quake_10x}
    mergedexpr, mergedl = data.merge_datasets(merge)
    s = mergedexpr.sum(axis=1)
    x = (mergedexpr.T/s).T
    x = x * 10000
    x,y,z,w = data.split_data(x, mergedl, test_size=0.01)
    '''
    
    Baron_human = data.read_dataset(_path+"../data/Baron_human/data.h5")
from skimage.filters import threshold_mean, threshold_li, threshold_minimum, threshold_otsu
from skimage.morphology import convex_hull_object, convex_hull_image
from skimage.transform import hough_line
from skimage.color import rgb2grey
import numpy as np
import matplotlib.pyplot as plt
from skimage import measure
from skimage.measure import moments_hu, moments

import config
import detect_lines
import img_preprocessor

config = config.get_default_config()
SIDE_LENGTH = config.getint('SIDE_LENGTH')
ARROW_THRESHOLD = config.getfloat('ARROW_THRESHOLD')

templates = []
templates.append(sk.imread(config.get('TEMPLATE_PATH') + 'top.jpg'))
templates.append(sk.imread(config.get('TEMPLATE_PATH') + 'left.jpg'))
templates.append(sk.imread(config.get('TEMPLATE_PATH') + 'down.jpg'))
templates.append(sk.imread(config.get('TEMPLATE_PATH') + 'right.jpg'))
"""
Pfeilspitzen erkennen und dessen Mittelpunkte zurückgeben
"""


def get_arrowheads(img, lines):
    img = rgb2grey(img)
    img = skimage.img_as_ubyte(img)
Example #7
0
if __name__ == '__main__':
    #parser.add_argument('-save', type=str, default = './checkpoint/test/', help='place to save')
    _path = ''  #'/content/drive/My Drive/Colab Notebooks/myblast/'
    config = configparser.ConfigParser()
    config.read(_path + 'mixed_23341.ini')
    #gpu_tracker.track()
    encoder = model.get_encoder(config, "M").cuda()
    discriminator = model.get_discriminator(config).cuda()
    generator = model.get_generator(config).cuda()
    encoder = encoder.cpu()
    encoder = encoder.cuda()
    #classifier = model.get_classifier(config).cuda()
    #gpu_tracker.track()
    #optimC = optim.Adam(classifier.parameters(), lr=config.getfloat('training', 'lr'))
    optimE = optim.Adam(encoder.parameters(),
                        lr=config.getfloat('training', 'lr') * 0.01)
    optimG = optim.Adam(generator.parameters(),
                        lr=config.getfloat('training', 'lr'))
    optimD = optim.Adam(discriminator.parameters(),
                        lr=config.getfloat('training', 'lr'))

    Quake_Smart_seq2 = data.read_dataset(_path +
                                         "../data/Quake_Smart-seq2/data.h5")
    Quake_10x = data.read_dataset(_path + "../data/Quake_10x/data.h5")
    merge = {"A": Quake_Smart_seq2, "B": Quake_10x}
    mergedexpr, mergedl = data.merge_datasets(merge)
    s = mergedexpr.sum(axis=1)
    x = (mergedexpr.T / s).T
    x = x * 10000
    x, y, z, w = data.split_data(x, mergedl, test_size=0.01)
    '''
Example #8
0
	def jump_speed(self):
		if self.tall & self.state:
			speed = config.getfloat('Physics', 'tall_jump_speed')
		else:
			speed = config.getfloat('Physics', 'jump_speed')
		return speed
Example #9
0
	def heavy(self):
		return self.velocity[1] > config.getfloat('Physics','break_speed') and (self.state & self.fat)