ExactCubicTrajectoryTask.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 
9 
10 namespace mc_tasks
11 {
12 
22 struct MC_TASKS_DLLAPI ExactCubicTrajectoryTask : public SplineTrajectoryTask<ExactCubicTrajectoryTask>
23 {
25 
46  double duration,
47  double stiffness,
48  double weight,
49  const sva::PTransformd & target,
50  const std::vector<std::pair<double, Eigen::Vector3d>> & posWp = {},
51  const Eigen::Vector3d & init_vel = Eigen::Vector3d::Zero(),
52  const Eigen::Vector3d & init_acc = Eigen::Vector3d::Zero(),
53  const Eigen::Vector3d & end_vel = Eigen::Vector3d::Zero(),
54  const Eigen::Vector3d & end_acc = Eigen::Vector3d::Zero(),
55  const std::vector<std::pair<double, Eigen::Matrix3d>> & oriWp = {});
56 
79  unsigned int robotIndex,
80  const std::string & surfaceName,
81  double duration,
82  double stiffness,
83  double weight,
84  const sva::PTransformd & target,
85  const std::vector<std::pair<double, Eigen::Vector3d>> & posWp = {},
86  const Eigen::Vector3d & init_vel = Eigen::Vector3d::Zero(),
87  const Eigen::Vector3d & init_acc = Eigen::Vector3d::Zero(),
88  const Eigen::Vector3d & end_vel = Eigen::Vector3d::Zero(),
89  const Eigen::Vector3d & end_acc = Eigen::Vector3d::Zero(),
90  const std::vector<std::pair<double, Eigen::Matrix3d>> & oriWp = {});
91 
96  const mc_trajectory::ExactCubic & spline() const { return bspline; };
101  mc_trajectory::ExactCubic & spline() { return bspline; };
102 
105  void addToGUI(mc_rtc::gui::StateBuilder & gui) override;
106 
109  void posWaypoints(const std::vector<std::pair<double, Eigen::Vector3d>> & posWp);
110 
119  void constraints(const Eigen::Vector3d & init_vel,
120  const Eigen::Vector3d & init_acc,
121  const Eigen::Vector3d & end_vel,
122  const Eigen::Vector3d & end_acc);
123 
124 protected:
128  void targetPos(const Eigen::Vector3d & target);
129 
131  const Eigen::Vector3d & targetPos() const;
132 
133 protected:
135  sva::PTransformd initialPose_;
136 };
137 
138 } // namespace mc_tasks
#define MC_TASKS_DLLAPI
Definition: api.h:50
Definition: StabilizerStandingState.h:12
Definition: RobotFrame.h:22
Definition: Robots.h:16
Definition: StateBuilder.h:28
Track an exact cubic spline, that is a curve passing exactly through waypoints in position,...
Definition: ExactCubicTrajectoryTask.h:23
void constraints(const Eigen::Vector3d &init_vel, const Eigen::Vector3d &init_acc, const Eigen::Vector3d &end_vel, const Eigen::Vector3d &end_acc)
Initial and final velocity and acceleration constraints for the curve.
mc_trajectory::ExactCubic & spline()
accessor to the underlying spline (used by SplineTrajectoryTask)
Definition: ExactCubicTrajectoryTask.h:101
void addToGUI(mc_rtc::gui::StateBuilder &gui) override
Add interactive GUI elements to control the curve waypoints.
ExactCubicTrajectoryTask(const mc_rbdyn::RobotFrame &frame, double duration, double stiffness, double weight, const sva::PTransformd &target, const std::vector< std::pair< double, Eigen::Vector3d >> &posWp={}, const Eigen::Vector3d &init_vel=Eigen::Vector3d::Zero(), const Eigen::Vector3d &init_acc=Eigen::Vector3d::Zero(), const Eigen::Vector3d &end_vel=Eigen::Vector3d::Zero(), const Eigen::Vector3d &end_acc=Eigen::Vector3d::Zero(), const std::vector< std::pair< double, Eigen::Matrix3d >> &oriWp={})
Trajectory following an exact cubic spline with given initial and final acceleration/velocity....
sva::PTransformd initialPose_
Definition: ExactCubicTrajectoryTask.h:135
void targetPos(const Eigen::Vector3d &target)
Sets the curve target pose.
mc_trajectory::ExactCubic bspline
Definition: ExactCubicTrajectoryTask.h:134
const Eigen::Vector3d & targetPos() const
Returns the curve's target position.
const mc_trajectory::ExactCubic & spline() const
const accessor to the underlying spline (used by SplineTrajectoryTask)
Definition: ExactCubicTrajectoryTask.h:96
ExactCubicTrajectoryTask(const mc_rbdyn::Robots &robots, unsigned int robotIndex, const std::string &surfaceName, double duration, double stiffness, double weight, const sva::PTransformd &target, const std::vector< std::pair< double, Eigen::Vector3d >> &posWp={}, const Eigen::Vector3d &init_vel=Eigen::Vector3d::Zero(), const Eigen::Vector3d &init_acc=Eigen::Vector3d::Zero(), const Eigen::Vector3d &end_vel=Eigen::Vector3d::Zero(), const Eigen::Vector3d &end_acc=Eigen::Vector3d::Zero(), const std::vector< std::pair< double, Eigen::Matrix3d >> &oriWp={})
Trajectory following an exact cubic spline with given initial and final acceleration/velocity....
void posWaypoints(const std::vector< std::pair< double, Eigen::Vector3d >> &posWp)
Waypoints in position. The curve will pass exactly through these waypoints.
Generic CRTP implementation for a task tracking a curve in both position and orientation....
Definition: SplineTrajectoryTask.h:38
Represents an Exact Cubic spline : a curve that passes exactly through waypoints in position,...
Definition: ExactCubic.h:23