Moderators: roger, 99jonathan, imaqine
Code Removed
// if the reading/sensor average is close to the bias baseline, get mins & maxes and new bias value if stationary.
// This method allows the bias value to automatically "change" when the sensor heats up, gets humid, etc. which causes
// the nominal "zero range" to drift.
if (checkCloseness(GyroDataStruct.rawVal, sensorBiasRoot, 1 * INTSCALER)) {
if (GyroDataStruct.rawVal < tempMinBias) tempMinBias = GyroDataStruct.rawVal;
if (GyroDataStruct.rawVal > tempMaxBias) tempMaxBias = GyroDataStruct.rawVal;
biasHit++;
// if we have 100 consecutive close vals, we assume we are stationary
if (biasHit>100) {
minBias = tempMinBias;
tempMinBias = MINMAXEXTREME;
maxBias = tempMaxBias;
tempMaxBias = -MINMAXEXTREME;
sensorBias = (minBias + maxBias) / 2;
sensorBiasRoot = sensorBias;
biasHit = 0;
}
} else {
biasHit = 0;
if ((GyroDataStruct.rawVal > maxBias + NOISEFILTEROFFSET) ||
(GyroDataStruct.rawVal < minBias - NOISEFILTEROFFSET)) {
// if ((GyroDataStruct.rawVal > maxBias) || (GyroDataStruct.rawVal < minBias)) {
integralVectorAccumulator += (GyroDataStruct.rawVal - sensorBias) * GyroDataStruct.cycleTime;
}
}
public double getAngle()
{
now = current time
deltaT = now - lastTime
if(deltaT != now) {
angle += getAngleVelocity() * ((double)delta_t / 1000.0);
}
// Note that getAngleVelocity() is the velocity minus the offset
lastTime = now
return angle
}
iWitzand wrote: - Able to be driven by mobile phone (I have edited an existing Java Bluetooth mobile application, so that it sends integers to the NXT).
//BTConnection conn = Bluetooth.waitForConnection();
//conn.setIOMode(0); // Used when a pc connection is made
//conn.setIOMode(NXTConnection.RAW); // Used when a phone connection is madeUsers browsing this forum: No registered users and 0 guests