Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 1 | // Copyright (c) FIRST and other WPILib contributors. |
| 2 | // Open Source Software; you can modify and/or share it under the terms of |
| 3 | // the WPILib BSD license file in the root directory of this project. |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 4 | |
| 5 | #include "frc/StateSpaceUtil.h" |
| 6 | |
| 7 | namespace frc { |
| 8 | |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 9 | Eigen::Vector3d PoseTo3dVector(const Pose2d& pose) { |
| 10 | return Eigen::Vector3d{pose.Translation().X().value(), |
| 11 | pose.Translation().Y().value(), |
| 12 | pose.Rotation().Radians().value()}; |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 13 | } |
| 14 | |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 15 | Eigen::Vector4d PoseTo4dVector(const Pose2d& pose) { |
| 16 | return Eigen::Vector4d{pose.Translation().X().value(), |
| 17 | pose.Translation().Y().value(), pose.Rotation().Cos(), |
| 18 | pose.Rotation().Sin()}; |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 19 | } |
| 20 | |
Maxwell Henderson | 80bec32 | 2024-01-09 15:48:44 -0800 | [diff] [blame^] | 21 | template bool IsStabilizable<1, 1>(const Matrixd<1, 1>& A, |
| 22 | const Matrixd<1, 1>& B); |
| 23 | template bool IsStabilizable<2, 1>(const Matrixd<2, 2>& A, |
| 24 | const Matrixd<2, 1>& B); |
| 25 | template bool IsStabilizable<Eigen::Dynamic, Eigen::Dynamic>( |
| 26 | const Eigen::MatrixXd& A, const Eigen::MatrixXd& B); |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 27 | |
| 28 | Eigen::Vector3d PoseToVector(const Pose2d& pose) { |
| 29 | return Eigen::Vector3d{pose.X().value(), pose.Y().value(), |
| 30 | pose.Rotation().Radians().value()}; |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | } // namespace frc |