onDisconnect method

  1. @override
Future<void> onDisconnect()
override

A callback to run when the program has disconnected from the Dashboard.

Implementation

@override
Future<void> onDisconnect() async {
  await super.onDisconnect();
  logger.info("Stopping all hardware");
  final stopDrive = DriveCommand(throttle: 0, setThrottle: true);
  final stopArm = ArmCommand(stop: true);
  final stopGripper = GripperCommand(stop: true);
  final stopScience = ScienceCommand(stop: true);
  firmware.sendMessage(stopDrive);
  firmware.sendMessage(stopArm);
  firmware.sendMessage(stopGripper);
  firmware.sendMessage(stopScience);
}