-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Binghamton University Rover Team <[email protected]>
- Loading branch information
1 parent
ca760ac
commit 4546504
Showing
20 changed files
with
239 additions
and
357 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Levi has to review everything | ||
|
||
* @Levi-Lesches |
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 |
---|---|---|
|
@@ -27,7 +27,6 @@ analyzer: | |
|
||
exclude: | ||
- lib/generated/**.dart | ||
- test/**.dart | ||
|
||
linter: | ||
rules: | ||
|
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,47 @@ | ||
import "dart:convert"; | ||
import "dart:io"; | ||
|
||
import "package:csv/csv.dart"; | ||
import "package:burt_network/burt_network.dart"; | ||
import "package:subsystems/subsystems.dart"; | ||
|
||
const filename = r"C:\Users\Levi\Downloads\RoverPosition.log"; | ||
const outputName = "imu.csv"; | ||
|
||
extension <E> on Iterable<E> { | ||
Iterable<(int, E)> get enumerate sync* { | ||
int i = 0; | ||
for (final e in this) { | ||
yield (i++, e); | ||
} | ||
} | ||
} | ||
|
||
RoverPosition fromBuffer(List<int> buffer) => RoverPosition.fromBuffer(buffer); | ||
bool filter(RoverPosition data) => data.hasOrientation() | ||
&& data.orientation.hasX() && data.orientation.hasY() && data.orientation.hasZ() | ||
&& data.orientation.x.abs() < 400 | ||
&& data.orientation.y.abs() < 400 | ||
&& data.orientation.z.abs() < 400; | ||
List<dynamic> expand(RoverPosition data) => [data.orientation.x, data.orientation.y, data.orientation.z]; | ||
|
||
void main() async { | ||
logger.info("Reading log file..."); | ||
final file = File(filename); | ||
final lines = await file.readAsLines(); | ||
final data = <List<double>>[]; | ||
logger.info("Parsing..."); | ||
for (final (index, line) in lines.enumerate) { | ||
final buffer = base64Decode(line); | ||
final wrapper = WrappedMessage.fromBuffer(buffer); | ||
final entry = fromBuffer(wrapper.data); | ||
if (!filter(entry)) continue; | ||
data.add([index.toDouble(), ...expand(entry)]); | ||
} | ||
logger.info("Writing..."); | ||
const converter = ListToCsvConverter(); | ||
final csv = converter.convert(data); | ||
final outputFile = File(outputName); | ||
await outputFile.writeAsString(csv); | ||
logger.info("Wrote ${data.length} lines to ${outputFile.absolute}"); | ||
} |
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
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
Oops, something went wrong.