---------------------------------------- GravError ----------------------------------------
| 218 | // GravError |
| 219 | // ---------------------------------------- |
| 220 | struct GravError { |
| 221 | GravError(const Eigen::Vector3d& grav_obs) : grav_obs_(grav_obs) {} |
| 222 | |
| 223 | template <typename T> |
| 224 | bool operator()(const T* const gvec, T* residuals) const { |
| 225 | Eigen::Matrix<T, 3, 1> grav_est; |
| 226 | grav_est << gvec[0], gvec[1], gvec[2]; |
| 227 | |
| 228 | for (int i = 0; i < 3; i++) { |
| 229 | residuals[i] = grav_est[i] - grav_obs_[i]; |
| 230 | } |
| 231 | |
| 232 | return true; |
| 233 | } |
| 234 | |
| 235 | // Factory function |
| 236 | static ceres::CostFunction* CreateCost(const Eigen::Vector3d& grav_obs) { |
| 237 | return (new ceres::AutoDiffCostFunction<GravError, 3, 3>( |
| 238 | new GravError(grav_obs))); |
| 239 | } |
| 240 | |
| 241 | private: |
| 242 | const Eigen::Vector3d& grav_obs_; |
| 243 | }; |
| 244 | |
| 245 | } // namespace glomap |
nothing calls this directly
no outgoing calls
no test coverage detected