00001
00002
00003
00004
00005 #ifndef CAJUN_STEERING_LEADLAG_H
00006 #define CAJUN_STEERING_LEADLAG_H
00007
00008 #include "base_steering.H"
00009 #include "integral.H"
00010 #include "interp.H"
00011
00012 namespace cajun
00013 {
00014
00015
00016 class steering_leadlag_v1_t : public base_steering_t
00017 {
00018 private:
00019 double g1;
00020 double g2;
00021 double reverse_kp;
00022 double forward_kp;
00023
00024 integral convolution_sum;
00025
00026 double total;
00027
00028 double m_error[3];
00029 double m_tstamp[3];
00030
00031 double error[2];
00032 double tstamp[2];
00033 double m_steer[3];
00034
00035 double previous_steer[2];
00036 double max_turn;
00037 double dead_band;
00038 bool smoothen;
00039 double filter_reduction_value;
00040
00041 public:
00042 virtual void init()
00043 {
00044 for (unsigned i = 0; i < 2; i++)
00045 {
00046 tstamp[i] = 0;
00047 error[i] = 0;
00048 previous_steer[i] = 0;
00049 }
00050 for (unsigned i = 0; i < 3; i++)
00051 {
00052 m_tstamp[i] = 0;
00053 m_error[i] = 0;
00054 m_steer[i] = 0;
00055 }
00056 }
00057 steering_leadlag_v1_t (const conf_t &conf);
00058 bool read_config (const conf_t &conf);
00059 void steer (steering_data_t &steering,
00060 double steering_position,
00061 guide_data_t const &gd,
00062 heading_data_t const &heading_data,
00063 double speed_, bool forward, bool tight_path);
00064 };
00065
00066
00067
00068 class steering_leadlag_v2_t : public base_steering_t
00069 {
00070 private:
00071 interp_table_t g1;
00072 double g2;
00073 double g3;
00074 double reverse_kp;
00075 double forward_kp;
00076
00077 integral integral_sum;
00078 integral convolution_sum;
00079
00080 double total;
00081
00082 double m_error[3];
00083 double m_tstamp[3];
00084
00085 double error[2];
00086 double tstamp[2];
00087 double m_steer[3];
00088
00089 double previous_steer[2];
00090 double max_turn;
00091 double dead_band;
00092 bool smoothen;
00093 double filter_reduction_value;
00094
00095
00096 public:
00097 virtual void init()
00098 {
00099 for (unsigned i = 0; i < 2; i++)
00100 {
00101 tstamp[i] = 0;
00102 error[i] = 0;
00103 previous_steer[i] = 0;
00104 }
00105 for (unsigned i = 0; i < 3; i++)
00106 {
00107 m_tstamp[i] = 0;
00108 m_error[i] = 0;
00109 m_steer[i] = 0;
00110 }
00111 }
00112 steering_leadlag_v2_t (const conf_t &conf);
00113 bool read_config (const conf_t &conf);
00114 void steer (steering_data_t &steering,
00115 double steering_position,
00116 guide_data_t const &gd,
00117 heading_data_t const &heading_data,
00118 double speed_, bool forward, bool tight_path);
00119 };
00120 };
00121 #endif