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 {
|
|
|
|
|
|
2023-08-31 11:03:37 -07:00
|
|
|
Eigen::Vector3d PoseTo3dVector(const Pose2d& pose) {
|
|
|
|
|
return Eigen::Vector3d{pose.Translation().X().value(),
|
|
|
|
|
pose.Translation().Y().value(),
|
|
|
|
|
pose.Rotation().Radians().value()};
|
2020-11-28 17:35:35 -05:00
|
|
|
}
|
|
|
|
|
|
2023-08-31 11:03:37 -07:00
|
|
|
Eigen::Vector4d PoseTo4dVector(const Pose2d& pose) {
|
|
|
|
|
return Eigen::Vector4d{pose.Translation().X().value(),
|
|
|
|
|
pose.Translation().Y().value(), pose.Rotation().Cos(),
|
|
|
|
|
pose.Rotation().Sin()};
|
2020-11-28 17:35:35 -05:00
|
|
|
}
|
|
|
|
|
|
2023-11-15 21:13:12 -08:00
|
|
|
template bool IsStabilizable<1, 1>(const Matrixd<1, 1>& A,
|
|
|
|
|
const Matrixd<1, 1>& B);
|
|
|
|
|
template bool IsStabilizable<2, 1>(const Matrixd<2, 2>& A,
|
|
|
|
|
const Matrixd<2, 1>& B);
|
|
|
|
|
template bool IsStabilizable<Eigen::Dynamic, Eigen::Dynamic>(
|
|
|
|
|
const Eigen::MatrixXd& A, const Eigen::MatrixXd& B);
|
2023-08-14 09:15:58 -07:00
|
|
|
|
2023-08-31 11:03:37 -07:00
|
|
|
Eigen::Vector3d PoseToVector(const Pose2d& pose) {
|
|
|
|
|
return Eigen::Vector3d{pose.X().value(), pose.Y().value(),
|
|
|
|
|
pose.Rotation().Radians().value()};
|
2020-08-14 23:40:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frc
|