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

Committer:
mkelly10
Date:
Fri Oct 20 11:41:22 2017 +0000
Revision:
9:d5fcdcb3c89d
Child:
10:085ab7328054
Tested 10/19/17 Folders

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mkelly10 9:d5fcdcb3c89d 1 #include "mbed.h"
mkelly10 9:d5fcdcb3c89d 2 #include "LinearActuator.hpp"
mkelly10 9:d5fcdcb3c89d 3 #include "StaticDefs.hpp"
mkelly10 9:d5fcdcb3c89d 4 #include "ConfigFile.h"
mkelly10 9:d5fcdcb3c89d 5
mkelly10 9:d5fcdcb3c89d 6 LinearActuator::LinearActuator(float interval, PinName pwm, PinName dir, PinName reset, PinName limit, int adc_ch):
mkelly10 9:d5fcdcb3c89d 7 _motor(pwm, dir, reset),
mkelly10 9:d5fcdcb3c89d 8 _filter(),
mkelly10 9:d5fcdcb3c89d 9 _pid(),
mkelly10 9:d5fcdcb3c89d 10 //_time(),
mkelly10 9:d5fcdcb3c89d 11 _pulse(),
mkelly10 9:d5fcdcb3c89d 12 _limitSwitch(limit)
mkelly10 9:d5fcdcb3c89d 13 {
mkelly10 9:d5fcdcb3c89d 14 _limitSwitch.fall(callback(this, &LinearActuator::_switchPressed));
mkelly10 9:d5fcdcb3c89d 15 // this is where the variables that can be set are set when the object is created
mkelly10 9:d5fcdcb3c89d 16 _Pgain = 0.10;
mkelly10 9:d5fcdcb3c89d 17 _Igain = 0.0;
mkelly10 9:d5fcdcb3c89d 18 _Dgain = 0.0;
mkelly10 9:d5fcdcb3c89d 19
mkelly10 9:d5fcdcb3c89d 20 _filterFrequency = 1.0;
mkelly10 9:d5fcdcb3c89d 21
mkelly10 9:d5fcdcb3c89d 22 _adc_channel = adc_ch;
mkelly10 9:d5fcdcb3c89d 23
mkelly10 9:d5fcdcb3c89d 24 _dt = interval;
mkelly10 9:d5fcdcb3c89d 25
mkelly10 9:d5fcdcb3c89d 26 _init = true;
mkelly10 9:d5fcdcb3c89d 27 _paused = false;
mkelly10 9:d5fcdcb3c89d 28 _limit = false;
mkelly10 9:d5fcdcb3c89d 29 _slope = 498.729/4096; //this value should be correct for our current string pots using .625" diameter and 12 bit ADC
mkelly10 9:d5fcdcb3c89d 30 _deadband = 0.5;
mkelly10 9:d5fcdcb3c89d 31
mkelly10 9:d5fcdcb3c89d 32 }
mkelly10 9:d5fcdcb3c89d 33
mkelly10 9:d5fcdcb3c89d 34 void LinearActuator::init()
mkelly10 9:d5fcdcb3c89d 35 {
mkelly10 9:d5fcdcb3c89d 36 // initialize and start all of the member objects.
mkelly10 9:d5fcdcb3c89d 37 // The pos-velocity filter for this item needs to be allowed to converge
mkelly10 9:d5fcdcb3c89d 38 // Before turning over control to the motor
mkelly10 9:d5fcdcb3c89d 39 // make sure that adc().init is called in mainline code before calling this function
mkelly10 9:d5fcdcb3c89d 40
mkelly10 9:d5fcdcb3c89d 41 //load gains into pid controller this should eventually be in a config file
mkelly10 9:d5fcdcb3c89d 42 setFilterFrequency(_filterFrequency);
mkelly10 9:d5fcdcb3c89d 43 setControllerP(_Pgain);
mkelly10 9:d5fcdcb3c89d 44 setControllerI(_Igain);
mkelly10 9:d5fcdcb3c89d 45 setControllerD(_Dgain);
mkelly10 9:d5fcdcb3c89d 46
mkelly10 9:d5fcdcb3c89d 47 //setup the controller object
mkelly10 9:d5fcdcb3c89d 48 //set deadband and limits
mkelly10 9:d5fcdcb3c89d 49 toggleDeadband(true);
mkelly10 9:d5fcdcb3c89d 50 setDeadband(_deadband);
mkelly10 9:d5fcdcb3c89d 51
mkelly10 9:d5fcdcb3c89d 52 }
mkelly10 9:d5fcdcb3c89d 53
mkelly10 9:d5fcdcb3c89d 54 void LinearActuator::update()
mkelly10 9:d5fcdcb3c89d 55 {
mkelly10 9:d5fcdcb3c89d 56
mkelly10 9:d5fcdcb3c89d 57
mkelly10 9:d5fcdcb3c89d 58 //update the position velocity filter
mkelly10 9:d5fcdcb3c89d 59 if (_adc_channel == 0) {
mkelly10 9:d5fcdcb3c89d 60 _filter.update(_dt, adc().readCh0());
mkelly10 9:d5fcdcb3c89d 61 } else if (_adc_channel == 1) {
mkelly10 9:d5fcdcb3c89d 62 _filter.update(_dt, adc().readCh1());
mkelly10 9:d5fcdcb3c89d 63 } else {
mkelly10 9:d5fcdcb3c89d 64 error("\n\r This ADC channel does not exist");
mkelly10 9:d5fcdcb3c89d 65 }
mkelly10 9:d5fcdcb3c89d 66
mkelly10 9:d5fcdcb3c89d 67 //refresh the filter results and load into class variables
mkelly10 9:d5fcdcb3c89d 68 refreshPVState();
mkelly10 9:d5fcdcb3c89d 69
mkelly10 9:d5fcdcb3c89d 70 // update the PID controller with latest data
mkelly10 9:d5fcdcb3c89d 71 _pid.update(_position_mm, _velocity_mms, _filter.getDt());
mkelly10 9:d5fcdcb3c89d 72
mkelly10 9:d5fcdcb3c89d 73 if (_init) {
mkelly10 9:d5fcdcb3c89d 74 //The initialization phase is active
mkelly10 9:d5fcdcb3c89d 75 //dont run the motors until the velocity stabilizes
mkelly10 9:d5fcdcb3c89d 76 if (abs(_velocity_mms)<0.1) {
mkelly10 9:d5fcdcb3c89d 77 //we must be converged and can now release the motor controls
mkelly10 9:d5fcdcb3c89d 78 _init = false;
mkelly10 9:d5fcdcb3c89d 79 }
mkelly10 9:d5fcdcb3c89d 80 } else if (_limit) {
mkelly10 9:d5fcdcb3c89d 81 //if you end up here, an interrupt was triggered by an edge detection
mkelly10 9:d5fcdcb3c89d 82 //case on the limit switch. That function would have stopped the motor
mkelly10 9:d5fcdcb3c89d 83 //This logic should allow it to be re-enabled if the output being asked
mkelly10 9:d5fcdcb3c89d 84 //for by the controller is the correct direction.
mkelly10 9:d5fcdcb3c89d 85
mkelly10 9:d5fcdcb3c89d 86 if (_pid.getOutput() < 0.0) { //a negative pid output results in motion toward the switch
mkelly10 9:d5fcdcb3c89d 87 //dont let the motor run
mkelly10 9:d5fcdcb3c89d 88 return;
mkelly10 9:d5fcdcb3c89d 89 } else {
mkelly10 9:d5fcdcb3c89d 90 //We are now trucking along in the correct direction, it is ok to
mkelly10 9:d5fcdcb3c89d 91 //reset the limit variable and allow the motor to run
mkelly10 9:d5fcdcb3c89d 92 _limit = false;
mkelly10 9:d5fcdcb3c89d 93 }
mkelly10 9:d5fcdcb3c89d 94 } else if (_paused) {
mkelly10 9:d5fcdcb3c89d 95 //if you get here, the pause function has stopped the motor
mkelly10 9:d5fcdcb3c89d 96 //the only way out is for a function call to unpause the motor
mkelly10 9:d5fcdcb3c89d 97 //this case also keeps the controller disconnected in the event that
mkelly10 9:d5fcdcb3c89d 98 //homing is happening
mkelly10 9:d5fcdcb3c89d 99 return;
mkelly10 9:d5fcdcb3c89d 100 }
mkelly10 9:d5fcdcb3c89d 101
mkelly10 9:d5fcdcb3c89d 102 else {
mkelly10 9:d5fcdcb3c89d 103 //pipe controller data into the motor driver
mkelly10 9:d5fcdcb3c89d 104 //check that the limit switch is not pressed and if it is only let the
mkelly10 9:d5fcdcb3c89d 105 //motor run if the command is a negative number
mkelly10 9:d5fcdcb3c89d 106 //this catches the case where the piston is being moved off of the switch
mkelly10 9:d5fcdcb3c89d 107 //and the motor command reverses for some reason
mkelly10 9:d5fcdcb3c89d 108
mkelly10 9:d5fcdcb3c89d 109 if ((_limitSwitch.read() == 0) && (_pid.getOutput()< 0)) {
mkelly10 9:d5fcdcb3c89d 110 //dont run
mkelly10 9:d5fcdcb3c89d 111 return;
mkelly10 9:d5fcdcb3c89d 112 }
mkelly10 9:d5fcdcb3c89d 113 _motor.run(_pid.getOutput());
mkelly10 9:d5fcdcb3c89d 114 }
mkelly10 9:d5fcdcb3c89d 115 }
mkelly10 9:d5fcdcb3c89d 116
mkelly10 9:d5fcdcb3c89d 117 void LinearActuator::start()
mkelly10 9:d5fcdcb3c89d 118 {
mkelly10 9:d5fcdcb3c89d 119 _init = true;
mkelly10 9:d5fcdcb3c89d 120 _pulse.attach(this,&LinearActuator::update, _dt);
mkelly10 9:d5fcdcb3c89d 121
mkelly10 9:d5fcdcb3c89d 122 }
mkelly10 9:d5fcdcb3c89d 123
mkelly10 9:d5fcdcb3c89d 124 void LinearActuator::stop()
mkelly10 9:d5fcdcb3c89d 125 {
mkelly10 9:d5fcdcb3c89d 126 _motor.stop();
mkelly10 9:d5fcdcb3c89d 127 _pulse.detach();
mkelly10 9:d5fcdcb3c89d 128 }
mkelly10 9:d5fcdcb3c89d 129
mkelly10 9:d5fcdcb3c89d 130 void LinearActuator::pause()
mkelly10 9:d5fcdcb3c89d 131 {
mkelly10 9:d5fcdcb3c89d 132 //this allows the controller to keep running while turning off the motor output
mkelly10 9:d5fcdcb3c89d 133 _motor.stop();
mkelly10 9:d5fcdcb3c89d 134 //paused flag causes controller output not to be piped to the motor
mkelly10 9:d5fcdcb3c89d 135 _paused = true;
mkelly10 9:d5fcdcb3c89d 136 }
mkelly10 9:d5fcdcb3c89d 137
mkelly10 9:d5fcdcb3c89d 138 void LinearActuator::unpause()
mkelly10 9:d5fcdcb3c89d 139 {
mkelly10 9:d5fcdcb3c89d 140 //this resumes motor operation
mkelly10 9:d5fcdcb3c89d 141 _paused = false;
mkelly10 9:d5fcdcb3c89d 142 }
mkelly10 9:d5fcdcb3c89d 143
mkelly10 9:d5fcdcb3c89d 144 void LinearActuator::refreshPVState()
mkelly10 9:d5fcdcb3c89d 145 {
mkelly10 9:d5fcdcb3c89d 146 _position = _filter.getPosition();
mkelly10 9:d5fcdcb3c89d 147 _velocity = _filter.getVelocity();
mkelly10 9:d5fcdcb3c89d 148
mkelly10 9:d5fcdcb3c89d 149 _position_mm = counts_to_dist(_position);
mkelly10 9:d5fcdcb3c89d 150 _velocity_mms = counts_to_velocity(_velocity);
mkelly10 9:d5fcdcb3c89d 151
mkelly10 9:d5fcdcb3c89d 152 // _position_mL = _mm_to_mL(_position_mm);
mkelly10 9:d5fcdcb3c89d 153 // _velocity_mLs = _mm_to_mL(_velocity_mms);
mkelly10 9:d5fcdcb3c89d 154
mkelly10 9:d5fcdcb3c89d 155 }
mkelly10 9:d5fcdcb3c89d 156
mkelly10 9:d5fcdcb3c89d 157 // setting and getting variables
mkelly10 9:d5fcdcb3c89d 158 void LinearActuator::setPosition_mm(float dist)
mkelly10 9:d5fcdcb3c89d 159 {
mkelly10 9:d5fcdcb3c89d 160 // convert mm representation to volume in mL
mkelly10 9:d5fcdcb3c89d 161 // _SetPoint_mL = _mm_to_mL(dist);
mkelly10 9:d5fcdcb3c89d 162 _SetPoint_mm = clamp<float>(dist, 0.0, _extendLimit); //this is another spot that prevents the requested set point from going out of range, this template function is defined in the controller header file fyi
mkelly10 9:d5fcdcb3c89d 163
mkelly10 9:d5fcdcb3c89d 164 _pid.writeSetPoint(_SetPoint_mm);
mkelly10 9:d5fcdcb3c89d 165
mkelly10 9:d5fcdcb3c89d 166 }
mkelly10 9:d5fcdcb3c89d 167
mkelly10 9:d5fcdcb3c89d 168 float LinearActuator::getPosition_mm()
mkelly10 9:d5fcdcb3c89d 169 {
mkelly10 9:d5fcdcb3c89d 170 return _position_mm;
mkelly10 9:d5fcdcb3c89d 171 }
mkelly10 9:d5fcdcb3c89d 172
mkelly10 9:d5fcdcb3c89d 173 float LinearActuator::getPosition_counts()
mkelly10 9:d5fcdcb3c89d 174 {
mkelly10 9:d5fcdcb3c89d 175 return _position; // returns raw adc counts (useful for zeroing)
mkelly10 9:d5fcdcb3c89d 176 }
mkelly10 9:d5fcdcb3c89d 177
mkelly10 9:d5fcdcb3c89d 178 float LinearActuator::getVelocity_mms()
mkelly10 9:d5fcdcb3c89d 179 {
mkelly10 9:d5fcdcb3c89d 180 return _velocity_mms;
mkelly10 9:d5fcdcb3c89d 181 }
mkelly10 9:d5fcdcb3c89d 182
mkelly10 9:d5fcdcb3c89d 183 void LinearActuator::setControllerP(float P)
mkelly10 9:d5fcdcb3c89d 184 {
mkelly10 9:d5fcdcb3c89d 185 _Pgain = P;
mkelly10 9:d5fcdcb3c89d 186 _pid.setPgain(_Pgain);
mkelly10 9:d5fcdcb3c89d 187 return;
mkelly10 9:d5fcdcb3c89d 188 }
mkelly10 9:d5fcdcb3c89d 189
mkelly10 9:d5fcdcb3c89d 190 float LinearActuator::getControllerP()
mkelly10 9:d5fcdcb3c89d 191 {
mkelly10 9:d5fcdcb3c89d 192 return _Pgain;
mkelly10 9:d5fcdcb3c89d 193 }
mkelly10 9:d5fcdcb3c89d 194
mkelly10 9:d5fcdcb3c89d 195 void LinearActuator::setControllerI(float I)
mkelly10 9:d5fcdcb3c89d 196 {
mkelly10 9:d5fcdcb3c89d 197 _Igain = I;
mkelly10 9:d5fcdcb3c89d 198 _pid.setIgain(_Igain);
mkelly10 9:d5fcdcb3c89d 199 return;
mkelly10 9:d5fcdcb3c89d 200 }
mkelly10 9:d5fcdcb3c89d 201
mkelly10 9:d5fcdcb3c89d 202 float LinearActuator::getControllerI()
mkelly10 9:d5fcdcb3c89d 203 {
mkelly10 9:d5fcdcb3c89d 204 return _Igain;
mkelly10 9:d5fcdcb3c89d 205 }
mkelly10 9:d5fcdcb3c89d 206
mkelly10 9:d5fcdcb3c89d 207 void LinearActuator::setControllerD(float D)
mkelly10 9:d5fcdcb3c89d 208 {
mkelly10 9:d5fcdcb3c89d 209 _Dgain = D;
mkelly10 9:d5fcdcb3c89d 210 _pid.setDgain(_Dgain);
mkelly10 9:d5fcdcb3c89d 211 return;
mkelly10 9:d5fcdcb3c89d 212 }
mkelly10 9:d5fcdcb3c89d 213
mkelly10 9:d5fcdcb3c89d 214 float LinearActuator::getControllerD()
mkelly10 9:d5fcdcb3c89d 215 {
mkelly10 9:d5fcdcb3c89d 216 return _Dgain;
mkelly10 9:d5fcdcb3c89d 217 }
mkelly10 9:d5fcdcb3c89d 218
mkelly10 9:d5fcdcb3c89d 219 float LinearActuator::getOutput()
mkelly10 9:d5fcdcb3c89d 220 {
mkelly10 9:d5fcdcb3c89d 221 return _pid.getOutput();
mkelly10 9:d5fcdcb3c89d 222 }
mkelly10 9:d5fcdcb3c89d 223
mkelly10 9:d5fcdcb3c89d 224 void LinearActuator::setZeroCounts(int zero)
mkelly10 9:d5fcdcb3c89d 225 {
mkelly10 9:d5fcdcb3c89d 226 _zeroCounts = clamp<int>(zero, 0, 4096);
mkelly10 9:d5fcdcb3c89d 227 return;
mkelly10 9:d5fcdcb3c89d 228 }
mkelly10 9:d5fcdcb3c89d 229
mkelly10 9:d5fcdcb3c89d 230 int LinearActuator::getZeroCounts()
mkelly10 9:d5fcdcb3c89d 231 {
mkelly10 9:d5fcdcb3c89d 232 return _zeroCounts;
mkelly10 9:d5fcdcb3c89d 233 }
mkelly10 9:d5fcdcb3c89d 234
mkelly10 9:d5fcdcb3c89d 235 void LinearActuator::setTravelLimit(float limit)
mkelly10 9:d5fcdcb3c89d 236 {
mkelly10 9:d5fcdcb3c89d 237 _extendLimit = limit;
mkelly10 9:d5fcdcb3c89d 238 return;
mkelly10 9:d5fcdcb3c89d 239 }
mkelly10 9:d5fcdcb3c89d 240
mkelly10 9:d5fcdcb3c89d 241 float LinearActuator::getTravelLimit()
mkelly10 9:d5fcdcb3c89d 242 {
mkelly10 9:d5fcdcb3c89d 243 return _extendLimit;
mkelly10 9:d5fcdcb3c89d 244 }
mkelly10 9:d5fcdcb3c89d 245
mkelly10 9:d5fcdcb3c89d 246 void LinearActuator::setPotSlope(float slope)
mkelly10 9:d5fcdcb3c89d 247 {
mkelly10 9:d5fcdcb3c89d 248 _slope = slope;
mkelly10 9:d5fcdcb3c89d 249 return;
mkelly10 9:d5fcdcb3c89d 250 }
mkelly10 9:d5fcdcb3c89d 251
mkelly10 9:d5fcdcb3c89d 252 float LinearActuator::getPotSlope()
mkelly10 9:d5fcdcb3c89d 253 {
mkelly10 9:d5fcdcb3c89d 254 return _slope;
mkelly10 9:d5fcdcb3c89d 255 }
mkelly10 9:d5fcdcb3c89d 256
mkelly10 9:d5fcdcb3c89d 257 float LinearActuator::counts_to_dist(int count)
mkelly10 9:d5fcdcb3c89d 258 {
mkelly10 9:d5fcdcb3c89d 259 float conv = _slope*(count-_zeroCounts);
mkelly10 9:d5fcdcb3c89d 260 return conv;
mkelly10 9:d5fcdcb3c89d 261 }
mkelly10 9:d5fcdcb3c89d 262
mkelly10 9:d5fcdcb3c89d 263 void LinearActuator::setFilterFrequency(float frequency)
mkelly10 9:d5fcdcb3c89d 264 {
mkelly10 9:d5fcdcb3c89d 265 _filterFrequency = frequency;
mkelly10 9:d5fcdcb3c89d 266 _filter.writeWn(frequency);
mkelly10 9:d5fcdcb3c89d 267 }
mkelly10 9:d5fcdcb3c89d 268
mkelly10 9:d5fcdcb3c89d 269 int LinearActuator::dist_to_counts(float dist)
mkelly10 9:d5fcdcb3c89d 270 {
mkelly10 9:d5fcdcb3c89d 271 float conv = (dist/_slope)+_zeroCounts;
mkelly10 9:d5fcdcb3c89d 272 return (int) conv;
mkelly10 9:d5fcdcb3c89d 273 }
mkelly10 9:d5fcdcb3c89d 274
mkelly10 9:d5fcdcb3c89d 275 float LinearActuator::counts_to_velocity(int count)
mkelly10 9:d5fcdcb3c89d 276 {
mkelly10 9:d5fcdcb3c89d 277 float conv = count*_slope;
mkelly10 9:d5fcdcb3c89d 278 return conv;
mkelly10 9:d5fcdcb3c89d 279 }
mkelly10 9:d5fcdcb3c89d 280
mkelly10 9:d5fcdcb3c89d 281 void LinearActuator::_switchPressed()
mkelly10 9:d5fcdcb3c89d 282 {
mkelly10 9:d5fcdcb3c89d 283 //first thing to do is stop the motor
mkelly10 9:d5fcdcb3c89d 284 _motor.stop();
mkelly10 9:d5fcdcb3c89d 285 _limit = true;
mkelly10 9:d5fcdcb3c89d 286 }
mkelly10 9:d5fcdcb3c89d 287
mkelly10 9:d5fcdcb3c89d 288 void LinearActuator::homePiston()
mkelly10 9:d5fcdcb3c89d 289 {
mkelly10 9:d5fcdcb3c89d 290 //start calling the update for the Linear Actuator
mkelly10 9:d5fcdcb3c89d 291 //start the controller update and immediatley pause the motor output
mkelly10 9:d5fcdcb3c89d 292 start();
mkelly10 9:d5fcdcb3c89d 293 pause();
mkelly10 9:d5fcdcb3c89d 294
mkelly10 9:d5fcdcb3c89d 295 //trap program execution here until the filter is converged
mkelly10 9:d5fcdcb3c89d 296 while(_init){
mkelly10 9:d5fcdcb3c89d 297 //just wait here until the things calm down
mkelly10 9:d5fcdcb3c89d 298 }
mkelly10 9:d5fcdcb3c89d 299
mkelly10 9:d5fcdcb3c89d 300 //Now that the readings are stabilized
mkelly10 9:d5fcdcb3c89d 301 // This sends the motor on a kamakaze mission toward the limit switch
mkelly10 9:d5fcdcb3c89d 302 // The interrupt should catch and stop it and the piston is now at home
mkelly10 9:d5fcdcb3c89d 303 //position
mkelly10 9:d5fcdcb3c89d 304 _motor.run(-1.0);
mkelly10 9:d5fcdcb3c89d 305
mkelly10 9:d5fcdcb3c89d 306 while (1) {
mkelly10 9:d5fcdcb3c89d 307 //trap the program here while we wait for the limit switch to be triggered
mkelly10 9:d5fcdcb3c89d 308 //when it does, the limit interrupt will stop the motors
mkelly10 9:d5fcdcb3c89d 309 if (_limit) {
mkelly10 9:d5fcdcb3c89d 310 //the switch has been pressed
mkelly10 9:d5fcdcb3c89d 311 if (abs(_filter.getVelocity()) < 0.1) {
mkelly10 9:d5fcdcb3c89d 312 //this is here to make sure the adc filter is not jittering around
mkelly10 9:d5fcdcb3c89d 313 //we are probably stable enough to take a zero here
mkelly10 9:d5fcdcb3c89d 314 _zeroCounts = _filter.getPosition();
mkelly10 9:d5fcdcb3c89d 315
mkelly10 9:d5fcdcb3c89d 316 // This can be used for troubleshooting
mkelly10 9:d5fcdcb3c89d 317 //pc().printf("\n\rzero_counts: %4i \n\r" , _zeroCounts);
mkelly10 9:d5fcdcb3c89d 318 //stop the update loop
mkelly10 9:d5fcdcb3c89d 319 stop();
mkelly10 9:d5fcdcb3c89d 320 return;
mkelly10 9:d5fcdcb3c89d 321 }
mkelly10 9:d5fcdcb3c89d 322 }
mkelly10 9:d5fcdcb3c89d 323 }
mkelly10 9:d5fcdcb3c89d 324 }
mkelly10 9:d5fcdcb3c89d 325
mkelly10 9:d5fcdcb3c89d 326 bool LinearActuator::getSwitch()
mkelly10 9:d5fcdcb3c89d 327 {
mkelly10 9:d5fcdcb3c89d 328 return _limit;
mkelly10 9:d5fcdcb3c89d 329 }
mkelly10 9:d5fcdcb3c89d 330
mkelly10 9:d5fcdcb3c89d 331 void LinearActuator::setDeadband(float deadband)
mkelly10 9:d5fcdcb3c89d 332 {
mkelly10 9:d5fcdcb3c89d 333 _deadband = deadband;
mkelly10 9:d5fcdcb3c89d 334 _pid.setDeadBand(_deadband);
mkelly10 9:d5fcdcb3c89d 335 return;
mkelly10 9:d5fcdcb3c89d 336 }
mkelly10 9:d5fcdcb3c89d 337
mkelly10 9:d5fcdcb3c89d 338 bool LinearActuator::toggleDeadband(bool toggle)
mkelly10 9:d5fcdcb3c89d 339 {
mkelly10 9:d5fcdcb3c89d 340 _pid.toggleDeadBand(toggle);
mkelly10 9:d5fcdcb3c89d 341 return toggle;
mkelly10 9:d5fcdcb3c89d 342 }
mkelly10 9:d5fcdcb3c89d 343