00001 #ifndef __LEARNED_SPEED_H_ 00002 #define __LEARNED_SPEED_H_ 00003 00004 #include "speed.h" 00005 #include <ros/ros.h> 00006 00007 00009 class LearnedSpeedControl: public SpeedControl 00010 { 00011 public: 00012 00013 LearnedSpeedControl(); 00014 virtual ~LearnedSpeedControl(); 00015 virtual void adjust(float speed, float error, 00016 float *brake_req, float *throttle_req); 00017 virtual void configure(art_pilot::PilotConfig &newconfig); 00018 virtual void reset(void); 00019 int getAction(const std::vector<float> &s); 00020 00021 private: 00022 00023 std::vector<float> s; 00024 00028 typedef const std::vector<float> *state_t; 00029 00033 state_t canonicalize(const std::vector<float> &s); 00034 00038 std::set<std::vector<float> > statespace; 00039 00044 std::map<state_t, std::vector<float> > Q; 00045 00046 void loadPolicy(const char* filename); 00047 00048 const int numactions; 00049 00050 bool LOADDEBUG; 00051 bool loaded; 00052 00053 }; 00054 00055 #endif