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
Diff: LinearActuator/LinearActuator.cpp
- Revision:
- 11:3b241ecb75ed
- Parent:
- 10:085ab7328054
- Child:
- 12:a0519d11d2b6
--- a/LinearActuator/LinearActuator.cpp Mon Oct 23 12:50:53 2017 +0000 +++ b/LinearActuator/LinearActuator.cpp Fri Oct 27 00:37:32 2017 +0000 @@ -152,14 +152,18 @@ _pid.writeSetPoint(_SetPoint_mm); } + +float LinearActuator::getSetPosition_mm() { + return _SetPoint_mm; +} float LinearActuator::getPosition_mm() { return _position_mm; } -//float LinearActuator::getPosition_counts() { -// return _position; // returns raw adc counts (useful for zeroing) -//} +float LinearActuator::getPosition_counts() { + return _position; +} float LinearActuator::getVelocity_mms() { return _velocity_mms; @@ -258,16 +262,16 @@ start(); pause(); - //trap program execution here until the filter is converged - while(_init){ - //just wait here until the things calm down - } +// //trap program execution here until the filter is converged +// while(_init){ +// //just wait here until the things calm down +// } //Now that the readings are stabilized // This sends the motor on a kamakaze mission toward the limit switch // The interrupt should catch and stop it, and the piston is now at home // position - _motor.run(-1.0); + _motor.run(-0.5); while (1) { //trap the program here while we wait for the limit switch to be triggered @@ -280,7 +284,7 @@ _zeroCounts = _filter.getPosition(); // This can be used for troubleshooting - //pc().printf("\n\rzero_counts: %4i \n\r" , _zeroCounts); + pc().printf("\n\rzero_counts: %4i \n\r" , _zeroCounts); //stop the update loop stop(); return; @@ -298,6 +302,10 @@ _pid.setDeadBand(_deadband); return; } + +float LinearActuator::getDeadband() { + return _deadband; +} bool LinearActuator::toggleDeadband(bool toggle) { _pid.toggleDeadBand(toggle);