#include <learned_controller.h>
Public Member Functions | |
virtual void | adjust (float speed, float error, float *brake_req, float *throttle_req) |
virtual void | configure (art_pilot::PilotConfig &newconfig) |
int | getAction (const std::vector< float > &s) |
LearnedSpeedControl () | |
virtual void | reset (void) |
virtual | ~LearnedSpeedControl () |
Private Types | |
typedef const std::vector < float > * | state_t |
Private Member Functions | |
state_t | canonicalize (const std::vector< float > &s) |
void | loadPolicy (const char *filename) |
Private Attributes | |
bool | LOADDEBUG |
bool | loaded |
const int | numactions |
std::map< state_t, std::vector < float > > | Q |
std::vector< float > | s |
std::set< std::vector< float > > | statespace |
Acceleration matrix speed controller class
Definition at line 9 of file learned_controller.h.
typedef const std::vector<float>* LearnedSpeedControl::state_t [private] |
The implementation maps all sensations to a set of canonical pointers, which serve as the internal representation of environment state.
Definition at line 28 of file learned_controller.h.
Acceleration matrix speed control constructor.
Definition at line 8 of file learned_controller.cc.
LearnedSpeedControl::~LearnedSpeedControl | ( | ) | [virtual] |
LearnedSpeedControl destructor
Definition at line 26 of file learned_controller.cc.
void LearnedSpeedControl::adjust | ( | float | speed, |
float | error, | ||
float * | brake_req, | ||
float * | throttle_req | ||
) | [virtual] |
Adjust speed to match goal.
Generate brake and throttle changes from velocity PID controller via an acceleration matrix.
speed | absolute value of current velocity in m/sec |
error | immediate goal minus speed |
brake_req | -> previous brake request (input), updated brake request (output). |
throttle_req | -> previous throttle request (input), updated throttle request (output). |
Implements SpeedControl.
Definition at line 45 of file learned_controller.cc.
LearnedSpeedControl::state_t LearnedSpeedControl::canonicalize | ( | const std::vector< float > & | s | ) | [private] |
Produces a canonical representation of the given sensation.
s | The current sensation from the environment. |
Definition at line 150 of file learned_controller.cc.
void LearnedSpeedControl::configure | ( | art_pilot::PilotConfig & | newconfig | ) | [virtual] |
Configure controller parameters.
Implements SpeedControl.
Definition at line 123 of file learned_controller.cc.
int LearnedSpeedControl::getAction | ( | const std::vector< float > & | s | ) |
Definition at line 136 of file learned_controller.cc.
void LearnedSpeedControl::loadPolicy | ( | const char * | filename | ) | [private] |
Definition at line 165 of file learned_controller.cc.
void LearnedSpeedControl::reset | ( | void | ) | [virtual] |
Reset speed controller.
Implements SpeedControl.
Definition at line 128 of file learned_controller.cc.
bool LearnedSpeedControl::LOADDEBUG [private] |
Definition at line 50 of file learned_controller.h.
bool LearnedSpeedControl::loaded [private] |
Definition at line 51 of file learned_controller.h.
const int LearnedSpeedControl::numactions [private] |
Definition at line 48 of file learned_controller.h.
std::map<state_t, std::vector<float> > LearnedSpeedControl::Q [private] |
The primary data structure of the learning algorithm, the value function Q. For state_t s and int a, Q[s][a] gives the learned maximum expected future discounted reward conditional on executing action a in state s.
Definition at line 44 of file learned_controller.h.
std::vector<float> LearnedSpeedControl::s [private] |
Definition at line 23 of file learned_controller.h.
std::set<std::vector<float> > LearnedSpeedControl::statespace [private] |
Set of all distinct sensations seen. Pointers to elements of this set serve as the internal representation of the environment state.
Definition at line 38 of file learned_controller.h.