Permalink
Browse files

Removing temp waround on npushrotationtick, simplifying and correctin…

…g rotation counter gyro integration
  • Loading branch information...
1 parent 42aa391 commit 37437e22f56d4359066c7f557e3bdb76dc45be77 Clovis Scotti committed Jun 27, 2011
Showing with 16 additions and 18 deletions.
  1. +7 −0 PushBurton2/npushrotationstick.cpp
  2. +9 −16 PushBurton2/rotationcounter.cpp
  3. +0 −2 PushBurton2/rotationcounter.h
@@ -35,6 +35,13 @@ QString NPushRotationsTick::get_pretty_print() const
void NPushRotationsTick::updateCleanDegs()
{
+
+// if(rawDegs > 0) {
+// rawDegs *= 1.3;
+// } else {
+// rawDegs *= 1.4;
+// }
+
if(fabs(rawDegs) > 90.0) {
if(rawDegs > 0)
cleanDegs = ceil(rawDegs/180.0);
@@ -49,6 +49,7 @@ bool RotationCounter::subscribesTo(PushBurtonGenericDevice* deviceType)
void RotationCounter::incoming_reading(NPushLogTick * tick)
{
+ static double lastMeas = 0.0;
if(typeid(*tick) == typeid(NPushAirTimeTick)) {
NPushAirTimeTick * airTimeTick = (NPushAirTimeTick *)tick;
@@ -61,10 +62,7 @@ void RotationCounter::incoming_reading(NPushLogTick * tick)
afterJumpDecCnter = 0;
for(int i=0;i<PRE_SPIN_BUFFER_SIZE;i++){
-
-// spinAcc += pastSpinBuff[i];
- integrateSpinAcc(pastSpinBuff[i]);
-
+ spinAcc += pastSpinBuff[i];
}
// qDebug() << "Starting at; SpinAcc = " << spinAcc;
@@ -84,23 +82,25 @@ void RotationCounter::incoming_reading(NPushLogTick * tick)
//Which axis are we lookin?
spinInc = ((double)imuTick->gyro[2])/14.375;
- spinInc *= (imuTick->msecsToEpoch - lastTstamp)*0.001;
+ //interpolation
+ spinInc = (spinInc+lastMeas)/2.00;
+ lastMeas = spinInc;
+
+ spinInc *= (imuTick->msecsToEpoch - lastTstamp)*0.001;
}
lastTstamp = imuTick->msecsToEpoch;
if(onAir) {
-// spinAcc += spinInc;
- integrateSpinAcc(spinInc);
+ spinAcc += spinInc;
//emit intermediary rotation tick? if so, emit here.
}
if(afterJumpDecCnter > 0) {
-// spinAcc += spinInc;
- integrateSpinAcc(spinInc);
+ spinAcc += spinInc;
afterJumpDecCnter--;
if(afterJumpDecCnter == 0) {
@@ -114,13 +114,6 @@ void RotationCounter::incoming_reading(NPushLogTick * tick)
}
}
-void RotationCounter::integrateSpinAcc(double meas)
-{
- static double lastMeas = 0.0;
- spinAcc += (meas + lastMeas)/2;
- lastMeas = meas;
-}
-
void RotationCounter::emitRotTick()
{
NPushRotationsTick * newTick = 0;
@@ -50,8 +50,6 @@ public slots:
private:
- void integrateSpinAcc(double meas);
-
void emitRotTick();
quint64 lastTstamp;

0 comments on commit 37437e2

Please sign in to comment.