-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
225 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
Fixed error when downloading a single log file. | ||
* You can now export the opened log as a CSV file! | ||
* A progress bar is now shown when downloading logs over SFTP. | ||
* The field count shown in the side bar no longer includes individual array items. | ||
* The name of ".rlog" files registered with the OS is now "Robot Logs" instead of "Robot logs" (to better match other formats). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Log } from "./modules/log.mjs" | ||
|
||
// Encodes the data from a Log to an array savable as a CSV. | ||
onmessage = function (event) { | ||
var log = new Log() | ||
log.rawData = event.data | ||
|
||
// Get list of fields | ||
var fields = [] | ||
var processTree = data => { | ||
Object.keys(data).sort().forEach(key => { | ||
if (data[key].field != null) { | ||
fields.push(data[key].field) | ||
} | ||
if (Object.keys(data[key].children).length > 0) { | ||
processTree(data[key].children) | ||
} | ||
}) | ||
} | ||
processTree(log.getFieldTree(false)) | ||
|
||
// Record timestamps | ||
var data = [["Timestamp"]] | ||
log.getTimestamps().forEach(timestamp => { | ||
data.push([[timestamp]]) | ||
}) | ||
|
||
// Retrieve data | ||
fields.forEach(id => { | ||
data[0].push(log.getFieldInfo(id).displayKey) | ||
var fieldData = log.getDataInRange(id, -Infinity, Infinity) | ||
log.getTimestamps().forEach((_, index) => { | ||
var nextIndex = fieldData.timestampIndexes.findIndex(value => value > index) | ||
if (nextIndex == -1) nextIndex = fieldData.timestampIndexes.length | ||
if (nextIndex == 0) { | ||
var value = null | ||
} else { | ||
var value = fieldData.values[nextIndex - 1] | ||
} | ||
data[index + 1].push(JSON.stringify(value).replaceAll(",", "_")) | ||
}) | ||
}) | ||
|
||
// Convert to string | ||
this.postMessage(data.map(x => x.join(",")).join("\n")) | ||
} |
Oops, something went wrong.