def create_learner(self): A, B, _ = self.decoder.ssm.get_ssm_matrices( update_rate=self.decoder.binlen) Q = np.mat(np.diag([1., 1, 1, 0, 0, 0, 0])) R = self.cost_fn_scale * np.mat(np.eye(B.shape[1])) fb_ctrl = feedback_controllers.LQRController(A, B, Q, R) self.learner = clda.FeedbackControllerLearner(1, fb_ctrl) self.learn_flag = True
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)
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)
def create_learner(self): F, K = self.decoder.filt.get_sskf() pos_gain = np.mean(K[[0, 2], :] / K[[3, 5], :]) I = np.mat(np.eye(3)) B = np.mat(np.vstack([pos_gain * I, I, np.zeros(3)])) A = np.mat(F) Q = np.mat(np.diag([1., 1, 1, 0, 0, 0, 0])) R = np.mat(np.eye(3) * 1000) fb_ctrl = feedback_controllers.LQRController(A, B, Q, R) self.batch_size = int(self.batch_time / self.decoder.binlen) self.learner = clda.FeedbackControllerLearner(self.batch_size, fb_ctrl, style='additive')
def __init__(self, ssm, Q, R, **kwargs): ''' Constructor for SSMLFCAssister Parameters ---------- ssm: riglib.bmi.state_space_models.StateSpace instance The state-space model's A and B matrices represent the system to be controlled args: positional arguments These are ignored (none are necessary) kwargs: keyword arguments The constructor must be supplied with the 'kin_chain' kwarg, which must have the attribute 'link_lengths' This is specific to 'KinematicChain' plants. Returns ------- SSMLFCAssister instance ''' if ssm is None: raise ValueError("SSMLFCAssister requires a state space model!") A, B, W = ssm.get_ssm_matrices() self.lqr_controller = feedback_controllers.LQRController(A, B, Q, R)