motion.hpp
Go to the documentation of this file.
1 
9 #ifndef QTCTRL_MOTION
10 #define QTCTRL_MOTION
11 
12 #include <iostream>
13 #include <string.h> // To get memcpy definition
14 
15 
28 class MotionModel {
29 
32  enum Limits {
33  vMin,
34  vMax,
36  aMin,
37  aMax,
41  };
42 
44  double limits[nbLimits];
45 
46 public:
59  MotionModel(const double& max_v, const double& max_omega,
60  const double& max_a, const double& max_gamma)
61  : MotionModel(-max_v, max_v, max_omega,
62  -max_a, max_a, -max_gamma, max_gamma) {}
63 
77  MotionModel(const double& min_v, const double& max_v,
78  const double& max_omega,
79  const double& min_a, const double& max_a,
80  const double& min_gamma, const double& max_gamma) {
81  double values[nbLimits] = { min_v, max_v, max_omega,
82  min_a, max_a, min_gamma, max_gamma };
83  set(values);
84  } // end of MotionModel(nbLimits x const double&)
85 
88  const double& minTranslVel() const { return limits[vMin]; }
89 
92  const double& maxTranslVel() const { return limits[vMax]; }
93 
96  const double& maxRotVel() const { return limits[omMax]; }
97 
101  const double& minTranslAcc() const { return limits[aMin]; }
102 
105  const double& maxTranslAcc() const { return limits[aMax]; }
106 
110  const double& minRotAcc() const { return limits[gmMin]; }
111 
114  const double& maxRotAcc() const { return limits[gmMax]; }
115 
124  double limAcc(const double& lim_dist, const double& dist,
125  const double& vel, const double& ldr_vel,
126  const double& time_step) const;
127 
149  void applyAccelerationFactors(double& trans_vel, double& rot_vel,
150  const double& trans_fact,
151  const double& rot_fact,
152  const double& time_step) const;
153 
169  void applyAccelerations(double& trans_vel, double& rot_vel,
170  const double& trans_acc,
171  const double& rot_acc,
172  const double& time_step) const;
173 
178  void set(const double values[nbLimits])
179  { memcpy(limits, values, sizeof(double) * nbLimits); }
180 
181 }; // end of class MotionModel
182 
183 #endif // QTCTRL_MOTION
double limits[nbLimits]
The array of limits.
Definition: motion.hpp:44
Limits
These are the indexes of the array of limits.
Definition: motion.hpp:32
const double & maxTranslAcc() const
Descriptive method, giving the maximum translation acceleration.
Definition: motion.hpp:105
Index of the maximum translation deceleration.
Definition: motion.hpp:36
const double & maxRotVel() const
Descriptive method, giving the maximum rotation velocity.
Definition: motion.hpp:96
Number of limits in the array.
Definition: motion.hpp:40
const double & minRotAcc() const
Descriptive method, giving the minimum rotation acceleration (or maximum rotation deceleration)...
Definition: motion.hpp:110
void applyAccelerationFactors(double &trans_vel, double &rot_vel, const double &trans_fact, const double &rot_fact, const double &time_step) const
Modify translation and rotation given velocities, applying the extremal accelerations multiplied by t...
Definition: motion.cpp:77
MotionModel(const double &max_v, const double &max_omega, const double &max_a, const double &max_gamma)
Minimum constructor, supposing that minimum velocities and accelerations is the opposite of the maxim...
Definition: motion.hpp:59
const double & minTranslAcc() const
Descriptive method, giving the minimum translation acceleration (or maximum translation deceleration)...
Definition: motion.hpp:101
MotionModel(const double &min_v, const double &max_v, const double &max_omega, const double &min_a, const double &max_a, const double &min_gamma, const double &max_gamma)
General constructor, supposing that minimum velocities and accelerations are not the opposite of the ...
Definition: motion.hpp:77
void applyAccelerations(double &trans_vel, double &rot_vel, const double &trans_acc, const double &rot_acc, const double &time_step) const
Modify translation and rotation given velocities, applying the given accelerations during the given t...
Definition: motion.cpp:129
Index of the minimum translation velocity.
Definition: motion.hpp:33
Index of the maximum rotation deceleration.
Definition: motion.hpp:38
const double & maxTranslVel() const
Descriptive method, giving the maximum translation velocity.
Definition: motion.hpp:92
This class defines a motion model, with the motion limits.
Definition: motion.hpp:28
const double & minTranslVel() const
Descriptive method, giving the minimum translation velocity.
Definition: motion.hpp:88
Index of the maximum translation acceleration.
Definition: motion.hpp:37
Index of the maximum rotation acceleration.
Definition: motion.hpp:39
Index of the maximum rotation velocity.
Definition: motion.hpp:35
Index of the maximum translation velocity.
Definition: motion.hpp:34
double limAcc(const double &lim_dist, const double &dist, const double &vel, const double &ldr_vel, const double &time_step) const
Descriptive method, giving the limit acceleration which ensure to avoid reaching limit distance for a...
Definition: motion.cpp:21
const double & maxRotAcc() const
Descriptive method, giving the maximum rotation acceleration.
Definition: motion.hpp:114


qt_ctrl
Author(s): Alexis Scheuer
autogenerated on Wed Dec 16 2020 15:51:32