Frankx  0.2.0
A High-Level Motion API for Franka
motion_data.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 
6 namespace movex {
7 
8 struct MotionData {
9  double velocity_rel {1.0}, acceleration_rel {1.0}, jerk_rel {1.0};
10  bool max_dynamics {false};
11 
12  std::vector<Reaction> reactions {};
13 
14  explicit MotionData(double dynamic_rel = 1.0): velocity_rel(dynamic_rel), acceleration_rel(dynamic_rel), jerk_rel(dynamic_rel) { }
15 
16  MotionData& withDynamicRel(double dynamic_rel) {
17  velocity_rel = dynamic_rel;
18  acceleration_rel = dynamic_rel;
19  jerk_rel = dynamic_rel;
20  return *this;
21  }
22 
25  max_dynamics = true;
26  return *this;
27  }
28 
30  MotionData& withReaction(const Reaction& reaction) {
31  reactions.push_back(reaction);
32  return *this;
33  }
34 
36  bool didBreak() {
37  return std::any_of(reactions.begin(), reactions.end(), [](auto r) { return r.has_fired; });
38  }
39 };
40 
41 } // namespace movex
movex::MotionData::jerk_rel
double jerk_rel
Definition: motion_data.hpp:9
movex::MotionData::withDynamicRel
MotionData & withDynamicRel(double dynamic_rel)
Definition: motion_data.hpp:16
movex::MotionData::didBreak
bool didBreak()
Whether any of the reactions did occur (fire) during the motion.
Definition: motion_data.hpp:36
movex::Reaction
Definition: reaction.hpp:16
movex::MotionData::MotionData
MotionData(double dynamic_rel=1.0)
Definition: motion_data.hpp:14
movex::MotionData
Definition: motion_data.hpp:8
reaction.hpp
movex::MotionData::max_dynamics
bool max_dynamics
Definition: motion_data.hpp:10
movex::MotionData::acceleration_rel
double acceleration_rel
Definition: motion_data.hpp:9
movex::MotionData::velocity_rel
double velocity_rel
Definition: motion_data.hpp:9
movex::MotionData::withMaxDynamics
MotionData & withMaxDynamics()
Use maximal possible dynamic of the robot.
Definition: motion_data.hpp:24
movex
Definition: motion_impedance.hpp:13
movex::MotionData::reactions
std::vector< Reaction > reactions
Definition: motion_data.hpp:12
movex::MotionData::withReaction
MotionData & withReaction(const Reaction &reaction)
Add a reaction to the motion.
Definition: motion_data.hpp:30