segment_controller.h
Go to the documentation of this file.
1 #ifndef SEGMENT_CONTROLLER_H
2 #define SEGMENT_CONTROLLER_H
3 
4 // ROS
5 #include <ros/ros.h>
6 #include <geometry_msgs/Twist.h>
7 #include <nav_msgs/Odometry.h>
8 #include <nav_msgs/Path.h>
9 
10 namespace velocity_controller
11 {
12 
13 typedef struct PathPrecondition_t
14 {
15  int robot;
18 
19 typedef struct PathPoint_t
20 {
21  float x;
22  float y;
23  float theta;
24  std::vector<PathPrecondition> precondition;
25 } PathPoint;
26 
27 typedef enum state_t
28 {
29  run,
30  stop,
31  step,
32  wait_step
33 } state;
34 
36 {
37 
38  public:
48  void setPath(std::shared_ptr<std::vector<PathPoint>> _path);
55  void update(PathPoint _odom, float _delta_t);
62  void setSpeedParams(float _max_v, float _max_w);
69  void getSpeed(float *_v, float *_w);
75  void setGoalRadius(float _r);
83  void setPID(float _Kp, float _Ki, float _Kd);
89  void setState(state s);
95  void updatePrecondition(PathPrecondition pc);
101  int getCount();
102 
103  bool getPlanActive() { return plan_active; }
104 
105  private:
106  bool checkPrecondition(PathPoint p);
107  float normalizeAngle(float _angle);
108  float absolute(float _val);
109  bool checkGoal(PathPoint _odom);
110  std::shared_ptr<std::vector<PathPoint>> path_;
111  float max_v_, max_w_;
112  float v_, w_;
113  int pathCounter_ = 0;
114  bool plan_active = false;
115  float e_last_ = 0;
116  float e_dot_ = 0;
117  float Kp_ = 5;
118  float Kd_ = 1;
119  float Ki_ = 0.0;
120  float goal_radius_ = 0.25;
121 
122  std::vector<int> actualPreconditions;
123 
124  state actual_cmd_ = run;
125 };
126 
127 } // namespace velocity_controller
128 
129 #endif // CONTROLLER_NODE_H
struct velocity_controller::Point_t PathPoint
XmlRpcServer s
std::shared_ptr< std::vector< PathPoint > > path_
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
enum velocity_controller::state_t state
TFSIMD_FORCE_INLINE Vector3 absolute() const
std::vector< PathPrecondition > precondition
struct velocity_controller::PathPrecondition_t PathPrecondition


tuw_multi_robot_ctrl
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:29