17 #ifndef CARTOGRAPHER_MAPPING_3D_ACCELERATION_COST_FUNCTION_H_ 18 #define CARTOGRAPHER_MAPPING_3D_ACCELERATION_COST_FUNCTION_H_ 21 #include "Eigen/Geometry" 24 namespace mapping_3d {
30 const Eigen::Vector3d& delta_velocity_imu_frame,
31 const double first_delta_time_seconds,
32 const double second_delta_time_seconds)
42 bool operator()(
const T*
const middle_rotation,
const T*
const start_position,
43 const T*
const middle_position,
const T*
const end_position,
44 const T*
const gravity_constant, T* residual)
const {
45 const Eigen::Matrix<T, 3, 1> imu_delta_velocity =
49 Eigen::Vector3d::UnitZ())
51 const Eigen::Matrix<T, 3, 1> start_velocity =
52 (Eigen::Map<const Eigen::Matrix<T, 3, 1>>(middle_position) -
53 Eigen::Map<
const Eigen::Matrix<T, 3, 1>>(start_position)) /
55 const Eigen::Matrix<T, 3, 1> end_velocity =
56 (Eigen::Map<const Eigen::Matrix<T, 3, 1>>(end_position) -
57 Eigen::Map<
const Eigen::Matrix<T, 3, 1>>(middle_position)) /
59 const Eigen::Matrix<T, 3, 1> delta_velocity = end_velocity - start_velocity;
61 (Eigen::Map<Eigen::Matrix<T, 3, 1>>(residual) =
68 static Eigen::Quaternion<T>
ToEigen(
const T*
const quaternion) {
69 return Eigen::Quaternion<T>(quaternion[0], quaternion[1], quaternion[2],
82 #endif // CARTOGRAPHER_MAPPING_3D_ACCELERATION_COST_FUNCTION_H_ const double scaling_factor_
bool operator()(const T *const middle_rotation, const T *const start_position, const T *const middle_position, const T *const end_position, const T *const gravity_constant, T *residual) const
const Eigen::Vector3d delta_velocity_imu_frame_
static Eigen::Quaternion< T > ToEigen(const T *const quaternion)
AccelerationCostFunction(const double scaling_factor, const Eigen::Vector3d &delta_velocity_imu_frame, const double first_delta_time_seconds, const double second_delta_time_seconds)
AccelerationCostFunction & operator=(const AccelerationCostFunction &)=delete
const double first_delta_time_seconds_
const double second_delta_time_seconds_