Skip to content

Commit e8d6a22

Browse files
committed
Stop computing heading
1 parent 0ce28b1 commit e8d6a22

File tree

7 files changed

+2
-282
lines changed

7 files changed

+2
-282
lines changed

.jshintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"FlightLogIndex" : true,
2525
"GraphConfig" : true,
2626
"GraphLegend" : true,
27-
"IMU" : true,
2827
"SeekBar" : true
2928
}
3029
}

gulpfile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ gulp.task('dist', gulp.series(['clean-dist'], function () {
154154
'./js/graph_spectrum.js',
155155
'./js/grapher.js',
156156
'./js/header_dialog.js',
157-
'./js/imu.js',
158157
'./js/keys_dialog.js',
159158
'./js/laptimer.js',
160159
'./js/main.js',

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,6 @@ <h4 class="modal-title">Advanced User Settings</h4>
14631463
<script src="js/expo.js"></script>
14641464
<script src="js/datastream.js"></script>
14651465
<script src="js/decoders.js"></script>
1466-
<script src="js/imu.js"></script>
14671466
<script src="js/craft_2d.js"></script>
14681467
<script src="js/craft_3d.js"></script>
14691468
<script src="js/flightlog_fielddefs.js"></script>

js/flightlog.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
function FlightLog(logData) {
1313
var
14-
ADDITIONAL_COMPUTED_FIELD_COUNT = 12, /** attitude + PID_SUM + PID_ERROR + VELOCITY + WIND_VELOCITY + WIND_HEADING **/
14+
ADDITIONAL_COMPUTED_FIELD_COUNT = 9, /** attitude + PID_SUM + PID_ERROR + VELOCITY + WIND_VELOCITY + WIND_HEADING **/
1515

1616
that = this,
1717
logIndex = false,
@@ -223,7 +223,6 @@ function FlightLog(logData) {
223223
}
224224

225225
// Add names for our ADDITIONAL_COMPUTED_FIELDS
226-
fieldNames.push("heading[0]", "heading[1]", "heading[2]");
227226
fieldNames.push("axisSum[0]", "axisSum[1]", "axisSum[2]");
228227
fieldNames.push("axisError[0]", "axisError[1]", "axisError[2]"); // Custom calculated error field
229228
fieldNames.push("velocity", "windVelocity", "windHeading");
@@ -356,9 +355,6 @@ function FlightLog(logData) {
356355
};
357356
}
358357

359-
// We need to store this in the chunk so we can refer to it later when we inject computed fields
360-
chunk.initialIMU = iframeDirectory.initialIMU[chunkIndex];
361-
362358
var
363359
mainFrameIndex = 0,
364360
slowFrameLength = parser.frameDefs.S ? parser.frameDefs.S.count : 0,
@@ -494,20 +490,17 @@ function FlightLog(logData) {
494490
};
495491

496492
/**
497-
* Use the data in sourceChunks to compute additional fields (like IMU attitude) and add those into the
493+
* Use the data in sourceChunks to compute additional fields and add those into the
498494
* resultChunks.
499495
*
500496
* sourceChunks and destChunks can be the same array.
501497
*/
502498
function injectComputedFields(sourceChunks, destChunks) {
503499
let gyroADC = [fieldNameToIndex["gyroADC[0]"], fieldNameToIndex["gyroADC[1]"], fieldNameToIndex["gyroADC[2]"]],
504-
accSmooth = [fieldNameToIndex["accSmooth[0]"], fieldNameToIndex["accSmooth[1]"], fieldNameToIndex["accSmooth[2]"]],
505500
magADC = [fieldNameToIndex["magADC[0]"], fieldNameToIndex["magADC[1]"], fieldNameToIndex["magADC[2]"]],
506-
rcCommand = [fieldNameToIndex["rcCommand[0]"], fieldNameToIndex["rcCommand[1]"], fieldNameToIndex["rcCommand[2]"]],
507501
axisRate = [fieldNameToIndex["axisRate[0]"], fieldNameToIndex["axisRate[1]"], fieldNameToIndex["axisRate[2]"]],
508502
sourceChunkIndex, destChunkIndex,
509503
sysConfig,
510-
attitude,
511504
navVel = [fieldNameToIndex["navVel[0]"], fieldNameToIndex["navVel[1]"]],
512505
wind = [fieldNameToIndex["wind[0]"], fieldNameToIndex["wind[1]"], fieldNameToIndex["wind[2]"]];
513506

@@ -544,27 +537,12 @@ function FlightLog(logData) {
544537
if (!destChunk.hasAdditionalFields) {
545538
destChunk.hasAdditionalFields = true;
546539

547-
var
548-
chunkIMU = new IMU(sourceChunks[sourceChunkIndex].initialIMU);
549-
550540
for (var i = 0; i < sourceChunk.frames.length; i++) {
551541
var
552542
srcFrame = sourceChunk.frames[i],
553543
destFrame = destChunk.frames[i],
554544
fieldIndex = destFrame.length - ADDITIONAL_COMPUTED_FIELD_COUNT;
555545

556-
attitude = chunkIMU.updateEstimatedAttitude(
557-
[srcFrame[gyroADC[0]], srcFrame[gyroADC[1]], srcFrame[gyroADC[2]]],
558-
[srcFrame[accSmooth[0]], srcFrame[accSmooth[1]], srcFrame[accSmooth[2]]],
559-
srcFrame[FlightLogParser.prototype.FLIGHT_LOG_FIELD_INDEX_TIME],
560-
sysConfig.acc_1G,
561-
sysConfig.gyroScale,
562-
magADC ? [srcFrame[magADC[0]], srcFrame[magADC[1]], srcFrame[magADC[2]]] : false);
563-
564-
destFrame[fieldIndex++] = attitude.roll;
565-
destFrame[fieldIndex++] = attitude.pitch;
566-
destFrame[fieldIndex++] = attitude.heading;
567-
568546
// Add the PID sum
569547
for (var axis = 0; axis < 3; axis++) {
570548

js/flightlog_index.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,13 @@ function FlightLogIndex(logData) {
4343
times: [],
4444
offsets: [],
4545
avgThrottle: [],
46-
initialIMU: [],
4746
initialSlow: [],
4847
initialGPSHome: [],
4948
hasEvent: [],
5049
minTime: false,
5150
maxTime: false
5251
},
5352

54-
imu = new IMU(),
5553
gyroADC, accSmooth, magADC,
5654

5755
iframeCount = 0,
@@ -136,22 +134,12 @@ function FlightLogIndex(logData) {
136134
* that came before, we have to record the initial state of various items which aren't
137135
* logged anew every iteration.
138136
*/
139-
intraIndex.initialIMU.push(new IMU(imu));
140137
intraIndex.initialSlow.push(lastSlow);
141138
intraIndex.initialGPSHome.push(lastGPSHome);
142139
}
143140

144141
iframeCount++;
145142
}
146-
147-
imu.updateEstimatedAttitude(
148-
[frame[gyroADC[0]], frame[gyroADC[1]], frame[gyroADC[2]]],
149-
[frame[accSmooth[0]], frame[accSmooth[1]], frame[accSmooth[2]]],
150-
frame[FlightLogParser.prototype.FLIGHT_LOG_FIELD_INDEX_TIME],
151-
sysConfig.acc_1G,
152-
sysConfig.gyroScale,
153-
magADC ? [frame[magADC[0]], frame[magADC[1]], frame[magADC[2]]] : false
154-
);
155143
break;
156144
case 'H':
157145
lastGPSHome = frame.slice(0);

js/graph_config.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,6 @@ GraphConfig.load = function(config) {
291291
inputRange: 500 * (sysConfig.rcRate ? sysConfig.rcRate : 100) / 100,
292292
outputRange: 1.0
293293
};
294-
} else if (fieldName == "heading[2]") {
295-
return {
296-
offset: -Math.PI,
297-
power: 1.0,
298-
inputRange: Math.PI,
299-
outputRange: 1.0
300-
};
301-
} else if (fieldName.match(/^heading\[/)) {
302-
return {
303-
offset: 0,
304-
power: 1.0,
305-
inputRange: Math.PI,
306-
outputRange: 1.0
307-
};
308294
} else if (fieldName.match(/^sonar.*/)) {
309295
return {
310296
offset: -200,

js/imu.js

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)