26#include <ceres/ceres.h>
35 yawPre(yawPre), weight(weight)
39 mutable_parameter_block_sizes()->push_back(1);
40 mutable_parameter_block_sizes()->push_back(1);
46 double** jacobians)
const override
53 const double yaw = parameters[0][0];
54 const double yawNext = parameters[1][0];
62 if (jacobians ==
nullptr)
70 if (
double* jacobian0 = jacobians[0]; jacobian0 !=
nullptr)
73 jacobian0[0] = weight * periodicDiffJ0.at(1);
74 jacobian0[1] = weight * periodicDiffJ1.at(0);
77 if (
double* jacobian1 = jacobians[1]; jacobian1 !=
nullptr)
81 jacobian1[1] = weight * periodicDiffJ1.at(1);
96 yawNext(yawNext), weight(weight)
100 mutable_parameter_block_sizes()->push_back(1);
101 mutable_parameter_block_sizes()->push_back(1);
107 double** jacobians)
const override
114 const double yawPre = parameters[0][0];
115 const double yaw = parameters[1][0];
123 if (jacobians ==
nullptr)
131 if (
double* jacobian0 = jacobians[0]; jacobian0 !=
nullptr)
134 jacobian0[0] = weight * periodicDiffJ0.at(0);
138 if (
double* jacobian1 = jacobians[1]; jacobian1 !=
nullptr)
141 jacobian1[0] = weight * periodicDiffJ0.at(1);
142 jacobian1[1] = weight * periodicDiffJ1.at(0);
149 const double yawNext;
157 prior(prior), weight(weight)
164 double** jacobians)
const override
166 const double yaw = parameters[0][0];
172 if (jacobians ==
nullptr)
176 double* jacobian = jacobians[0];
177 if (jacobian ==
nullptr)
183 jacobian[0] = weight * periodicDiffJ.at(1);
197 set_num_residuals(2);
199 mutable_parameter_block_sizes()->push_back(1);
200 mutable_parameter_block_sizes()->push_back(1);
201 mutable_parameter_block_sizes()->push_back(1);
207 double** jacobians)
const override
214 const double yawPrev = parameters[0][0];
215 const double yaw = parameters[1][0];
216 const double yawNext = parameters[2][0];
224 if (jacobians ==
nullptr)
233 if (
double* jacobian0 = jacobians[0]; jacobian0 !=
nullptr)
236 jacobian0[0] = weight * periodicDiffJ0.at(0);
240 if (
double* jacobian1 = jacobians[1]; jacobian1 !=
nullptr)
243 jacobian1[0] = weight * periodicDiffJ0.at(1);
244 jacobian1[1] = weight * periodicDiffJ1.at(0);
247 if (
double* jacobian2 = jacobians[2]; jacobian2 !=
nullptr)
251 jacobian2[1] = weight * periodicDiffJ1.at(1);
This file is part of ArmarX.
std::array< double, 2 > periodicDiffJacobian(const auto, const auto)
Partial derivatives of periodicDiff(a, b) with respect to a and b.
auto periodicDiff(const auto a, const auto b)
Signed, wrapped difference b - a, in (-pi, pi].
bool Evaluate(double const *const *parameters, double *residuals, double **jacobians) const override
OrientationPriorCostFunctor(const double prior, const double weight)
SmoothOrientationCostFunctor(const double weight)
bool Evaluate(double const *const *parameters, double *residuals, double **jacobians) const override
SmoothOrientationFixedNextCostFunctor(const double yawNext, const double weight)
bool Evaluate(double const *const *parameters, double *residuals, double **jacobians) const override
SmoothOrientationFixedPreCostFunctor(const double yawPre, const double weight)
bool Evaluate(double const *const *parameters, double *residuals, double **jacobians) const override