blob: fc532dbd122d7c56d66eeb5ee9bad6690a30fa7e [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001// 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 Schuh1e69f942020-11-14 15:06:14 -08004
5#include "frc/StateSpaceUtil.h"
6
7namespace frc {
8
James Kuszmaulcf324122023-01-14 14:07:17 -08009Vectord<3> PoseTo3dVector(const Pose2d& pose) {
10 return Vectord<3>{pose.Translation().X().value(),
11 pose.Translation().Y().value(),
12 pose.Rotation().Radians().value()};
Austin Schuh812d0d12021-11-04 20:16:48 -070013}
14
James Kuszmaulcf324122023-01-14 14:07:17 -080015Vectord<4> PoseTo4dVector(const Pose2d& pose) {
16 return Vectord<4>{pose.Translation().X().value(),
17 pose.Translation().Y().value(), pose.Rotation().Cos(),
18 pose.Rotation().Sin()};
Austin Schuh812d0d12021-11-04 20:16:48 -070019}
20
Austin Schuh1e69f942020-11-14 15:06:14 -080021template <>
James Kuszmaulcf324122023-01-14 14:07:17 -080022bool IsStabilizable<1, 1>(const Matrixd<1, 1>& A, const Matrixd<1, 1>& B) {
Austin Schuh1e69f942020-11-14 15:06:14 -080023 return detail::IsStabilizableImpl<1, 1>(A, B);
24}
25
26template <>
James Kuszmaulcf324122023-01-14 14:07:17 -080027bool IsStabilizable<2, 1>(const Matrixd<2, 2>& A, const Matrixd<2, 1>& B) {
Austin Schuh1e69f942020-11-14 15:06:14 -080028 return detail::IsStabilizableImpl<2, 1>(A, B);
29}
30
James Kuszmaulcf324122023-01-14 14:07:17 -080031Vectord<3> PoseToVector(const Pose2d& pose) {
32 return Vectord<3>{pose.X().value(), pose.Y().value(),
33 pose.Rotation().Radians().value()};
Austin Schuh1e69f942020-11-14 15:06:14 -080034}
35
36} // namespace frc