Ruprecht Altenburger
/
RT2_P3_students_G4
Template for group 4
Fork of RT2_P3_students by
Revision 10:85840c065e00, committed 2018-04-27
- Comitter:
- altb
- Date:
- Fri Apr 27 06:34:29 2018 +0000
- Parent:
- 9:67ee46be0403
- Commit message:
- group 4, 1
Changed in this revision
diff -r 67ee46be0403 -r 85840c065e00 LinearCharacteristics.cpp --- a/LinearCharacteristics.cpp Tue Apr 24 09:17:04 2018 +0000 +++ b/LinearCharacteristics.cpp Fri Apr 27 06:34:29 2018 +0000 @@ -2,20 +2,3 @@ using namespace std; -LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics - this->gain = gain; - this->offset = offset; -} - -LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics - this->gain = (ymax - ymin)/(xmax - xmin); - this->offset = xmax - ymax/this->gain; -} - -LinearCharacteristics::~LinearCharacteristics() {} - - -float LinearCharacteristics::evaluate(float x) -{ -return this->gain*(x - this->offset); - }
diff -r 67ee46be0403 -r 85840c065e00 LinearCharacteristics.h --- a/LinearCharacteristics.h Tue Apr 24 09:17:04 2018 +0000 +++ b/LinearCharacteristics.h Fri Apr 27 06:34:29 2018 +0000 @@ -7,20 +7,13 @@ class LinearCharacteristics{ public: - LinearCharacteristics(float, float); - LinearCharacteristics(float, float, float, float); - float evaluate(float); - float operator()(float x){ - return evaluate(x); - } - //... - virtual ~LinearCharacteristics(); // here: the calculation function private: // here: private functions and values... - float gain; - float offset; + + + };
diff -r 67ee46be0403 -r 85840c065e00 main.cpp --- a/main.cpp Tue Apr 24 09:17:04 2018 +0000 +++ b/main.cpp Fri Apr 27 06:34:29 2018 +0000 @@ -51,13 +51,7 @@ //------------------------------------------ // ... here define variables like gains etc. //------------------------------------------ -//LinearCharacteristics i2u(0.8f,-2.0f); -LinearCharacteristics i2u(-2.0f,2.0f,0.0f,3.2f); //-------------DEFINE FILTERS---------------- -float tau = 1.0f; -IIR_filter f_ax(tau,Ts); // filter ax signals -IIR_filter f_ay(tau,Ts); // filter ay signals -IIR_filter f_gz(tau,Ts,tau); // filter gz signals //------------------------------------------ Ticker ControllerLoopTimer; // interrupt for control loop @@ -66,10 +60,6 @@ //------------------------------------------ // ... here define instantiate classes //------------------------------------------ -PI_Cntrl vel_cntrl(0.5f,.05f,Ts,0.4f); -//GPA gpa1(1.0f, 200.0f, 150, 4, 400, Ts, 10.0f, 0.3f); -// GPA(t fMin, t fMax, NfexcDes, NperMin, NmeasMin, Ts, Aexc0, Aexc1) -// ... define some linear characteristics ----------------------------------------- // ----- User defined functions ----------- void updateControllers(void); // speed controller loop (via interrupt) @@ -96,21 +86,12 @@ float vel = diff(counts); // motor velocity - /*float torq_des = vel_cntrl(excWobble + w_soll - vel); - excWobble = gpa1(torq_des,vel); - out.write(i2u(torq_des/0.217f)); // the controller! convert torque to Amps km = 0.217 Nm/A - */ - - //float phi1 = atan2(-f_ax(ax2ms2(ax.read())),f_ay(ax2ms2(ay.read()))) + PI/4.0f + f_gz(gz2om(gz.read()*3.3f)); - if(++k >= 249){ + if(++k >= 249){ k = 0; pc.printf("Some Output: %1.5f \r\n",PI); } } //****************************************************************************** //********** User functions like buttens handle etc. ************** -//****************************************************************************** -// pressed button -//****************************************************************************** //... \ No newline at end of file