hobbyking_cheetah source code modified 2020/12/15
Dependencies: mbed-dev-f303 FastPWM3
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 13:a3fa0a31b114
- Parent:
- 12:c473a25f54f7
- Child:
- 14:80ce59119d93
--- 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){