Zürcher Eliteeinheit / Mbed 2 deprecated ROME2_P6

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Controller.h Source File

Controller.h

00001 /*
00002  * Controller.h
00003  * Copyright (c) 2018, ZHAW
00004  * All rights reserved.
00005  */
00006 
00007 #ifndef CONTROLLER_H_
00008 #define CONTROLLER_H_
00009 
00010 #include <cstdlib>
00011 #include <mbed.h>
00012 #include "EncoderCounter.h"
00013 #include "Motion.h"
00014 #include "LowpassFilter.h"
00015 
00016 /**
00017  * This class implements the coordinate transformation, speed control and
00018  * the position estimation of a mobile robot with differential drive.
00019  */
00020 class Controller {
00021 
00022     public:
00023     
00024                     Controller(PwmOut& pwmLeft, PwmOut& pwmRight, EncoderCounter& counterLeft, EncoderCounter& counterRight);
00025         virtual     ~Controller();
00026         void        setTranslationalVelocity(float velocity);
00027         void        setRotationalVelocity(float velocity);
00028         float       getActualTranslationalVelocity();
00029         float       getActualRotationalVelocity();
00030         void        setX(float x);
00031         float       getX();
00032         void        setY(float y);
00033         float       getY();
00034         void        setAlpha(float alpha);
00035         float       getAlpha();
00036         void        correctPoseWithBeacon(float xActual, float yActual, float xMeasured, float yMeasured);
00037         
00038     private:
00039         
00040         static const float  PERIOD;
00041         static const float  PI;
00042         static const float  WHEEL_DISTANCE;
00043         static const float  WHEEL_RADIUS;
00044         static const float  COUNTS_PER_TURN;
00045         static const float  LOWPASS_FILTER_FREQUENCY;
00046         static const float  KN;
00047         static const float  KP;
00048         static const float  MAX_VOLTAGE;
00049         static const float  MIN_DUTY_CYCLE;
00050         static const float  MAX_DUTY_CYCLE;
00051         static const float  SIGMA_TRANSLATION;
00052         static const float  SIGMA_ORIENTATION;
00053         static const float  SIGMA_DISTANCE;
00054         static const float  SIGMA_GAMMA;
00055         
00056         PwmOut&             pwmLeft;
00057         PwmOut&             pwmRight;
00058         EncoderCounter&     counterLeft;
00059         EncoderCounter&     counterRight;
00060         Motion              translationalMotion;
00061         Motion              rotationalMotion;
00062         float               translationalVelocity;
00063         float               rotationalVelocity;
00064         float               actualTranslationalVelocity;
00065         float               actualRotationalVelocity;
00066         short               previousValueCounterLeft;
00067         short               previousValueCounterRight;
00068         LowpassFilter       speedLeftFilter;
00069         LowpassFilter       speedRightFilter;
00070         float               desiredSpeedLeft;
00071         float               desiredSpeedRight;
00072         float               actualSpeedLeft;
00073         float               actualSpeedRight;
00074         float               x;
00075         float               y;
00076         float               alpha;
00077         float               p[3][3];
00078         Ticker              ticker;
00079         
00080         void                run();
00081 };
00082 
00083 #endif /* CONTROLLER_H_ */
00084 
00085