most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown
Dependencies: mbed MODSERIAL FATFileSystem
OuterLoop.hpp
00001 #ifndef OUTERLOOP_HPP 00002 #define OUTERLOOP_HPP 00003 00004 #include "mbed.h" 00005 #include "PidController.hpp" 00006 #include "PosVelFilter.hpp" 00007 00008 // This class is an outer loop controller with its own instance of a position velocity filter. 00009 00010 class OuterLoop { 00011 public: 00012 OuterLoop(float interval, int sensor); 00013 00014 // functions for setting up 00015 void init(); 00016 void update(); 00017 void start(); 00018 void stop(); 00019 00020 void runOuterLoop(); 00021 00022 // setting and getting variables 00023 void setCommand(float cmd); 00024 float getCommand(); 00025 00026 float getOutput(); 00027 00028 float getPosition(); 00029 float getVelocity(); 00030 00031 void setControllerP(float P); 00032 float getControllerP(); 00033 00034 void setControllerI(float I); 00035 float getControllerI(); 00036 00037 void setControllerD(float D); 00038 float getControllerD(); 00039 00040 void setTravelLimit(float limit); 00041 float getTravelLimit(); 00042 00043 void setFilterFrequency(float frequency); 00044 float getFilterFrequency(); 00045 00046 void setDeadband(float deadband); 00047 float getDeadband(); 00048 bool toggleDeadband(bool toggle); 00049 00050 void setOutputOffset(float offset); 00051 float getOutputOffset(); 00052 00053 void setIHiLimit (float limit); // TZY, 3/1/18 Set saturation limit on controller integral 00054 void setILoLimit (float limit); // TZY, 3/1/18 Set saturation limit on controller integral 00055 00056 protected: 00057 PosVelFilter _filter; 00058 PIDController _pid; 00059 Ticker _pulse; 00060 00061 void refreshPVState(); 00062 00063 float _SetPoint; 00064 float _sensorVal; 00065 00066 // position and velocity in raw units 00067 float _position; 00068 float _velocity; 00069 00070 // setup parameters 00071 float _Pgain; 00072 float _Igain; 00073 float _Dgain; 00074 float _dt; 00075 float _filterFrequency; 00076 float _deadband; 00077 char _sensor; 00078 float _offset; 00079 }; 00080 00081 #endif
Generated on Thu Jul 14 2022 10:54:35 by 1.7.2