Go to the documentation of this file.00001
00011 #ifndef _ROBOTCAR_H_
00012 #define _ROBOTCAR_H_
00013
00014 #include <set>
00015 #include <rl_common/Random.h>
00016 #include <rl_common/core.hh>
00017
00020 class RobotCarVel: public Environment {
00021 public:
00022
00030 RobotCarVel(Random &rand, bool randomVel, bool upVel, bool tenToSix, bool lag);
00031
00032 virtual ~RobotCarVel();
00033
00034 virtual const std::vector<float> &sensation() const;
00035 virtual float apply(int action);
00036
00037 virtual bool terminal() const;
00038 virtual void reset();
00039
00040 virtual int getNumActions();
00041 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00042 virtual void getMinMaxReward(float* minR, float* maxR);
00043
00045 void setSensation(std::vector<float> newS);
00046
00047 virtual std::vector<experience> getSeedings();
00048
00050 experience getRandomVelSeed(float target);
00051
00053 experience getExp(float s0, float s1, float s2, float s3, int a);
00054
00055
00056
00058 float bound(float val, float min, float max);
00059
00060 protected:
00061 enum car_action_t {NOTHING, THROTTLE_UP, THROTTLE_DOWN, BRAKE_UP, BRAKE_DOWN};
00062
00063 private:
00064
00065 Random &rng;
00066
00067 std::vector<float> s;
00068 std::vector<float> hidden;
00069
00070 float &targetVel;
00071 float &currVel;
00072 float &trueThrottle;
00073 float &trueBrake;
00074 float &throttleTarget;
00075 float &brakeTarget;
00076
00077 const bool randomVel;
00078 const bool upVel;
00079 const bool tenToSix;
00080 const bool lag;
00081
00082 float brakePosVel;
00083 int actNum;
00084
00085 };
00086
00087 #endif