@@ -4,13 +4,13 @@ import "dart:convert";
44import "dart:io" ;
55
66import "package:protobuf/protobuf.dart" as proto;
7- import "package:burt_network/generated .dart" ;
7+ import "package:burt_network/protobuf .dart" ;
88
99/// A cleaner name for any message generated by Protobuf.
1010typedef Message = proto.GeneratedMessage ;
1111
1212/// Return true to keep this data in the dataset, or false to remove it.
13- ///
13+ ///
1414/// Not only are the sensors on the rover wonky, but the CAN bus can corrupt data along the way.
1515/// This function can be used to remove any unwanted bad data.
1616bool shouldKeepData (Timestamp timestamp, ScienceData data) {
@@ -21,25 +21,25 @@ bool shouldKeepData(Timestamp timestamp, ScienceData data) {
2121 if (data.humidity.isOutOfBounds (min: 0 , max: 50 )) return false ;
2222 if (data.temperature.isOutOfBounds (min: 0 , max: 100 )) return false ;
2323
24- // Any other conditions should go here:
24+ // Any other conditions should go here:
2525 if (elapsed >= 30 * 60 ) return false ;
2626
2727 return true ; // if none of the above rules are broken, then keep this data
2828}
2929
30- /// Returns new data based on this one. To remove data, use [shouldKeepData] instead.
31- ///
30+ /// Returns new data based on this one. To remove data, use [shouldKeepData] instead.
31+ ///
3232/// You shouldn't need this unless you specifically need to change the *values* of the data. For example,
3333/// if the CO2 sensor was consistently 100ppm off, you could use this function to add 100ppm to each data.
34- ///
35- /// NOTE: Do not modify fields that are zero, because they are likely sent in another "packet". For
34+ ///
35+ /// NOTE: Do not modify fields that are zero, because they are likely sent in another "packet". For
3636/// example, if you want to modify CO2 but `data.co2 == 0` , this packet could be, eg, a methane packet
3737/// and isn't meant to have any CO2 data.
3838WrappedMessage modifyData (Timestamp timestamp, ScienceData data) { // ignore: prefer_expression_function_bodies
39- // Example 1: Add 100 ppm to all CO2:
39+ // Example 1: Add 100 ppm to all CO2:
4040 // if (data.co2 != 0) data.co2 += 100;
41- //
42- // Example 2: Add one second to all the timestamps:
41+ //
42+ // Example 2: Add one second to all the timestamps:
4343 // timestamp += Duration(seconds: 1)
4444
4545 // Wrap the data and return it. Do not delete.
@@ -50,17 +50,17 @@ WrappedMessage modifyData(Timestamp timestamp, ScienceData data) { // ignore: p
5050/// Use this to add new data to your dataset.
5151List<WrappedMessage> newData = [
5252 // Adds methane=1 for every second from t=1 to t=100 seconds
53- for (int t = 0; t < 100; t++)
53+ for (int t = 0; t < 100; t++)
5454 ScienceData(methane: 1).wrap(DateTime.now().add(Duration(seconds: t))),
5555
5656 // Adds some random methane in an increasing line between t=100 and t=200 seconds
57- for (int t = 100; t < 200; t++)
57+ for (int t = 100; t < 200; t++)
5858 ScienceData(methane: t + random.nextDouble() * 20).wrap(DateTime.now().add(Duration(seconds: t))),
5959
6060 // Adds completely random data for t=0 to t=20 seconds, for all three samples
61- for (int s = 0; s < 3; s++)
61+ for (int s = 0; s < 3; s++)
6262 for (int t = 0; t < 20; t++) ScienceData(
63- // sample: s,
63+ // sample: s,
6464 temperature: t + s + (random.nextInt(10).toDouble()),
6565 methane: t + s + (random.nextInt(7).toDouble()),
6666 co2: t + s + (random.nextInt(5).toDouble()),
0 commit comments