Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 13:a3fa0a31b114, committed 2016-05-22
- Comitter:
- benkatz
- Date:
- Sun May 22 03:47:40 2016 +0000
- Parent:
- 12:c473a25f54f7
- Child:
- 14:80ce59119d93
- Commit message:
- fixed some dumb things;
Changed in this revision
--- a/CurrentRegulator/CurrentRegulator.cpp Sun May 22 03:38:19 2016 +0000
+++ b/CurrentRegulator/CurrentRegulator.cpp Sun May 22 03:47:40 2016 +0000
@@ -110,7 +110,7 @@
void CurrentRegulator::Update(){
float Q_Error = IQ_Ref - I_Q;
float D_Error = ID_Ref - I_D;
- float w_elec = _velocitySensor.GetElecVelocity();
+ float w_elec = _VelocitySensor->GetElecVelocity();
Q_Integral += Q_Error*_Ki*_Kp;
D_Integral += D_Error*_Ki*_Kp;
--- a/PositionSensor/PositionSensor.cpp Sun May 22 03:38:19 2016 +0000
+++ b/PositionSensor/PositionSensor.cpp Sun May 22 03:47:40 2016 +0000
@@ -139,9 +139,7 @@
return elec;
}
-float PositionSensorEncoder::GetElecVelocity(){
- return _ppairs*GetMechVelocity();
- }
+
float PositionSensorEncoder::GetMechVelocity(){
float out = 0;
@@ -157,18 +155,15 @@
out = meas;
}
- /*
- if(abs(vel) < 2.0f){
- vel = 0;
- }
- */
vel_old = meas;
-
- //out = .5f*out + .5f*out_old;
out_old = out;
return out;
}
-
+
+float PositionSensorEncoder::GetElecVelocity(){
+ return _ppairs*GetMechVelocity();
+ }
+
void PositionSensorEncoder::ZeroEncoderCount(void){
if (ZSense->read() == 1 & flag == 0){
if (ZSense->read() == 1){
--- a/PositionSensor/PositionSensor.h Sun May 22 03:38:19 2016 +0000
+++ b/PositionSensor/PositionSensor.h Sun May 22 03:47:40 2016 +0000
@@ -5,6 +5,7 @@
virtual float GetMechPosition() {return 0.0f;}
virtual float GetElecPosition() {return 0.0f;}
virtual float GetMechVelocity() {return 0.0f;}
+ virtual float GetElecVelocity() {return 0.0f;}
};