00001
00002
00003
00004 #ifndef CAJUN_SAFETY_SPEED_CONTROLLER_H
00005 #define CAJUN_SAFETY_SPEED_CONTROLLER_H
00006
00007 #include "conf.H"
00008 #include "data_type.H"
00009 #include "uniform_path.H"
00010
00011 #include <vector>
00012
00013 namespace cajun
00014 {
00030 class safe_speed_advisor_t
00031 {
00032 public:
00033 safe_speed_advisor_t (const conf_t &steering_conf);
00034 double max_speed_limit (double tstamp_, double speed_,
00035 double heading_, double path_delay,
00036 int goal_index, guide_data_t gd_);
00037 void set_safe_path_speeds (uniform_path_t &path,
00038 bool quick_acceleration_);
00039
00041 double path_timeout_for_pause ();
00042 struct interp_entry_t
00043 {
00044 double range;
00045 double limit;
00046 };
00047
00048 struct speed_for_delay_t
00049 {
00050 double delay;
00051 double speed;
00052 };
00053 private:
00054
00055 std::vector<speed_for_delay_t> m_speed_for_delay;
00056 std::vector<interp_entry_t> m_path_turn_speeds;
00057
00058 std::vector<interp_entry_t> m_heading_error_speed_limit;
00059 std::vector<interp_entry_t> m_heading_rate_speed_limit;
00060 std::vector <double> m_turn_speed;
00061 heading_data_t m_heading[2];
00062 double m_config_track_speed;
00063 double m_suggested_deceleration;
00064 double m_suggested_acceleration;
00065 double m_suggested_high_acceleration;
00066 double m_path_speed_LAD;
00067
00068 bool read_conf (const conf_t &steering_conf);
00069 double speed_at_orientation_diff (double orient_diff);
00070 double suggested_speed_for_cbln_delay (double cbln_delay_);
00071 double interpolate_value (std::vector <interp_entry_t> &table_,
00072 double value_);
00073 double relative_speed_at_heading_error (double h_error_);
00074 double relative_speed_at_heading_rate (double tstamp_, double h_);
00075
00076 double safe_approach_speed (double waypoint_speed,
00077 double dis_between_points,
00078 double suggested_deceleration);
00079 void set_consistent_speed_limits (uniform_path_t &path,
00080 bool quick_acceleration_);
00081 void set_consistent_speed (uniform_path_t &path_, unsigned path_id_,
00082 unsigned ref_id_,
00083 double suggested_deceleration);
00084 double orient_at_path (uniform_path_t &path, unsigned ind);
00085 void set_turn_path_speeds (uniform_path_t &path);
00086 unsigned LA_path_index (uniform_path_t &path, unsigned ind,
00087 double dis_);
00088 double speed_limit_for_orient_change (double orient_diff);
00089 };
00090 };
00091
00092 #endif