1 #ifndef CALICO_TRAJECTORY_H_
2 #define CALICO_TRAJECTORY_H_
4 #include "absl/container/flat_hash_map.h"
5 #include "absl/status/status.h"
6 #include "calico/bspline.h"
7 #include "calico/typedefs.h"
8 #include "ceres/problem.h"
9 #include "ceres/rotation.h"
19 int num_control_points;
20 Eigen::MatrixXd basis_matrix;
57 const absl::flat_hash_map<double, Pose3d>& poses_world_sensorrig,
66 void EnablePositionEstimation(
bool enable);
67 void EnableRotationEstimation(
bool enable);
84 absl::StatusOr<std::vector<Pose3d>>
85 Interpolate(
const std::vector<double>& interp_times)
const;
100 template <
typename T>
102 const Eigen::Vector3<T> phi = vector.head(3);
103 const Eigen::Vector3<T> pos = vector.tail(3);
105 ceres::AngleAxisToQuaternion(phi.data(), q.data());
106 const Eigen::Quaternion<T> rot(q(0), q(1), q(2), q(3));
111 const absl::flat_hash_map<double, Pose3d>&
trajectory()
const;
112 absl::flat_hash_map<double, Pose3d>&
trajectory();
121 absl::flat_hash_map<double, Pose3d> pose_id_to_pose_world_body_;
124 bool position_enabled_;
125 bool rotation_enabled_;
129 void UnwrapPhaseLogMap(std::vector<Eigen::Vector3d>& phi);
Definition: typedefs.h:38
Definition: trajectory.h:25
const absl::flat_hash_map< double, Pose3d > & trajectory() const
Setter/getter for the internal map between timestamp and pose.
Definition: trajectory.cpp:70
static constexpr int kDefaultSplineOrder
Default spline order of 6.
Definition: trajectory.h:28
static Pose3< T > VectorToPose3(const Eigen::Vector< T, 6 > &vector)
Definition: trajectory.h:101
absl::Status FitSpline(const absl::flat_hash_map< double, Pose3d > &poses_world_sensorrig, double knot_frequency=kDefaultKnotFrequency, int spline_order=kDefaultSplineOrder)
Definition: trajectory.cpp:14
const BSpline< 3 > & rotation_spline() const
Accessors for the rotation spline.
Definition: trajectory.h:70
int AddParametersToProblem(ceres::Problem &problem)
Definition: trajectory.cpp:53
TrajectoryEvaluationParams GetEvaluationParamsPosition(double stamp) const
Get the parameters needed to evaluate the position spline for a given timestamp.
Definition: trajectory.cpp:78
static constexpr double kDefaultKnotFrequency
Default knot frequency at 10Hz.
Definition: trajectory.h:31
TrajectoryEvaluationParams GetEvaluationParamsRotation(double stamp) const
Get the parameters needed to evaluate the rotation spline for a given timestamp.
Definition: trajectory.cpp:96
absl::StatusOr< std::vector< Pose3d > > Interpolate(const std::vector< double > &interp_times) const
Definition: trajectory.cpp:129
const BSpline< 3 > & position_spline() const
Accesors for the position spline.
Definition: trajectory.h:74
Primary calico namespace.
Definition: __init__.py:1
Definition: trajectory.h:14