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 #include <tuw_multi_robot_msgs/RobotInfo.h>
10 
11 namespace velocity_controller
12 {
13 
14 typedef struct PathPrecondition_t
15 {
16  int robot;
19 
20 typedef struct PathPoint_t
21 {
22  float x;
23  float y;
24  float theta;
25  std::vector<PathPrecondition> precondition;
26 } PathPoint;
27 
28 typedef enum state_t
29 {
30  run,
31  stop,
32  step,
33  wait_step
34 } state;
35 
37 {
38 
39  public:
49  void setPath(std::shared_ptr<std::vector<PathPoint>> _path);
56  void update(PathPoint _odom, float _delta_t);
63  void setSpeedParams(float _max_v, float _max_w);
70  void getSpeed(float *_v, float *_w);
76  void setGoalRadius(float _r);
84  void setPID(float _Kp, float _Ki, float _Kd);
90  void setState(state s);
96  void updatePrecondition(PathPrecondition pc);
102  int getCount();
103 
104  int getStatus();
105  void setGoodId(int);
106  int getGoodId();
107  void setOrderId(int);
108  int getOrderId();
109  void setOrderStatus(int);
110  int getOrderStatus();
111 
112  bool getPlanActive() { return plan_active; }
113 
114  private:
115  bool checkPrecondition(PathPoint p);
116  float normalizeAngle(float _angle);
117  float absolute(float _val);
118  bool checkGoal(PathPoint _odom);
119  std::shared_ptr<std::vector<PathPoint>> path_;
120  float max_v_, max_w_;
121  float v_, w_;
122  int pathCounter_ = 0;
123  bool plan_active = false;
124  float e_last_ = 0;
125  float e_dot_ = 0;
126  float Kp_ = 5;
127  float Kd_ = 1;
128  float Ki_ = 0.0;
129  float goal_radius_ = 0.25;
130 
131  int robot_status = tuw_multi_robot_msgs::RobotInfo::STATUS_STOPPED;
132  int goodId;
133  int orderId;
135 
136  std::vector<int> actualPreconditions;
137 
138  state actual_cmd_ = run;
139 };
140 
141 } // namespace velocity_controller
142 
143 #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
std::vector< PathPrecondition > precondition
struct velocity_controller::PathPrecondition_t PathPrecondition


tuw_multi_robot_ctrl
Author(s): Benjamin Binder
autogenerated on Mon Feb 28 2022 23:57:38