HEBI C++ API  3.10.0
trajectory.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 
5 #include <memory>
6 #include <vector>
7 
8 #include "Eigen/Eigen"
9 #include "util.hpp"
10 
11 namespace hebi {
12 namespace trajectory {
13 
17 class Trajectory final {
18 private:
22  std::vector<HebiTrajectoryPtr> trajectories_;
23 
27  const size_t number_of_joints_;
28 
32  const size_t number_of_waypoints_;
33 
37  const double start_time_;
38 
42  const double end_time_;
43 
47  Trajectory(std::vector<HebiTrajectoryPtr> trajectories, size_t number_of_waypoints, double start_time,
48  double end_time);
49 
50 public:
79  static std::shared_ptr<Trajectory> createUnconstrainedQp(const Eigen::VectorXd& time_vector, const Eigen::MatrixXd& positions,
80  const Eigen::MatrixXd* velocities = nullptr,
81  const Eigen::MatrixXd* accelerations = nullptr);
82 
86  ~Trajectory() noexcept;
87 
92  size_t getJointCount() const { return number_of_joints_; }
93 
97  size_t getWaypointCount() const { return number_of_waypoints_; }
98 
102  double getStartTime() const { return start_time_; }
103 
107  double getEndTime() const { return end_time_; }
108 
113  double getDuration() const;
114 
128  bool getState(double time, Eigen::VectorXd* position, Eigen::VectorXd* velocity, Eigen::VectorXd* acceleration) const;
129 
130 private:
135 };
136 
137 } // namespace trajectory
138 } // namespace hebi
double getDuration() const
The time (in seconds) between the start and end of this trajectory.
Definition: trajectory.cpp:92
Definition: arm.cpp:10
size_t getJointCount() const
The number of independent position trajectories over the same time domain that are managed by this ob...
Definition: trajectory.hpp:92
double getStartTime() const
Get the time (in seconds) at which the defined trajectory begins.
Definition: trajectory.hpp:102
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:6
bool getState(double time, Eigen::VectorXd *position, Eigen::VectorXd *velocity, Eigen::VectorXd *acceleration) const
Returns the position, velocity, and acceleration for a given point in time along the trajectory.
Definition: trajectory.cpp:97
size_t getWaypointCount() const
The number of fixed waypoints that each joint is moving through.
Definition: trajectory.hpp:97
double getEndTime() const
Get the time (in seconds) at which the defined trajectory ends.
Definition: trajectory.hpp:107
static std::shared_ptr< Trajectory > createUnconstrainedQp(const Eigen::VectorXd &time_vector, const Eigen::MatrixXd &positions, const Eigen::MatrixXd *velocities=nullptr, const Eigen::MatrixXd *accelerations=nullptr)
Creates a smooth trajectory through a set of waypoints (position velocity and accelerations defined a...
Definition: trajectory.cpp:16
Represents a smooth trajectory through a set of waypoints.
Definition: trajectory.hpp:17
~Trajectory() noexcept
Destructor cleans up resources for trajectory.
Definition: trajectory.cpp:87