Exemplo n.º 1
0
 def load_decoder(self):
     self.ssm = StateSpaceEndptVel2D()
     A, B, W = self.ssm.get_ssm_matrices()
     filt = MachineOnlyFilter(A, W)
     units = []
     self.decoder = Decoder(filt, units, self.ssm, binlen=0.1)
     self.decoder.n_features = 1
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        self.ssm = StateSpaceEndptVel2D()

        A, B, _ = self.ssm.get_ssm_matrices()
        Q = np.mat(np.diag([.5, .5, .5, .1, .1, .1, 0]))
        R = 10**6 * np.mat(np.eye(B.shape[1]))

        self.fb_ctrl = feedback_controllers.LQRController(A, B, Q, R)
        super(SimObs, self).__init__(*args, **kwargs)
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        dec_fname = os.path.expandvars('$FA_GROM_DATA/grom20160201_01_RMLC02011515.pkl')
        self.decoder = pickle.load(open(dec_fname))
        self.ssm = StateSpaceEndptVel2D()

        A, B, _ = self.ssm.get_ssm_matrices()
        Q = np.mat(np.diag([.5, .5, .5, .1, .1, .1, 0]))
        R = 10**6*np.mat(np.eye(B.shape[1]))
        
        self.fb_ctrl = feedback_controllers.LQRController(A, B, Q, R)
        super(SimObsCLDA, self).__init__(*args, **kwargs)
Exemplo n.º 4
0
def main_xz_CL_obstacles(session_length, task_kwargs=None):
    ssm_xz = StateSpaceEndptVel2D()
    Task = experiment.make(Sim_FA_Obs_BMI, [SaveHDF])
    targets = BMIResettingObstacles.centerout_2D_discrete_w_obstacle()
    task = Task(ssm_xz,
                targets,
                plant_type='cursor_14x14',
                session_length=session_length,
                **task_kwargs)
    task.run_sync()
    return task
    def __init__(self, *args, **kwargs):
        from riglib.bmi.state_space_models import StateSpaceEndptVel2D
        ssm = StateSpaceEndptVel2D()

        A, B, W = ssm.get_ssm_matrices()
        Q = np.mat(np.diag([1., 1, 1, 0, 0, 0, 0]))
        R = 10000 * np.mat(np.diag([1., 1., 1.]))
        self.fb_ctrl = LQRController(A, B, Q, R)

        self.ssm = ssm

        super(SimBMIControlMulti, self).__init__(*args, **kwargs)
Exemplo n.º 6
0
 def __init__(self,
              cost_err_ratio=10000.,
              include_vel_in_error=True,
              **kwargs):
     ssm = StateSpaceEndptVel2D()
     A, B, W = ssm.get_ssm_matrices()
     if include_vel_in_error:
         Q = np.mat(np.diag(np.array([1, 1, 1, 1, 1, 1, 0])))
     else:
         Q = np.mat(np.diag(np.array([1, 1, 1, 0, 0, 0, 0])))
     R = cost_err_ratio * np.mat(np.eye(len(ssm.drives_obs_inds)))
     super(EndPtAssisterOFC, self).__init__(A, B, Q, R)
Exemplo n.º 7
0
def main_xz_CL(session_length, task_kwargs=None):
    ssm_xz = StateSpaceEndptVel2D()
    Task = experiment.make(Sim_FA_BMI, [SaveHDF])
    targets = manualcontrolmultitasks.ManualControlMulti.centerout_2D_discrete(
    )
    task = Task(ssm_xz,
                targets,
                plant_type='cursor_14x14',
                session_length=session_length,
                **task_kwargs)
    task.run_sync()
    return task
Exemplo n.º 8
0
def main_xz(session_length):
    ssm_xz = StateSpaceEndptVel2D()
    Task = experiment.make(SimVFB, [SaveHDF])
    #targets = SimVFB.centerout_3D_discrete()
    targets = manualcontrolmultitasks.ManualControlMulti.centerout_2D_discrete(
    )
    task = Task(ssm_xz,
                SimVFB.xz_sim,
                targets,
                plant_type='cursor_14x14',
                session_length=session_length)
    task.run_sync()
    return task
Exemplo n.º 9
0
def main_xz_obs(session_length, task_kwargs=None):
    ssm_xz = StateSpaceEndptVel2D()
    Task = experiment.make(SimVFB_obs, [SaveHDF])
    targets = BMIResettingObstacles.centerout_2D_discrete_w_obstacle()
    C = np.random.normal(0, 2, (20, 7))
    task = Task(ssm_xz,
                C,
                targets,
                plant_type='cursor_14x14',
                session_length=session_length,
                **task_kwargs)

    task.run_sync()
    return task
Exemplo n.º 10
0
def main_xz(session_length, task_kwargs=None):
    ssm_xz = StateSpaceEndptVel2D()
    Task = experiment.make(SimVFB, [SaveHDF])
    targets = manualcontrolmultitasks.ManualControlMulti.centerout_2D_discrete(
    )
    C = np.random.normal(0, 2, (20, 7))
    task = Task(ssm_xz,
                C,
                targets,
                plant_type='cursor_14x14',
                session_length=session_length,
                **task_kwargs)

    task.run_sync()
    return task
Exemplo n.º 11
0
    def __init__(self, *args, **kwargs):
        from riglib.bmi.state_space_models import StateSpaceEndptVel2D
        ssm = StateSpaceEndptVel2D()
        A, B, W = ssm.get_ssm_matrices(update_rate=1. / 180)
        Q = np.mat(np.diag([1., 1, 1, 0, 0, 0, 0]))
        R = 100 * np.mat(np.diag([1., 1., 1.]))
        self.fb_ctrl = LQRController(A, B, Q, R)

        self.ssm = ssm

        super(SimCLDAControlMultiDispl2D_PPF, self).__init__(*args, **kwargs)
        self.batch_time = 1. / 10  #60.  # TODO 10 Hz running seems to be hardcoded somewhere
        self.assist_level = 0., 0.
        self.assist_level_time = 120.
        self.last_get_spike_counts_time = -1. / 60
        self.learn_flag = True