29 AngleModulus(units::radian_t{ret[angleStateIdx]}).value();
43 return [=](
auto a,
auto b) {
62 InputModulus(ret[angleStateIdx], -std::numbers::pi, std::numbers::pi);
76 return [=](
auto a,
auto b) {
return AngleAdd<States>(a, b, angleStateIdx); };
90template <
int CovDim,
int NumSigmas>
93 double sumSin = (sigmas.row(angleStatesIdx).unaryExpr([](
auto it) {
98 double sumCos = (sigmas.row(angleStatesIdx).unaryExpr([](
auto it) {
105 ret[angleStatesIdx] = std::atan2(sumSin, sumCos);
118template <
int CovDim,
int NumSigmas>
122 return [=](
auto sigmas,
auto Wm) {
Definition SystemServer.h:9
Vectord< States > AngleAdd(const Vectord< States > &a, const Vectord< States > &b, int angleStateIdx)
Adds a and b while normalizing the resulting value in the selected row as an angle.
Definition AngleStatistics.h:58
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition EigenCore.h:21
WPILIB_DLLEXPORT constexpr units::radian_t AngleModulus(units::radian_t angle)
Wraps an angle to the range -π to π radians (-180 to 180 degrees).
Definition MathUtil.h:213
Eigen::Vector< double, Size > Vectord
Definition EigenCore.h:12
Vectord< States > AngleResidual(const Vectord< States > &a, const Vectord< States > &b, int angleStateIdx)
Subtracts a and b while normalizing the resulting value in the selected row as if it were an angle.
Definition AngleStatistics.h:25
Vectord< CovDim > AngleMean(const Matrixd< CovDim, NumSigmas > &sigmas, const Vectord< NumSigmas > &Wm, int angleStatesIdx)
Computes the mean of sigmas with the weights Wm while computing a special angle mean for a select row...
Definition AngleStatistics.h:91
constexpr T InputModulus(T input, T minimumInput, T maximumInput)
Returns modulus of input.
Definition MathUtil.h:141