Frankx  0.2.0
A High-Level Motion API for Franka
motion_waypoint.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <atomic>
4 #include <optional>
5 
6 #include <affx/affine.hpp>
7 #include <movex/waypoint.hpp>
8 
9 
10 namespace movex {
11 
18 
19  bool reload {false};
20  bool return_when_finished {true};
21 
22  std::vector<Waypoint> waypoints;
23 
24  explicit WaypointMotion() {}
25  explicit WaypointMotion(const std::vector<Waypoint>& waypoints): waypoints(waypoints) {}
27 
28  void setNextWaypoint(const Waypoint& waypoint) {
29  waypoints = { waypoint };
30  reload = true;
31  }
32 
33  void setNextWaypoints(const std::vector<Waypoint>& waypoints) {
34  this->waypoints = waypoints;
35  reload = true;
36  }
37 
38  void finish() {
39  return_when_finished = true;
40  reload = true;
41  }
42 };
43 
44 
45 struct LinearMotion: public WaypointMotion {
46  explicit LinearMotion(const Affine& target): WaypointMotion({ Waypoint(target) }) { }
47  explicit LinearMotion(const Affine& target, double elbow): WaypointMotion({ Waypoint(target, elbow) }) { }
48 };
49 
50 
53  explicit LinearRelativeMotion(const Affine& affine, double elbow): WaypointMotion({ Waypoint(affine, elbow, Waypoint::ReferenceType::Relative) }) { }
54  explicit LinearRelativeMotion(const Affine& affine, double elbow, double dynamic_rel): WaypointMotion({ Waypoint(affine, elbow, Waypoint::ReferenceType::Relative, dynamic_rel) }) { }
55 };
56 
57 
58 struct StopMotion: public WaypointMotion {
59  explicit StopMotion(): WaypointMotion() {
60  Waypoint stop_waypoint(Affine(), 0.0, Waypoint::ReferenceType::Relative);
61  stop_waypoint.max_dynamics = true;
62  waypoints = { stop_waypoint };
63  }
64 
65  explicit StopMotion(const Affine& affine): WaypointMotion() {
66  Waypoint stop_waypoint(affine, Waypoint::ReferenceType::Relative);
67  stop_waypoint.max_dynamics = true;
68  waypoints = { stop_waypoint };
69  }
70 
71  explicit StopMotion(const Affine& affine, double elbow): WaypointMotion() {
72  Waypoint stop_waypoint(affine, elbow, Waypoint::ReferenceType::Relative);
73  stop_waypoint.max_dynamics = true;
74  waypoints = { stop_waypoint };
75  }
76 };
77 
78 
79 struct PositionHold: public WaypointMotion {
80  explicit PositionHold(double duration): WaypointMotion({ Waypoint(duration) }) { }
81 };
82 
83 } // namespace movex
movex::WaypointMotion::setNextWaypoint
void setNextWaypoint(const Waypoint &waypoint)
Definition: motion_waypoint.hpp:28
movex::StopMotion::StopMotion
StopMotion(const Affine &affine, double elbow)
Definition: motion_waypoint.hpp:71
movex::Waypoint::max_dynamics
bool max_dynamics
Dynamic Waypoint: Use maximal dynamics of the robot independent on other parameters.
Definition: waypoint.hpp:31
movex::LinearMotion::LinearMotion
LinearMotion(const Affine &target)
Definition: motion_waypoint.hpp:46
movex::LinearRelativeMotion
Definition: motion_waypoint.hpp:51
movex::WaypointMotion::WaypointMotion
WaypointMotion(const std::vector< Waypoint > &waypoints)
Definition: motion_waypoint.hpp:25
movex::WaypointMotion::return_when_finished
bool return_when_finished
Definition: motion_waypoint.hpp:20
movex::Waypoint
Definition: waypoint.hpp:12
movex::WaypointMotion::Affine
affx::Affine Affine
Definition: motion_waypoint.hpp:17
movex::WaypointMotion::waypoints
std::vector< Waypoint > waypoints
Definition: motion_waypoint.hpp:22
movex::LinearMotion::LinearMotion
LinearMotion(const Affine &target, double elbow)
Definition: motion_waypoint.hpp:47
movex::PositionHold::PositionHold
PositionHold(double duration)
Definition: motion_waypoint.hpp:80
movex::WaypointMotion::WaypointMotion
WaypointMotion(const std::vector< Waypoint > &waypoints, bool return_when_finished)
Definition: motion_waypoint.hpp:26
movex::PositionHold
Definition: motion_waypoint.hpp:79
movex::WaypointMotion::WaypointMotion
WaypointMotion()
Definition: motion_waypoint.hpp:24
movex::WaypointMotion::finish
void finish()
Definition: motion_waypoint.hpp:38
movex::LinearRelativeMotion::LinearRelativeMotion
LinearRelativeMotion(const Affine &affine)
Definition: motion_waypoint.hpp:52
movex::WaypointMotion::reload
bool reload
Definition: motion_waypoint.hpp:19
movex::WaypointMotion
Definition: motion_waypoint.hpp:16
movex::StopMotion::StopMotion
StopMotion()
Definition: motion_waypoint.hpp:59
frankx::Affine
affx::Affine Affine
Definition: motion_generator.hpp:15
movex::LinearRelativeMotion::LinearRelativeMotion
LinearRelativeMotion(const Affine &affine, double elbow)
Definition: motion_waypoint.hpp:53
movex::Waypoint::ReferenceType::Relative
@ Relative
movex::LinearMotion
Definition: motion_waypoint.hpp:45
movex
Definition: motion_impedance.hpp:13
movex::StopMotion
Definition: motion_waypoint.hpp:58
waypoint.hpp
movex::StopMotion::StopMotion
StopMotion(const Affine &affine)
Definition: motion_waypoint.hpp:65
movex::LinearRelativeMotion::LinearRelativeMotion
LinearRelativeMotion(const Affine &affine, double elbow, double dynamic_rel)
Definition: motion_waypoint.hpp:54
movex::WaypointMotion::setNextWaypoints
void setNextWaypoints(const std::vector< Waypoint > &waypoints)
Definition: motion_waypoint.hpp:33