Go to the documentation of this file.00001
00010 #ifndef PATHFOLLOWER_H
00011 #define PATHFOLLOWER_H
00012
00013 #include <rtm/Manager.h>
00014 #include <rtm/DataFlowComponentBase.h>
00015 #include <rtm/CorbaPort.h>
00016 #include <rtm/DataInPort.h>
00017 #include <rtm/DataOutPort.h>
00018 #include <rtm/idl/BasicDataTypeSkel.h>
00019 #include "intellirobotStub.h"
00020
00021
00022
00023 using namespace RTC;
00024
00025 class PathFollower
00026 : public RTC::DataFlowComponentBase
00027 {
00028 public:
00029 PathFollower(RTC::Manager* manager);
00030 ~PathFollower();
00031
00032
00033
00034 virtual RTC::ReturnCode_t onInitialize();
00035 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
00036 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00037
00038 protected:
00039
00040
00041 double m_max_v;
00042 double m_max_w;
00043 double m_max_acc_v;
00044 double m_max_acc_w;
00045 double m_line_C1;
00046 double m_line_K1;
00047 double m_line_K2;
00048 double m_line_K3;
00049 double m_line_Dist;
00050 double m_control_cycle;
00051
00052
00053
00054
00055
00056 IIS::TimedPose2D m_position;
00057 InPort<IIS::TimedPose2D> m_positionIn;
00058 Path m_target_path;
00059 InPort<Path> m_target_pathIn;
00060
00061
00062
00063
00064
00065 IIS::TimedVelocity2D m_velocity;
00066 OutPort<IIS::TimedVelocity2D> m_velocityOut;
00067
00068 private:
00069 int dummy;
00070 double now_x;
00071 double now_y;
00072 double now_theta;
00073 double target_v;
00074 double target_w;
00075
00076 int run_mode;
00077
00078 double path_x;
00079 double path_y;
00080 double path_theta;
00081 double path_v;
00082 double path_w;
00083 double path_d;
00084
00085 int do_control;
00086
00087
00088
00089 double circle_follow(double x,double y, double theta,
00090 double cx, double cy, double cradius,
00091 double v_max);
00092
00093
00094 double line_follow(double x,double y,double theta,
00095 double cx, double cy, double ctheta,
00096 double v_max);
00097
00098
00099 double regurator(double d, double q, double r, double v_max);
00100
00101
00102 double spin(double theta, double target_theta, double w_max);
00103
00104 double dist_pos(double x,double y, double tx, double ty);
00105
00106
00107
00108 int to_point(double x, double y,double theta,
00109 double tx, double ty, double ttheta,double max_vel);
00110
00111 int robot_speed_smooth(double v, double w);
00112 void path_following(double x, double y, double theta);
00113 void initPathFollower(void);
00114 void finalizePathFollower(void);
00115
00116
00117 };
00118
00119
00120 extern "C"
00121 {
00122 void PathFollowerInit(RTC::Manager* manager);
00123 };
00124
00125 #endif // PATHFOLLOWER_H