|
11 | 11 | */ |
12 | 12 | function FlightLog(logData) { |
13 | 13 | 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 **/ |
15 | 15 |
|
16 | 16 | that = this, |
17 | 17 | logIndex = false, |
@@ -223,7 +223,6 @@ function FlightLog(logData) { |
223 | 223 | } |
224 | 224 |
|
225 | 225 | // Add names for our ADDITIONAL_COMPUTED_FIELDS |
226 | | - fieldNames.push("heading[0]", "heading[1]", "heading[2]"); |
227 | 226 | fieldNames.push("axisSum[0]", "axisSum[1]", "axisSum[2]"); |
228 | 227 | fieldNames.push("axisError[0]", "axisError[1]", "axisError[2]"); // Custom calculated error field |
229 | 228 | fieldNames.push("velocity", "windVelocity", "windHeading"); |
@@ -356,9 +355,6 @@ function FlightLog(logData) { |
356 | 355 | }; |
357 | 356 | } |
358 | 357 |
|
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 | | - |
362 | 358 | var |
363 | 359 | mainFrameIndex = 0, |
364 | 360 | slowFrameLength = parser.frameDefs.S ? parser.frameDefs.S.count : 0, |
@@ -494,20 +490,17 @@ function FlightLog(logData) { |
494 | 490 | }; |
495 | 491 |
|
496 | 492 | /** |
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 |
498 | 494 | * resultChunks. |
499 | 495 | * |
500 | 496 | * sourceChunks and destChunks can be the same array. |
501 | 497 | */ |
502 | 498 | function injectComputedFields(sourceChunks, destChunks) { |
503 | 499 | let gyroADC = [fieldNameToIndex["gyroADC[0]"], fieldNameToIndex["gyroADC[1]"], fieldNameToIndex["gyroADC[2]"]], |
504 | | - accSmooth = [fieldNameToIndex["accSmooth[0]"], fieldNameToIndex["accSmooth[1]"], fieldNameToIndex["accSmooth[2]"]], |
505 | 500 | magADC = [fieldNameToIndex["magADC[0]"], fieldNameToIndex["magADC[1]"], fieldNameToIndex["magADC[2]"]], |
506 | | - rcCommand = [fieldNameToIndex["rcCommand[0]"], fieldNameToIndex["rcCommand[1]"], fieldNameToIndex["rcCommand[2]"]], |
507 | 501 | axisRate = [fieldNameToIndex["axisRate[0]"], fieldNameToIndex["axisRate[1]"], fieldNameToIndex["axisRate[2]"]], |
508 | 502 | sourceChunkIndex, destChunkIndex, |
509 | 503 | sysConfig, |
510 | | - attitude, |
511 | 504 | navVel = [fieldNameToIndex["navVel[0]"], fieldNameToIndex["navVel[1]"]], |
512 | 505 | wind = [fieldNameToIndex["wind[0]"], fieldNameToIndex["wind[1]"], fieldNameToIndex["wind[2]"]]; |
513 | 506 |
|
@@ -544,27 +537,12 @@ function FlightLog(logData) { |
544 | 537 | if (!destChunk.hasAdditionalFields) { |
545 | 538 | destChunk.hasAdditionalFields = true; |
546 | 539 |
|
547 | | - var |
548 | | - chunkIMU = new IMU(sourceChunks[sourceChunkIndex].initialIMU); |
549 | | - |
550 | 540 | for (var i = 0; i < sourceChunk.frames.length; i++) { |
551 | 541 | var |
552 | 542 | srcFrame = sourceChunk.frames[i], |
553 | 543 | destFrame = destChunk.frames[i], |
554 | 544 | fieldIndex = destFrame.length - ADDITIONAL_COMPUTED_FIELD_COUNT; |
555 | 545 |
|
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 | | - |
568 | 546 | // Add the PID sum |
569 | 547 | for (var axis = 0; axis < 3; axis++) { |
570 | 548 |
|
|
0 commit comments