Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit ba2209c

Browse files
committed
Reading IMU reliably
1 parent 755886c commit ba2209c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ build/
1111
*.o
1212
*.out
1313
*.exp
14+
*.exe
1415

1516
# This file tells the rover to get its dependencies from local files instead of Git/Pub.
1617
# GitHub's CI needs to use the Pub versions, so we don't check in this file.

lib/src/devices/imu.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import "package:subsystems/subsystems.dart";
77
import "package:burt_network/burt_network.dart";
88

99
/// The serial port that the IMU is connected to.
10-
const imuPort = "COM5";
11-
// const imuPort = "/dev/rover-imu";
10+
const imuPort = "/dev/rover-imu";
1211

1312
/// The version that we are using for [RoverPosition] data.
1413
final positionVersion = Version(major: 1, minor: 0);

lib/src/devices/serial_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Future<Iterable<String>> getPortNames() async {
1515
if (!Platform.isLinux) return allPorts;
1616
final imuPort = await getRealPath("/dev/rover-imu");
1717
final gpsPort = await getRealPath("/dev/rover-gps");
18-
final forbiddenPorts = {imuPort, gpsPort};
18+
final forbiddenPorts = {imuPort, gpsPort, "/dev/ttyAMA10"};
1919
return allPorts.toSet().difference(forbiddenPorts);
2020
}
2121

lib/subsystems.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ class SubsystemsCollection extends Service {
3333

3434
@override
3535
Future<bool> init() async {
36-
logger.socket = server;
37-
logger.debug("Running in debug mode...");
38-
logger.trace("Running in trace mode...");
3936
await server.init();
37+
logger.socket = server;
4038
var result = true;
4139
try {
4240
result &= await firmware.init();
4341
result &= await gps.init();
4442
result &= await imu.init();
45-
logger.info("Subsystems initialized");
46-
if (!result) {
43+
if (result) {
44+
logger.info("Subsystems initialized");
45+
} else {
4746
logger.warning("The subsystems did not start properly");
4847
}
4948
isReady = true;
@@ -60,9 +59,10 @@ class SubsystemsCollection extends Service {
6059
await onDisconnect();
6160
isReady = false;
6261
await firmware.dispose();
63-
await server.dispose();
6462
await imu.dispose();
6563
await gps.dispose();
64+
await server.dispose();
65+
logger.socket = null;
6666
logger.info("Subsystems disposed");
6767
}
6868

0 commit comments

Comments
 (0)