multi_controller.h

Go to the documentation of this file.
00001 #ifndef __MULTI_CONTROLLER_H 00002 #define __MULTI_CONTROLLER_H 00003 00004 00005 #include <stdio.h> 00006 #include "abstractcontroller.h" 00007 00008 #include <vector> 00009 #include <list> 00010 00011 typedef std::vector<AbstractController*> ControllerContainer; 00012 00013 /** 00014 * class for robot controll with sine and cosine 00015 * 00016 * 00017 */ 00018 class MultiController : public AbstractController { 00019 public: 00020 00021 MultiController(); 00022 00023 /** initialisation of the controller with the given sensor/ motornumber 00024 Must be called before use. 00025 */ 00026 virtual void init(int sensornumber, int motornumber); 00027 00028 /// returns the name of the object (with version number) 00029 // virtual constparamkey getName() const {return name; } 00030 virtual paramkey getName() const; 00031 00032 /// @return Number of sensors the controller was initialised with or 0 if not initialised 00033 virtual int getSensorNumber() const; 00034 00035 00036 /// @return Number of motors the controller was initialised with or 0 if not initialised 00037 virtual int getMotorNumber() const; 00038 00039 /** performs one step (includes learning). 00040 Calculates motor commands from sensor inputs. 00041 @param sensor sensors inputs scaled to [-1,1] 00042 @param sensornumber length of the sensor array 00043 @param motor motors outputs. MUST have enough space for motor values! 00044 @param motornumber length of the provided motor array 00045 */ 00046 virtual void step(const sensor* sensors, int sensornumber, 00047 motor* motors, int motornumber); 00048 /** performs one step without learning. 00049 @see step 00050 */ 00051 virtual void stepNoLearning(const sensor* , int number_sensors, 00052 motor* , int number_motors); 00053 00054 /** The list of the names of all internal parameters given by getInternalParams(). 00055 @param: keylist (do NOT free it! It is a pointer to an internal structure) 00056 @return: length of the lists 00057 */ 00058 virtual std::list<iparamkey> getInternalParamNames() const; 00059 00060 /** The list of the names of all internal parameters given by getInternalParams(). 00061 */ 00062 virtual list<iparamval> getInternalParams() const; 00063 00064 virtual paramval getParam(const paramkey& key) const; 00065 virtual bool setParam(const paramkey& key, paramval val); 00066 virtual paramlist getParamList() const; 00067 00068 /** Initialises the registers the given callback functions. 00069 @param handling() is called every step that the camera gets new position 00070 and view. 00071 */ 00072 // virtual void setCameraHandling(void (*handling)()); 00073 // virtual void setCameraHandling() const; 00074 00075 00076 ControllerContainer& get_controller_container(); 00077 ControllerContainer::iterator get_active_controller(); 00078 void set_active_controller(ControllerContainer::iterator it); 00079 00080 void next_controller(); 00081 00082 protected: 00083 //string name; 00084 ControllerContainer controller_container; 00085 ControllerContainer::iterator it_active_controller; 00086 00087 /* 00088 int t; 00089 int number_sensors; 00090 int number_motors; 00091 int cameraHandlingDefined; 00092 00093 paramval velocity; 00094 paramval leftRightShift; 00095 paramval decreaseFactorVelocity; 00096 paramval decreaseFactorShift; 00097 */ 00098 00099 }; 00100 00101 #endif

Generated on Tue Jan 16 02:14:36 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8