InterpolatedRotation.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 #include <mc_trajectory/Spline.h>
9 #include <mc_trajectory/api.h>
10 
11 #include <Eigen/Geometry>
12 #include <utility>
13 #include <vector>
14 
15 namespace mc_trajectory
16 {
17 
22 : Spline<Eigen::Matrix3d, std::vector<std::pair<double, Eigen::Matrix3d>>>
23 {
24  using waypoint_t = std::pair<double, Eigen::Matrix3d>;
25 
26 public:
36  InterpolatedRotation(double duration,
37  const Eigen::Matrix3d & start,
38  const Eigen::Matrix3d & target,
39  const std::vector<waypoint_t> & waypoints = {});
40 
41  void update() override;
42 
49  Eigen::Matrix3d eval(double t);
50 
56  void waypoint(size_t idx, const Eigen::Matrix3d & ori);
63  const waypoint_t & waypoint(size_t idx) const;
64 
65 protected:
66  std::vector<waypoint_t> all_waypoints_;
67 };
68 
69 } // namespace mc_trajectory
#define MC_TRAJECTORY_DLLAPI
Definition: api.h:50
Definition: BSpline.h:15
Describes a trajectory with smoothly interpolate rotation between waypoints.
Definition: InterpolatedRotation.h:23
void update() override
Triggers recreation of the curve. Will only occur if the curve parameters were modified (waypoints,...
InterpolatedRotation(double duration, const Eigen::Matrix3d &start, const Eigen::Matrix3d &target, const std::vector< waypoint_t > &waypoints={})
Creates a trajectory that smoothly interpolates rotation in-between waypoints.
Eigen::Matrix3d eval(double t)
Evaluate the orientation at time t.
std::vector< waypoint_t > all_waypoints_
Definition: InterpolatedRotation.h:66
const waypoint_t & waypoint(size_t idx) const
Gets an existing waypoint.
void waypoint(size_t idx, const Eigen::Matrix3d &ori)
Modifies an existing waypoint.
std::pair< double, Eigen::Matrix3d > waypoint_t
Definition: InterpolatedRotation.h:24
Definition: Spline.h:15