Frankx  0.2.0
A High-Level Motion API for Franka
waypoint.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
4 
5 #include <Eigen/Geometry>
6 
7 #include <affx/affine.hpp>
8 
9 
10 namespace movex {
11 
12 struct Waypoint {
14  using Vector6d = Eigen::Matrix<double, 6, 1>;
15  using Vector7d = Eigen::Matrix<double, 7, 1>;
16 
17  enum class ReferenceType {
18  Absolute,
19  Relative
20  };
21 
23  std::optional<double> elbow;
25 
26 
28  double velocity_rel {1.0};
29 
31  bool max_dynamics {false};
32 
34  bool zero_velocity {false};
35 
37  std::optional<double> minimum_time;
38 
40  double blend_max_distance {0.0};
41 
42 
43  explicit Waypoint(): affine(Affine()), reference_type(ReferenceType::Absolute) {}
46 
51 
52  // explicit Waypoint(const Affine& affine, double blend_max_distance): affine(affine), blend_max_distance(blend_max_distance) {}
54 
55 
56  Affine getTargetAffine(const Affine& frame, const Affine& old_affine) const {
57  switch (reference_type) {
59  return affine * frame.inverse();
61  return old_affine * affine * frame.inverse();
62  }
63  }
64 
65  Vector7d getTargetVector(const Affine& old_affine, double old_elbow) const {
66  return getTargetVector(Affine(), old_affine, old_elbow);
67  }
68 
69  Vector7d getTargetVector(const Affine& frame, const Affine& old_affine, double old_elbow) const {
70  double new_elbow;
72  new_elbow = elbow.value_or(0.0) + old_elbow;
73  } else {
74  new_elbow = elbow.value_or(old_elbow);
75  }
76  return getTargetAffine(frame, old_affine).vector_with_elbow(new_elbow);
77  }
78 };
79 
80 } // namespace movex
movex::Waypoint::Waypoint
Waypoint(const Affine &affine, double elbow, ReferenceType reference_type=ReferenceType::Absolute)
Definition: waypoint.hpp:45
movex::Waypoint::getTargetAffine
Affine getTargetAffine(const Affine &frame, const Affine &old_affine) const
Definition: waypoint.hpp:56
movex::Waypoint::Affine
affx::Affine Affine
Definition: waypoint.hpp:13
movex::Waypoint::Waypoint
Waypoint(const Affine &affine, ReferenceType reference_type=ReferenceType::Absolute)
Definition: waypoint.hpp:44
movex::Waypoint::max_dynamics
bool max_dynamics
Dynamic Waypoint: Use maximal dynamics of the robot independent on other parameters.
Definition: waypoint.hpp:31
movex::Waypoint::elbow
std::optional< double > elbow
Definition: waypoint.hpp:23
movex::Waypoint::getTargetVector
Vector7d getTargetVector(const Affine &old_affine, double old_elbow) const
Definition: waypoint.hpp:65
movex::Waypoint::Vector6d
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: waypoint.hpp:14
movex::Waypoint::Waypoint
Waypoint(double minimum_time)
Definition: waypoint.hpp:48
movex::Waypoint::minimum_time
std::optional< double > minimum_time
Dynamic Waypoint: Minimum time to get to next waypoint.
Definition: waypoint.hpp:37
movex::Waypoint
Definition: waypoint.hpp:12
movex::Waypoint::affine
Affine affine
Definition: waypoint.hpp:22
movex::Waypoint::getTargetVector
Vector7d getTargetVector(const Affine &frame, const Affine &old_affine, double old_elbow) const
Definition: waypoint.hpp:69
movex::Waypoint::velocity_rel
double velocity_rel
Dynamic Waypoint: Relative velocity factor.
Definition: waypoint.hpp:28
movex::Waypoint::Vector7d
Eigen::Matrix< double, 7, 1 > Vector7d
Definition: waypoint.hpp:15
movex::Waypoint::Waypoint
Waypoint(const Affine &affine, std::optional< double > elbow, double blend_max_distance)
Definition: waypoint.hpp:53
movex::Waypoint::reference_type
ReferenceType reference_type
Definition: waypoint.hpp:24
movex::Waypoint::ReferenceType
ReferenceType
Definition: waypoint.hpp:17
movex::Waypoint::Waypoint
Waypoint(const Affine &affine, ReferenceType reference_type, double velocity_rel)
Definition: waypoint.hpp:49
frankx::Affine
affx::Affine Affine
Definition: motion_generator.hpp:15
movex::Waypoint::Waypoint
Waypoint()
Definition: waypoint.hpp:43
movex::Waypoint::ReferenceType::Relative
@ Relative
movex::Waypoint::ReferenceType::Absolute
@ Absolute
movex::Waypoint::blend_max_distance
double blend_max_distance
Path Waypoint: Maximum distance for blending.
Definition: waypoint.hpp:40
movex
Definition: motion_impedance.hpp:13
movex::Waypoint::zero_velocity
bool zero_velocity
Zero velocity Waypoint: Stop to zero velocity.
Definition: waypoint.hpp:34
movex::Waypoint::Waypoint
Waypoint(const Affine &affine, double elbow, ReferenceType reference_type, double velocity_rel)
Definition: waypoint.hpp:50
movex::Waypoint::Waypoint
Waypoint(bool zero_velocity)
Definition: waypoint.hpp:47