2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2020-08-14 23:40:33 -07:00
|
|
|
|
|
|
|
|
#include "frc/controller/LinearQuadraticRegulator.h"
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
|
|
|
|
LinearQuadraticRegulator<1, 1>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<1, 1>& A, const Matrixd<1, 1>& B,
|
2021-01-16 20:26:17 -08:00
|
|
|
const wpi::array<double, 1>& Qelems, const wpi::array<double, 1>& Relems,
|
2020-08-14 23:40:33 -07:00
|
|
|
units::second_t dt)
|
2020-09-03 20:53:17 -07:00
|
|
|
: LinearQuadraticRegulator(A, B, MakeCostMatrix(Qelems),
|
|
|
|
|
MakeCostMatrix(Relems), dt) {}
|
2020-08-14 23:40:33 -07:00
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
LinearQuadraticRegulator<1, 1>::LinearQuadraticRegulator(const Matrixd<1, 1>& A,
|
|
|
|
|
const Matrixd<1, 1>& B,
|
|
|
|
|
const Matrixd<1, 1>& Q,
|
|
|
|
|
const Matrixd<1, 1>& R,
|
|
|
|
|
units::second_t dt)
|
2020-08-14 23:40:33 -07:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<1, 1>(A, B, Q, R, dt) {}
|
|
|
|
|
|
2021-02-15 18:17:55 -08:00
|
|
|
LinearQuadraticRegulator<1, 1>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<1, 1>& A, const Matrixd<1, 1>& B, const Matrixd<1, 1>& Q,
|
|
|
|
|
const Matrixd<1, 1>& R, const Matrixd<1, 1>& N, units::second_t dt)
|
2021-02-15 18:17:55 -08:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<1, 1>(A, B, Q, R, N, dt) {}
|
|
|
|
|
|
2020-08-14 23:40:33 -07:00
|
|
|
LinearQuadraticRegulator<2, 1>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<2, 2>& A, const Matrixd<2, 1>& B,
|
2021-01-16 20:26:17 -08:00
|
|
|
const wpi::array<double, 2>& Qelems, const wpi::array<double, 1>& Relems,
|
2020-08-14 23:40:33 -07:00
|
|
|
units::second_t dt)
|
2020-09-03 20:53:17 -07:00
|
|
|
: LinearQuadraticRegulator(A, B, MakeCostMatrix(Qelems),
|
|
|
|
|
MakeCostMatrix(Relems), dt) {}
|
2020-08-14 23:40:33 -07:00
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
LinearQuadraticRegulator<2, 1>::LinearQuadraticRegulator(const Matrixd<2, 2>& A,
|
|
|
|
|
const Matrixd<2, 1>& B,
|
|
|
|
|
const Matrixd<2, 2>& Q,
|
|
|
|
|
const Matrixd<1, 1>& R,
|
|
|
|
|
units::second_t dt)
|
2020-08-14 23:40:33 -07:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<2, 1>(A, B, Q, R, dt) {}
|
|
|
|
|
|
2021-02-15 18:17:55 -08:00
|
|
|
LinearQuadraticRegulator<2, 1>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<2, 2>& A, const Matrixd<2, 1>& B, const Matrixd<2, 2>& Q,
|
|
|
|
|
const Matrixd<1, 1>& R, const Matrixd<2, 1>& N, units::second_t dt)
|
2021-02-15 18:17:55 -08:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<2, 1>(A, B, Q, R, N, dt) {}
|
|
|
|
|
|
2021-06-01 12:26:11 -07:00
|
|
|
LinearQuadraticRegulator<2, 2>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<2, 2>& A, const Matrixd<2, 2>& B,
|
2021-06-01 12:26:11 -07:00
|
|
|
const wpi::array<double, 2>& Qelems, const wpi::array<double, 2>& Relems,
|
|
|
|
|
units::second_t dt)
|
|
|
|
|
: LinearQuadraticRegulator(A, B, MakeCostMatrix(Qelems),
|
|
|
|
|
MakeCostMatrix(Relems), dt) {}
|
|
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
LinearQuadraticRegulator<2, 2>::LinearQuadraticRegulator(const Matrixd<2, 2>& A,
|
|
|
|
|
const Matrixd<2, 2>& B,
|
|
|
|
|
const Matrixd<2, 2>& Q,
|
|
|
|
|
const Matrixd<2, 2>& R,
|
|
|
|
|
units::second_t dt)
|
2021-06-01 12:26:11 -07:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<2, 2>(A, B, Q, R, dt) {}
|
|
|
|
|
|
|
|
|
|
LinearQuadraticRegulator<2, 2>::LinearQuadraticRegulator(
|
2022-04-29 22:29:20 -07:00
|
|
|
const Matrixd<2, 2>& A, const Matrixd<2, 2>& B, const Matrixd<2, 2>& Q,
|
|
|
|
|
const Matrixd<2, 2>& R, const Matrixd<2, 2>& N, units::second_t dt)
|
2021-06-01 12:26:11 -07:00
|
|
|
: detail::LinearQuadraticRegulatorImpl<2, 2>(A, B, Q, R, N, dt) {}
|
|
|
|
|
|
2020-08-14 23:40:33 -07:00
|
|
|
} // namespace frc
|