Permalink
Browse files

fix averaging ?

fix date format
add sending gravity offset info
fix deltaspeed limiting
  • Loading branch information...
1 parent fcb55aa commit aaa2c67fb4d1ade10267f2f6604d331fcc22c065 Marije Baalman committed Feb 19, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 app/src/com/steim/nescivi/android/gvb/VelocityEstimator.java
@@ -441,7 +441,7 @@ private void compute_speed()
float gps_weight = currentGPSReadings[1] / tot_weight;
float vel_weight = (float) mAccPrecision / tot_weight;
- mSpeed = mSpeedAccel * vel_weight + currentGPSReadings[1] * gps_weight;
+ mSpeed = (mSpeedAccel * vel_weight) + (currentGPSReadings[1] * gps_weight);
}
@@ -522,7 +522,7 @@ private void readPreferences(){
/// --------- DATA UPLOADER -------------
private String formatDate(Date date) {
- String format = "yy-MM-dd HH:mm:ss";
+ String format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat formatter = new SimpleDateFormat(format);
return formatter.format(date);
}
@@ -733,6 +733,7 @@ private void send_gui_update_msg(){
b.putFloat("gacc_mean", this.mCurrentStats[0][2] );
b.putFloat("gacc_std", this.mCurrentStats[1][2] );
b.putFloat("offset", this.mOffsets[0] );
+ b.putFloat("offset_grav", this.mOffsets[2] );
}
b.putFloat("sign", this.forwardsign );
// b.putFloat("stilltime", this.mStillTime );
@@ -910,7 +911,7 @@ public void updateVelocityMeasurement(){
// limit speed increase when getting faster:
double limiterFactor = Math.exp( -1. * this.mSpeedAccel * Math.PI / 10. );
double deltaspeed = (mean_weight*mameanOff[0] + raw_weight*currentReadings[0]) * this.mDeltaTime * 0.001;
- if ( deltaspeed > 0 ){
+ if ( (deltaspeed > 0.0f) && (mSpeedAccel > 15.0) ){ // only limit when above 15.0 m/s
this.mSpeedAccel += deltaspeed * limiterFactor;
} else {
this.mSpeedAccel += deltaspeed;

0 comments on commit aaa2c67

Please sign in to comment.