Franky  0.9.1
A High-Level Motion API for Franka
linear_path.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Eigen/Core>
4 
5 #include "franky/path/path.hpp"
6 
7 namespace franky {
8 
9 template<size_t state_dimensions>
10 class LinearPath : public Path<state_dimensions> {
11  using Vector = Eigen::Matrix<double, state_dimensions, 1>;
12 
13  public:
14  LinearPath() : start_(Vector::Zero()), end_(Vector::Zero()) {}
15 
16  LinearPath(const LinearPath<state_dimensions> &linear_path) : start_(linear_path.start_), end_(linear_path.end_) {}
17 
18  explicit LinearPath(const Vector &start, const Vector &end) : start_(start), end_(end) {}
19 
20  PathStep<state_dimensions> operator()(double s) const override {
21  return {
22  start_ + s / this->length() * (end_ - start_),
23  (end_ - start_) / this->length(),
24  Vector::Zero(),
25  Vector::Zero()
26  };
27  }
28 
29  [[nodiscard]] inline double length() const override {
30  return (end_ - start_).norm();
31  }
32 
33  inline Vector max_ddq() const override {
34  return Vector::Zero();
35  }
36 
37  inline Vector max_dddq() const override {
38  return Vector::Zero();
39  }
40 
41  inline Vector start() const {
42  return start_;
43  }
44 
45  inline Vector end() const {
46  return end_;
47  }
48 
49  private:
50  Vector start_, end_;
51 };
52 
53 } // namespace franky
Definition: linear_path.hpp:10
PathStep< state_dimensions > operator()(double s) const override
Definition: linear_path.hpp:20
double length() const override
Definition: linear_path.hpp:29
LinearPath(const LinearPath< state_dimensions > &linear_path)
Definition: linear_path.hpp:16
LinearPath()
Definition: linear_path.hpp:14
LinearPath(const Vector &start, const Vector &end)
Definition: linear_path.hpp:18
Vector end() const
Definition: linear_path.hpp:45
Vector max_dddq() const override
Definition: linear_path.hpp:37
Vector start() const
Definition: linear_path.hpp:41
Vector max_ddq() const override
Definition: linear_path.hpp:33
Definition: path.hpp:16
Definition: gripper.cpp:3
Definition: path.hpp:8