diff_drive_pose_controller.hpp
Go to the documentation of this file.
1 #ifndef YOCS_DIFF_DRIVE_POSE_CONTROLLER_HPP_
2 #define YOCS_DIFF_DRIVE_POSE_CONTROLLER_HPP_
3 
4 #include <string>
6 
7 namespace yocs
8 {
9 
36 {
37 public:
38  DiffDrivePoseController(std::string name, double v_max, double w_max, double dist_thres = 0.01, double orient_thres =
39  0.02,
40  double dist_eps = 0.01 * 0.2, double orient_eps = 0.02 * 0.2, double orientation_gain = 0.3,
41  double k_1 = 1.0, double k_2 = 3.0, double beta = 0.4, double lambda = 2.0, double v_min =
42  0.01,
43  double v_min_movement = 0.01, double w_min_movement = 0.01);
45  {
46  }
47 
48  void setVerbosity(const bool& verbose) { verbose_ = verbose; }
49 
54  virtual bool init()
55  {
56  return true;
57  }
58 
59  void setCurrentLimits(double v_min, double w_min, double v_max, double w_max);
60 
67  virtual void setInput(double distance_to_goal, double delta, double theta);
68 
73  virtual bool step();
74 
80  virtual void getControlOutput(double& v, double& w);
81 
82 protected:
86  virtual void calculateControls();
87 
88  virtual void controlPose();
89 
97  virtual double enforceMinMax(double& value, double min, double max);
98 
105  virtual double enforceMinVelocity(double value, double min);
106 
107  virtual void controlOrientation(double angle_difference);
108 
112  virtual void onGoalReached()
113  {
114 
115  }
116 
117 protected:
118  std::string name_;
120  double r_;
122  double delta_;
124  double theta_;
126  double v_;
130  double v_min_;
132  double v_max_;
134  double w_;
138  double w_min_;
140  double w_max_;
141 
143  double cur_;
145  double k_1_;
147  double k_2_;
152  double beta_;
157  double lambda_;
158 
161 
163  double dist_thres_;
169  double dist_eps_;
171  double orient_eps_;
173  bool verbose_;
174 };
175 
176 } /* end namespace */
177 #endif
double v_min_movement_
minimum linear base velocity at which we still move [m/s]
virtual void getControlOutput(double &v, double &w)
Get controller result / output after spinning.
double delta_
current heading of the base [rad]
double r_
distance to pose goal [m]
double dist_eps_
Error in distance above which pose is considered different.
bool verbose_
Enable or disable ros messages.
double k_2_
constant factor applied to the heading error feedback
virtual double enforceMinMax(double &value, double min, double max)
Enforce value to be between min and max.
virtual void controlOrientation(double angle_difference)
double orient_eps_
Error in orientation above which pose is considered different.
double w_
angular base velocity [rad/s]
A controller for driving a differential drive base to a pose goal or along a path specified by multip...
virtual bool init()
unused, overwrite if inherited (and needed)
double w_min_
(current) minimum angular base velocity [rad/s]
double cur_
path to goal curvature
double orientation_gain_
p gain for angle controller
bool pose_reached_
True, if pose has been reached (v == 0, w == 0)
virtual void onGoalReached()
Gets executed when goal is reached, use in child class.
double theta_
direction of the pose goal [rad]
double v_max_
maximum linear base velocity [m/s]
virtual void setInput(double distance_to_goal, double delta, double theta)
Set input of controller. Should be called before each spinOnce.
double w_min_movement_
minimum angular base velocity at which we still move [rad/s]
double v_min_
(current) minimum linear base velocity [m/s]
virtual void calculateControls()
Calculates the controls with the set variables (speed, goal etc.)
void setCurrentLimits(double v_min, double w_min, double v_max, double w_max)
TFSIMD_FORCE_INLINE const tfScalar & w() const
DiffDrivePoseController(std::string name, double v_max, double w_max, double dist_thres=0.01, double orient_thres=0.02, double dist_eps=0.01 *0.2, double orient_eps=0.02 *0.2, double orientation_gain=0.3, double k_1=1.0, double k_2=3.0, double beta=0.4, double lambda=2.0, double v_min=0.01, double v_min_movement=0.01, double w_min_movement=0.01)
int min(int a, int b)
double orient_thres_
lower bound for the orientation (w = 0)
double v_
linear base velocity [m/s]
double w_max_
maximum angular base velocity [rad/s]
double dist_thres_
lower bound for the distance (v = 0)
double k_1_
constant factor determining the ratio of the rate of change in theta to the rate of change in r ...
virtual double enforceMinVelocity(double value, double min)
Enforce the minimum velocity.
virtual bool step()
Execute one controller step.


yocs_diff_drive_pose_controller
Author(s): Marcus Liebhardt
autogenerated on Mon Jun 10 2019 15:53:50