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/StateSpaceUtil.h"
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
Vectord<3> PoseTo3dVector(const Pose2d& pose) {
|
|
|
|
|
return Vectord<3>{pose.Translation().X().value(),
|
|
|
|
|
pose.Translation().Y().value(),
|
|
|
|
|
pose.Rotation().Radians().value()};
|
2020-11-28 17:35:35 -05:00
|
|
|
}
|
|
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
Vectord<4> PoseTo4dVector(const Pose2d& pose) {
|
|
|
|
|
return Vectord<4>{pose.Translation().X().value(),
|
|
|
|
|
pose.Translation().Y().value(), pose.Rotation().Cos(),
|
|
|
|
|
pose.Rotation().Sin()};
|
2020-11-28 17:35:35 -05:00
|
|
|
}
|
|
|
|
|
|
2020-08-14 23:40:33 -07:00
|
|
|
template <>
|
2022-04-29 22:29:20 -07:00
|
|
|
bool IsStabilizable<1, 1>(const Matrixd<1, 1>& A, const Matrixd<1, 1>& B) {
|
2020-08-14 23:40:33 -07:00
|
|
|
return detail::IsStabilizableImpl<1, 1>(A, B);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
2022-04-29 22:29:20 -07:00
|
|
|
bool IsStabilizable<2, 1>(const Matrixd<2, 2>& A, const Matrixd<2, 1>& B) {
|
2020-08-14 23:40:33 -07:00
|
|
|
return detail::IsStabilizableImpl<2, 1>(A, B);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-29 22:29:20 -07:00
|
|
|
Vectord<3> PoseToVector(const Pose2d& pose) {
|
|
|
|
|
return Vectord<3>{pose.X().value(), pose.Y().value(),
|
|
|
|
|
pose.Rotation().Radians().value()};
|
2020-08-14 23:40:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frc
|