pub fn solve(&self) -> Result<(DMatrix<f32>, DMatrix<f32>), ControlError> {
        let K: DMatrix<f32>;
        let P: DMatrix<f32>;

        P = match solve_continuous_riccati_eigen(&self.A, &self.B, &self.Q, &self.R) {
            Ok(result) => result,
            Err(LinAlgError) => return Err(ControlError),
        };

        if let Some(Rinv) = &self.R.clone().try_inverse() {
            K = Rinv * &self.B.transpose() * &P;

            Ok((K, P))
        } else {
            return Err(ControlError);
        }
    }
/// Returns LQR gain and solution to the Continuous Algebraic Riccati Equation
Returns LQR gain and solution to the Continuous Algebraic Riccati Equation
Returns LQR gain and solution to the Continuous Algebraic Riccati Equation
pub fn solve(&self) -> Result<(DMatrix<f32>, DMatrix<f32>), ControlError> {
        let K: DMatrix<f32>;
        let P: DMatrix<f32>;
        P = match solve_continuous_riccati_eigen(&self.A, &self.B, &self.Q, &self.R) {
            Ok(result) => result,
            Err(LinAlgError) => return Err(ControlError),
        };
        if let Some(Rinv) = &self.R.clone().try_inverse() {
            K = Rinv * &self.B.transpose() * &P;
            Ok((K, P))
        } else {
            return Err(ControlError);
        }
    }
pub fn solve ( & self ) -> Result < ( DMatrix < f32 > , DMatrix < f32 > ) , ControlError > { let K : DMatrix < f32 > ; let P : DMatrix < f32 > ; P = match solve_continuous_riccati_eigen ( & self . A , & self . B , & self . Q , & self . R ) { Ok ( result ) => result , Err ( LinAlgError ) => return Err ( ControlError ) , } ; if let Some ( Rinv ) = & self . R . clone ( ) . try_inverse ( ) { K = Rinv * & self . B . transpose ( ) * & P ; Ok ( ( K , P ) ) } else { return Err ( ControlError ) ; } }
Returns LQR gain and solution to the Continuous Algebraic Riccati Equation
Returns LQR gain and solution to the Continuous Algebraic Riccati Equation
&self
&self