diff --git a/.github/workflows/analyze.yaml b/.github/workflows/analyze.yaml index 79808197..9c152959 100644 --- a/.github/workflows/analyze.yaml +++ b/.github/workflows/analyze.yaml @@ -25,6 +25,9 @@ jobs: - name: Analyze code run: dart analyze --fatal-infos + - name: Check arm auxillary formatting + run: dart format --output=none --set-exit-if-changed arm_auxillary/bin/* arm_auxillary/lib/* + - name: Check autonomy formatting run: dart format --output=none --set-exit-if-changed autonomy/bin/* autonomy/lib/* autonomy/test/* diff --git a/arm_auxillary/.gitignore b/arm_auxillary/.gitignore new file mode 100644 index 00000000..2d9b0510 --- /dev/null +++ b/arm_auxillary/.gitignore @@ -0,0 +1,4 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ +pubspec_overrides.yaml diff --git a/arm_auxillary/README.md b/arm_auxillary/README.md new file mode 100644 index 00000000..dfcd3131 --- /dev/null +++ b/arm_auxillary/README.md @@ -0,0 +1 @@ +Program for the auxillary board on the arm. diff --git a/arm_auxillary/bin/arm_auxillary.dart b/arm_auxillary/bin/arm_auxillary.dart new file mode 100644 index 00000000..0851a687 --- /dev/null +++ b/arm_auxillary/bin/arm_auxillary.dart @@ -0,0 +1,5 @@ +import "package:arm_auxillary/arm_auxillary.dart"; + +void main() async { + await collection.init(); +} diff --git a/arm_auxillary/lib/arm_auxillary.dart b/arm_auxillary/lib/arm_auxillary.dart new file mode 100644 index 00000000..7952f100 --- /dev/null +++ b/arm_auxillary/lib/arm_auxillary.dart @@ -0,0 +1,82 @@ +import "dart:io"; + +import "package:burt_network/burt_network.dart"; + +import "src/firmware.dart"; +import "src/arm_camera_manager.dart"; + +/// Logger for the arm auxillary program +final logger = BurtLogger(); + +/// The socket destination for the subsystems program +final subsystemsSocket = SocketInfo( + address: InternetAddress("192.168.1.20"), + port: 8001, +); + +/// The resouces needed to run the arm auxillary program +class ArmAuxillary extends Service { + /// Whether the arm auxillary code is fully initialized. + bool isReady = false; + + /// The Serial service. + late final firmware = FirmwareManager( + getServer: () => server, + logger: logger, + ); + + /// The camera manager for arm cameras. + final cameras = ArmCameraManager(); + + /// The server for the arm auxillary program + late final RoverSocket server = RoverSocket( + device: Device.ARM, + port: 8010, + collection: this, + destination: subsystemsSocket, + keepDestination: true, + ); + + @override + Future init() async { + var result = true; + logger.socket = server; + result &= await server.init(); + // TODO(arm): Initialize the rest of the arm auxillary's resources, such as + // TODO(arm): arm and EA board communication + try { + result &= await firmware.init(); + result &= await cameras.init(); + cameras.setServer(server); + if (result) { + logger.info("Arm Auxillary software initialized"); + } else { + logger.warning("The arm auxillary software did not start properly"); + } + isReady = true; + + // The arm auxillary software should keep running even when something goes wrong. + return true; + } catch (error) { + logger.critical( + "Unexpected error when initializing Arm Auxillary", + body: error.toString(), + ); + return false; + } + } + + @override + Future dispose() async { + logger.info("Arm Auxillary software shutting down..."); + isReady = false; + await cameras.dispose(); + await firmware.dispose(); + await server.dispose(); + logger.socket = null; + logger.info("Subsystems disposed"); + } +} + +/// The collection of all the arm auxillary's resources +final collection = ArmAuxillary(); diff --git a/arm_auxillary/lib/src/arm_camera_manager.dart b/arm_auxillary/lib/src/arm_camera_manager.dart new file mode 100644 index 00000000..f870b837 --- /dev/null +++ b/arm_auxillary/lib/src/arm_camera_manager.dart @@ -0,0 +1,203 @@ +import "dart:async"; +import "dart:io"; + +import "package:typed_isolate/typed_isolate.dart"; +import "package:burt_network/burt_network.dart"; + +import "package:video/video.dart"; + +/// Socket destination for the main video program on the Jetson +final videoSocket = SocketInfo( + address: InternetAddress("192.168.1.30"), + port: 8004, // Video program port +); + +/// Manages arm cameras and streams video data to the main video program. +class ArmCameraManager extends Service { + /// The parent isolate that spawns the arm camera isolates. + final parent = IsolateParent(); + + /// Stream subscriptions for cleanup + StreamSubscription? _commands; + StreamSubscription? _data; + + /// Reference to the server for sending messages + RoverSocket? _server; + + @override + Future init() async { + logger.info("Initializing arm camera manager"); + + parent.init(); + _data = parent.stream.listen(onData); + + await _spawnArmCameras(); + + logger.info("Arm camera manager initialized"); + return true; + } + + @override + Future dispose() async { + logger.info("Disposing arm camera manager"); + + stopAll(); + + // Wait a bit after sending the stop command so the messages are received properly + await Future.delayed(const Duration(milliseconds: 750)); + + await _commands?.cancel(); + // Dispose the parent isolate and kill all children before canceling + // data subscription, just in case if one last native frame is received + await parent.dispose(); + + // Wait just a little bit to ensure any remaining messages get sent + // otherwise, if a message contained native memory, it will never + // be disposed + await Future.delayed(const Duration(milliseconds: 50)); + + await _data?.cancel(); + + logger.info("Arm camera manager disposed"); + } + + /// Sets the server reference for message handling + void setServer(RoverSocket server) { + _server = server; + + // Set up command subscription now that server is available + _commands = server.messages.onMessage( + name: VideoCommand().messageName, + constructor: VideoCommand.fromBuffer, + callback: _handleCommand, + ); + + logger.info("Arm camera manager connected to server"); + } + + /// Spawns camera isolates for detected arm cameras + Future _spawnArmCameras() async { + logger.info("Detecting arm cameras..."); + + final armCameraNames = [ + CameraName.ARM_LEFT, + CameraName.ARM_RIGHT, + CameraName.GAP_CAM, + ]; + + for (final cameraName in armCameraNames) { + try { + final details = _createArmCameraDetails(cameraName); + final isolate = OpenCVCameraIsolate(details: details); + await parent.spawn(isolate); + + logger.info("Spawned camera isolate for $cameraName"); + } catch (error) { + logger.error( + "Failed to spawn camera isolate for $cameraName", + body: error.toString(), + ); + } + } + } + + /// Creates camera details for arm cameras + CameraDetails _createArmCameraDetails(CameraName name) => CameraDetails( + name: name, + resolutionWidth: 640, + resolutionHeight: 480, + fps: 15, + quality: 80, + status: CameraStatus.CAMERA_LOADING, + ); + + /// Handles data coming from the arm camera isolates + void onData(IsolatePayload data) { + switch (data) { + case FramePayload(:final details, :final screenshotPath): + final image = data.image?.toU8List(); + data.dispose(); + + if (_server != null && image != null) { + _server!.sendMessage( + VideoData( + frame: image, + details: details, + imagePath: screenshotPath, + ), + destination: videoSocket, + ); + } + + case LogPayload(): + switch (data.level) { + case LogLevel.all: + logger.info("Camera isolate: ${data.message}", body: data.body); + // ignore: deprecated_member_use + case LogLevel.verbose: + logger.trace("Camera isolate: ${data.message}", body: data.body); + case LogLevel.trace: + logger.trace("Camera isolate: ${data.message}", body: data.body); + case LogLevel.debug: + logger.debug("Camera isolate: ${data.message}", body: data.body); + case LogLevel.info: + logger.info("Camera isolate: ${data.message}", body: data.body); + case LogLevel.warning: + logger.warning("Camera isolate: ${data.message}", body: data.body); + case LogLevel.error: + logger.error("Camera isolate: ${data.message}", body: data.body); + case LogLevel.fatal: + logger.critical("Camera isolate: ${data.message}", body: data.body); + case LogLevel.off: + logger.info("Camera isolate: ${data.message}", body: data.body); + // ignore: deprecated_member_use + case LogLevel.wtf: + logger.critical("Camera isolate: ${data.message}", body: data.body); + // ignore: deprecated_member_use + case LogLevel.nothing: + break; + } + + case ObjectDetectionPayload(:final details, :final tags): + if (_server != null) { + final visionResult = VideoData( + details: details, + detectedObjects: tags, + version: Version(major: 1, minor: 2), + ); + _server!.sendMessage(visionResult, destination: videoSocket); + } + + default: + logger.warning("Unknown payload type from camera isolate"); + } + } + + /// Handles commands from the video program + void _handleCommand(VideoCommand command) { + logger.debug("Received camera command for ${command.details.name}"); + + // Route command to correct camera isolate + parent.sendToChild(data: command, id: command.details.name); + } + + /// Stops all arm cameras + void stopAll() { + final stopCommand = VideoCommand( + details: CameraDetails(status: CameraStatus.CAMERA_DISABLED), + ); + + // Send stop command to all arm camera isolates + final armCameraNames = [ + CameraName.ARM_LEFT, + CameraName.ARM_RIGHT, + CameraName.GAP_CAM, + ]; + + for (final name in armCameraNames) { + parent.sendToChild(data: stopCommand, id: name); + } + + logger.info("Stopping all arm cameras"); + } +} diff --git a/arm_auxillary/lib/src/firmware.dart b/arm_auxillary/lib/src/firmware.dart new file mode 100644 index 00000000..81234113 --- /dev/null +++ b/arm_auxillary/lib/src/firmware.dart @@ -0,0 +1,76 @@ +import "dart:async"; + +import "package:collection/collection.dart"; + +import "package:burt_network/burt_network.dart"; +import "package:subsystems/subsystems.dart"; + +/// Maps command names to [Device]s. +final nameToDevice = { + ArmCommand().messageName: Device.ARM, + DriveCommand().messageName: Device.DRIVE, + ScienceCommand().messageName: Device.SCIENCE, + RelaysCommand().messageName: Device.RELAY, +}; + +/// Service to manage communication from the arm auxillary board to EA and HREI devices +class FirmwareManager extends Service { + /// Reference to the server for routing messages + final RoverSocket? Function() getServer; + + /// Logger instance + final BurtLogger logger; + + /// Subscriptions to each of the firmware devices. + final List> _subscriptions = []; + + /// A list of firmware devices attached to the rover. + List devices = []; + + /// Creates a new FirmwareManager instance + FirmwareManager({required this.getServer, required this.logger}); + + @override + Future init() async { + devices = await getFirmwareDevices(); + final server = getServer(); + server?.messages.listen(_sendToSerial); + var result = true; + for (final device in devices) { + logger.debug("Initializing device: ${device.port}"); + result &= await device.init(); + if (!device.isReady) continue; + final subscription = device.messages.listen( + server?.sendWrapper ?? (_) {}, + ); + _subscriptions.add(subscription); + } + return result; + } + + /// Sends messages from the server to the appropriate serial device + void _sendToSerial(WrappedMessage message) { + final device = nameToDevice[message.name]; + if (device == null) return; + final serial = devices.firstWhereOrNull((s) => s.device == device); + if (serial == null) return; + serial.sendBytes(message.data); + } + + @override + Future dispose() async { + for (final subscription in _subscriptions) { + await subscription.cancel(); + } + for (final device in devices) { + await device.dispose(); + } + } + + /// Sends a [Message] to the appropriate firmware device. + /// + /// This does nothing if the appropriate device is not connected. Specifically, this is not an + /// error because the Dashboard may be used during testing, when the hardware devices may not be + /// assembled, connected, or functional yet. + void sendMessage(Message message) => _sendToSerial(message.wrap()); +} diff --git a/arm_auxillary/pubspec.yaml b/arm_auxillary/pubspec.yaml new file mode 100644 index 00000000..6ad5e95b --- /dev/null +++ b/arm_auxillary/pubspec.yaml @@ -0,0 +1,21 @@ +name: arm_auxillary +description: A sample command-line application. +version: 1.0.0 +publish_to: none + +resolution: workspace + +environment: + sdk: ^3.9.0 + +# Add regular dependencies here. +dependencies: + burt_network: ^2.8.0 + collection: ^1.19.0 + subsystems: ^1.0.0 + video: ^1.1.0 + typed_isolate: ^6.0.0 + dartcv4: ^1.1.8 + +dev_dependencies: + very_good_analysis: ^6.0.0 diff --git a/autonomy/.github/pubspec_overrides.yaml b/autonomy/.github/pubspec_overrides.yaml new file mode 100644 index 00000000..e25d2156 --- /dev/null +++ b/autonomy/.github/pubspec_overrides.yaml @@ -0,0 +1,7 @@ +resolution: + +dependency_overrides: + burt_network: + git: + url: https://github.com/BinghamtonRover/Rover-Code.git + path: burt_network \ No newline at end of file diff --git a/autonomy/.github/workflows/analyze.yml b/autonomy/.github/workflows/analyze.yml new file mode 100644 index 00000000..6761abc3 --- /dev/null +++ b/autonomy/.github/workflows/analyze.yml @@ -0,0 +1,42 @@ +name: Dart Analyzer + +on: + push: + branches: [ "main" ] + pull_request: + +jobs: + analyze: + runs-on: ubuntu-latest + + steps: + - name: Clone repo + uses: actions/checkout@v4 + + # Note: This workflow uses the latest stable version of the Dart SDK. + # You can specify other versions if desired, see documentation here: + # https://github.com/dart-lang/setup-dart/blob/main/README.md + - name: Setup dart + uses: dart-lang/setup-dart@v1 + with: + sdk: 3.9.0 + + # This package is part of a Pub Workspace. However, CI still needs to + # run on this repo by itself, so we want to override burt_network to use + # a Git dependency ONLY on GitHub Actions. + # + # To get around this, we commit the overrides to the .github folder where + # Dart can't find them, then copy them as part of the CI workflow. + - name: Install dependencies + run: | + mv .github/pubspec_overrides.yaml . + dart pub get + + - name: Analyze project source + run: dart analyze --fatal-infos + + # Your project will need to have tests in test/ and a dependency on + # package:test for this step to succeed. Note that Flutter projects will + # want to change this to 'flutter test'. + - name: Run tests + run: dart test diff --git a/autonomy/.github/workflows/documentation.yml b/autonomy/.github/workflows/documentation.yml new file mode 100644 index 00000000..4d214996 --- /dev/null +++ b/autonomy/.github/workflows/documentation.yml @@ -0,0 +1,42 @@ +name: Generate Dart Documentation + +on: + push: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Git Setup + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + git branch --all + git switch --track origin/documentation + git reset --hard origin/main + + - name: Install Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: 3.9.0 + + - name: Install dependencies + run: dart pub get + + - name: Generate documentation + run: dartdoc --ignore 'unresolved-doc-reference,not-implemented,no-documentable-libraries,ambiguous-reexport' --exclude 'dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io,dart:isolate,dart:math,dart:typed_data,dart:ui,dart:html,dart:js,dart:ffi,dart:js_util' --quiet --json --output docs --no-validate-links --no-verbose-warnings --no-allow-non-local-warnings + + - name: Commit and push files + run: | + cd docs + cd .. + git status + git stage --force docs + git commit -a -m "Generated documentation" + git push --force diff --git a/burt_network/Protobuf b/burt_network/Protobuf index 7d44b26c..06dc109a 160000 --- a/burt_network/Protobuf +++ b/burt_network/Protobuf @@ -1 +1 @@ -Subproject commit 7d44b26cd0d591c45fcfd0dbcaea7d718b59aeb7 +Subproject commit 06dc109a951bb384cd6640bd64685647ed33efe5 diff --git a/burt_network/lib/src/generated/arm.pb.dart b/burt_network/lib/src/generated/arm.pb.dart index 858c4c6a..d9118b27 100644 --- a/burt_network/lib/src/generated/arm.pb.dart +++ b/burt_network/lib/src/generated/arm.pb.dart @@ -14,10 +14,10 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; -import 'geometry.pb.dart' as $0; -import 'motor.pb.dart' as $1; +import 'geometry.pb.dart' as $2; +import 'motor.pb.dart' as $0; import 'utils.pbenum.dart' as $3; -import 'version.pb.dart' as $2; +import 'version.pb.dart' as $1; export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; @@ -187,22 +187,163 @@ class JointAngleData extends $pb.GeneratedMessage { void clearWristPitchMulti() => $_clearField(10); } +class WristData extends $pb.GeneratedMessage { + factory WristData({ + $core.double? pitchAngle, + $core.double? rollAngle, + $0.MotorData? motorA, + $0.MotorData? motorB, + $3.BoolState? isMoving, + $3.BoolState? isCalibrated, + $1.Version? version, + }) { + final result = create(); + if (pitchAngle != null) result.pitchAngle = pitchAngle; + if (rollAngle != null) result.rollAngle = rollAngle; + if (motorA != null) result.motorA = motorA; + if (motorB != null) result.motorB = motorB; + if (isMoving != null) result.isMoving = isMoving; + if (isCalibrated != null) result.isCalibrated = isCalibrated; + if (version != null) result.version = version; + return result; + } + + WristData._(); + + factory WristData.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory WristData.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'WristData', + createEmptyInstance: create) + ..aD(1, _omitFieldNames ? '' : 'pitchAngle', fieldType: $pb.PbFieldType.OF) + ..aD(2, _omitFieldNames ? '' : 'rollAngle', fieldType: $pb.PbFieldType.OF) + ..aOM<$0.MotorData>(3, _omitFieldNames ? '' : 'motorA', + protoName: 'motorA', subBuilder: $0.MotorData.create) + ..aOM<$0.MotorData>(4, _omitFieldNames ? '' : 'motorB', + protoName: 'motorB', subBuilder: $0.MotorData.create) + ..aE<$3.BoolState>(5, _omitFieldNames ? '' : 'isMoving', + enumValues: $3.BoolState.values) + ..aE<$3.BoolState>(6, _omitFieldNames ? '' : 'isCalibrated', + enumValues: $3.BoolState.values) + ..aOM<$1.Version>(7, _omitFieldNames ? '' : 'version', + subBuilder: $1.Version.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + WristData clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + WristData copyWith(void Function(WristData) updates) => + super.copyWith((message) => updates(message as WristData)) as WristData; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static WristData create() => WristData._(); + @$core.override + WristData createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static WristData getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static WristData? _defaultInstance; + + /// Virtual joint state (what the subsystem thinks pitch/roll are). + @$pb.TagNumber(1) + $core.double get pitchAngle => $_getN(0); + @$pb.TagNumber(1) + set pitchAngle($core.double value) => $_setFloat(0, value); + @$pb.TagNumber(1) + $core.bool hasPitchAngle() => $_has(0); + @$pb.TagNumber(1) + void clearPitchAngle() => $_clearField(1); + + @$pb.TagNumber(2) + $core.double get rollAngle => $_getN(1); + @$pb.TagNumber(2) + set rollAngle($core.double value) => $_setFloat(1, value); + @$pb.TagNumber(2) + $core.bool hasRollAngle() => $_has(1); + @$pb.TagNumber(2) + void clearRollAngle() => $_clearField(2); + + @$pb.TagNumber(3) + $0.MotorData get motorA => $_getN(2); + @$pb.TagNumber(3) + set motorA($0.MotorData value) => $_setField(3, value); + @$pb.TagNumber(3) + $core.bool hasMotorA() => $_has(2); + @$pb.TagNumber(3) + void clearMotorA() => $_clearField(3); + @$pb.TagNumber(3) + $0.MotorData ensureMotorA() => $_ensure(2); + + @$pb.TagNumber(4) + $0.MotorData get motorB => $_getN(3); + @$pb.TagNumber(4) + set motorB($0.MotorData value) => $_setField(4, value); + @$pb.TagNumber(4) + $core.bool hasMotorB() => $_has(3); + @$pb.TagNumber(4) + void clearMotorB() => $_clearField(4); + @$pb.TagNumber(4) + $0.MotorData ensureMotorB() => $_ensure(3); + + /// Overall health/status flags + @$pb.TagNumber(5) + $3.BoolState get isMoving => $_getN(4); + @$pb.TagNumber(5) + set isMoving($3.BoolState value) => $_setField(5, value); + @$pb.TagNumber(5) + $core.bool hasIsMoving() => $_has(4); + @$pb.TagNumber(5) + void clearIsMoving() => $_clearField(5); + + @$pb.TagNumber(6) + $3.BoolState get isCalibrated => $_getN(5); + @$pb.TagNumber(6) + set isCalibrated($3.BoolState value) => $_setField(6, value); + @$pb.TagNumber(6) + $core.bool hasIsCalibrated() => $_has(5); + @$pb.TagNumber(6) + void clearIsCalibrated() => $_clearField(6); + + @$pb.TagNumber(7) + $1.Version get version => $_getN(6); + @$pb.TagNumber(7) + set version($1.Version value) => $_setField(7, value); + @$pb.TagNumber(7) + $core.bool hasVersion() => $_has(6); + @$pb.TagNumber(7) + void clearVersion() => $_clearField(7); + @$pb.TagNumber(7) + $1.Version ensureVersion() => $_ensure(6); +} + class ArmData extends $pb.GeneratedMessage { factory ArmData({ - $0.Coordinates? currentPosition, - $0.Coordinates? targetPosition, - $1.MotorData? base, - $1.MotorData? shoulder, - $1.MotorData? elbow, - $2.Version? version, + $2.Coordinates? currentPosition, + $2.Coordinates? targetPosition, + $0.MotorData? base, + $0.MotorData? shoulder, + $0.MotorData? elbow, + $1.Version? version, $core.double? ussDistance, - $1.MotorData? lift, - $1.MotorData? rotate, - $1.MotorData? pinch, + $0.MotorData? lift, + $0.MotorData? rotate, + $0.MotorData? pinch, $core.int? servoAngle, $3.BoolState? laserState, - $1.MotorData? roll, + $0.MotorData? roll, JointAngleData? jointAngles, + WristData? wrist, + $3.BoolState? usingIk, + $2.Orientation? currentOrientation, + $2.Orientation? targetOrientation, }) { final result = create(); if (currentPosition != null) result.currentPosition = currentPosition; @@ -219,6 +360,11 @@ class ArmData extends $pb.GeneratedMessage { if (laserState != null) result.laserState = laserState; if (roll != null) result.roll = roll; if (jointAngles != null) result.jointAngles = jointAngles; + if (wrist != null) result.wrist = wrist; + if (usingIk != null) result.usingIk = usingIk; + if (currentOrientation != null) + result.currentOrientation = currentOrientation; + if (targetOrientation != null) result.targetOrientation = targetOrientation; return result; } @@ -234,32 +380,40 @@ class ArmData extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'ArmData', createEmptyInstance: create) - ..aOM<$0.Coordinates>(1, _omitFieldNames ? '' : 'currentPosition', - subBuilder: $0.Coordinates.create) - ..aOM<$0.Coordinates>(2, _omitFieldNames ? '' : 'targetPosition', - subBuilder: $0.Coordinates.create) - ..aOM<$1.MotorData>(3, _omitFieldNames ? '' : 'base', - subBuilder: $1.MotorData.create) - ..aOM<$1.MotorData>(4, _omitFieldNames ? '' : 'shoulder', - subBuilder: $1.MotorData.create) - ..aOM<$1.MotorData>(5, _omitFieldNames ? '' : 'elbow', - subBuilder: $1.MotorData.create) - ..aOM<$2.Version>(6, _omitFieldNames ? '' : 'version', - subBuilder: $2.Version.create) + ..aOM<$2.Coordinates>(1, _omitFieldNames ? '' : 'currentPosition', + subBuilder: $2.Coordinates.create) + ..aOM<$2.Coordinates>(2, _omitFieldNames ? '' : 'targetPosition', + subBuilder: $2.Coordinates.create) + ..aOM<$0.MotorData>(3, _omitFieldNames ? '' : 'base', + subBuilder: $0.MotorData.create) + ..aOM<$0.MotorData>(4, _omitFieldNames ? '' : 'shoulder', + subBuilder: $0.MotorData.create) + ..aOM<$0.MotorData>(5, _omitFieldNames ? '' : 'elbow', + subBuilder: $0.MotorData.create) + ..aOM<$1.Version>(6, _omitFieldNames ? '' : 'version', + subBuilder: $1.Version.create) ..aD(7, _omitFieldNames ? '' : 'ussDistance', fieldType: $pb.PbFieldType.OF) - ..aOM<$1.MotorData>(8, _omitFieldNames ? '' : 'lift', - subBuilder: $1.MotorData.create) - ..aOM<$1.MotorData>(9, _omitFieldNames ? '' : 'rotate', - subBuilder: $1.MotorData.create) - ..aOM<$1.MotorData>(10, _omitFieldNames ? '' : 'pinch', - subBuilder: $1.MotorData.create) + ..aOM<$0.MotorData>(8, _omitFieldNames ? '' : 'lift', + subBuilder: $0.MotorData.create) + ..aOM<$0.MotorData>(9, _omitFieldNames ? '' : 'rotate', + subBuilder: $0.MotorData.create) + ..aOM<$0.MotorData>(10, _omitFieldNames ? '' : 'pinch', + subBuilder: $0.MotorData.create) ..aI(11, _omitFieldNames ? '' : 'servoAngle') ..aE<$3.BoolState>(12, _omitFieldNames ? '' : 'laserState', enumValues: $3.BoolState.values) - ..aOM<$1.MotorData>(13, _omitFieldNames ? '' : 'roll', - subBuilder: $1.MotorData.create) + ..aOM<$0.MotorData>(13, _omitFieldNames ? '' : 'roll', + subBuilder: $0.MotorData.create) ..aOM(14, _omitFieldNames ? '' : 'jointAngles', subBuilder: JointAngleData.create) + ..aOM(15, _omitFieldNames ? '' : 'wrist', + subBuilder: WristData.create) + ..aE<$3.BoolState>(16, _omitFieldNames ? '' : 'usingIk', + enumValues: $3.BoolState.values) + ..aOM<$2.Orientation>(17, _omitFieldNames ? '' : 'currentOrientation', + subBuilder: $2.Orientation.create) + ..aOM<$2.Orientation>(18, _omitFieldNames ? '' : 'targetOrientation', + subBuilder: $2.Orientation.create) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -282,70 +436,70 @@ class ArmData extends $pb.GeneratedMessage { /// Arm Commands @$pb.TagNumber(1) - $0.Coordinates get currentPosition => $_getN(0); + $2.Coordinates get currentPosition => $_getN(0); @$pb.TagNumber(1) - set currentPosition($0.Coordinates value) => $_setField(1, value); + set currentPosition($2.Coordinates value) => $_setField(1, value); @$pb.TagNumber(1) $core.bool hasCurrentPosition() => $_has(0); @$pb.TagNumber(1) void clearCurrentPosition() => $_clearField(1); @$pb.TagNumber(1) - $0.Coordinates ensureCurrentPosition() => $_ensure(0); + $2.Coordinates ensureCurrentPosition() => $_ensure(0); @$pb.TagNumber(2) - $0.Coordinates get targetPosition => $_getN(1); + $2.Coordinates get targetPosition => $_getN(1); @$pb.TagNumber(2) - set targetPosition($0.Coordinates value) => $_setField(2, value); + set targetPosition($2.Coordinates value) => $_setField(2, value); @$pb.TagNumber(2) $core.bool hasTargetPosition() => $_has(1); @$pb.TagNumber(2) void clearTargetPosition() => $_clearField(2); @$pb.TagNumber(2) - $0.Coordinates ensureTargetPosition() => $_ensure(1); + $2.Coordinates ensureTargetPosition() => $_ensure(1); @$pb.TagNumber(3) - $1.MotorData get base => $_getN(2); + $0.MotorData get base => $_getN(2); @$pb.TagNumber(3) - set base($1.MotorData value) => $_setField(3, value); + set base($0.MotorData value) => $_setField(3, value); @$pb.TagNumber(3) $core.bool hasBase() => $_has(2); @$pb.TagNumber(3) void clearBase() => $_clearField(3); @$pb.TagNumber(3) - $1.MotorData ensureBase() => $_ensure(2); + $0.MotorData ensureBase() => $_ensure(2); @$pb.TagNumber(4) - $1.MotorData get shoulder => $_getN(3); + $0.MotorData get shoulder => $_getN(3); @$pb.TagNumber(4) - set shoulder($1.MotorData value) => $_setField(4, value); + set shoulder($0.MotorData value) => $_setField(4, value); @$pb.TagNumber(4) $core.bool hasShoulder() => $_has(3); @$pb.TagNumber(4) void clearShoulder() => $_clearField(4); @$pb.TagNumber(4) - $1.MotorData ensureShoulder() => $_ensure(3); + $0.MotorData ensureShoulder() => $_ensure(3); @$pb.TagNumber(5) - $1.MotorData get elbow => $_getN(4); + $0.MotorData get elbow => $_getN(4); @$pb.TagNumber(5) - set elbow($1.MotorData value) => $_setField(5, value); + set elbow($0.MotorData value) => $_setField(5, value); @$pb.TagNumber(5) $core.bool hasElbow() => $_has(4); @$pb.TagNumber(5) void clearElbow() => $_clearField(5); @$pb.TagNumber(5) - $1.MotorData ensureElbow() => $_ensure(4); + $0.MotorData ensureElbow() => $_ensure(4); @$pb.TagNumber(6) - $2.Version get version => $_getN(5); + $1.Version get version => $_getN(5); @$pb.TagNumber(6) - set version($2.Version value) => $_setField(6, value); + set version($1.Version value) => $_setField(6, value); @$pb.TagNumber(6) $core.bool hasVersion() => $_has(5); @$pb.TagNumber(6) void clearVersion() => $_clearField(6); @$pb.TagNumber(6) - $2.Version ensureVersion() => $_ensure(5); + $1.Version ensureVersion() => $_ensure(5); /// USS data @$pb.TagNumber(7) @@ -359,37 +513,37 @@ class ArmData extends $pb.GeneratedMessage { /// Gripper Commands @$pb.TagNumber(8) - $1.MotorData get lift => $_getN(7); + $0.MotorData get lift => $_getN(7); @$pb.TagNumber(8) - set lift($1.MotorData value) => $_setField(8, value); + set lift($0.MotorData value) => $_setField(8, value); @$pb.TagNumber(8) $core.bool hasLift() => $_has(7); @$pb.TagNumber(8) void clearLift() => $_clearField(8); @$pb.TagNumber(8) - $1.MotorData ensureLift() => $_ensure(7); + $0.MotorData ensureLift() => $_ensure(7); @$pb.TagNumber(9) - $1.MotorData get rotate => $_getN(8); + $0.MotorData get rotate => $_getN(8); @$pb.TagNumber(9) - set rotate($1.MotorData value) => $_setField(9, value); + set rotate($0.MotorData value) => $_setField(9, value); @$pb.TagNumber(9) $core.bool hasRotate() => $_has(8); @$pb.TagNumber(9) void clearRotate() => $_clearField(9); @$pb.TagNumber(9) - $1.MotorData ensureRotate() => $_ensure(8); + $0.MotorData ensureRotate() => $_ensure(8); @$pb.TagNumber(10) - $1.MotorData get pinch => $_getN(9); + $0.MotorData get pinch => $_getN(9); @$pb.TagNumber(10) - set pinch($1.MotorData value) => $_setField(10, value); + set pinch($0.MotorData value) => $_setField(10, value); @$pb.TagNumber(10) $core.bool hasPinch() => $_has(9); @$pb.TagNumber(10) void clearPinch() => $_clearField(10); @$pb.TagNumber(10) - $1.MotorData ensurePinch() => $_ensure(9); + $0.MotorData ensurePinch() => $_ensure(9); @$pb.TagNumber(11) $core.int get servoAngle => $_getIZ(10); @@ -410,15 +564,15 @@ class ArmData extends $pb.GeneratedMessage { void clearLaserState() => $_clearField(12); @$pb.TagNumber(13) - $1.MotorData get roll => $_getN(12); + $0.MotorData get roll => $_getN(12); @$pb.TagNumber(13) - set roll($1.MotorData value) => $_setField(13, value); + set roll($0.MotorData value) => $_setField(13, value); @$pb.TagNumber(13) $core.bool hasRoll() => $_has(12); @$pb.TagNumber(13) void clearRoll() => $_clearField(13); @$pb.TagNumber(13) - $1.MotorData ensureRoll() => $_ensure(12); + $0.MotorData ensureRoll() => $_ensure(12); @$pb.TagNumber(14) JointAngleData get jointAngles => $_getN(13); @@ -430,31 +584,191 @@ class ArmData extends $pb.GeneratedMessage { void clearJointAngles() => $_clearField(14); @$pb.TagNumber(14) JointAngleData ensureJointAngles() => $_ensure(13); + + @$pb.TagNumber(15) + WristData get wrist => $_getN(14); + @$pb.TagNumber(15) + set wrist(WristData value) => $_setField(15, value); + @$pb.TagNumber(15) + $core.bool hasWrist() => $_has(14); + @$pb.TagNumber(15) + void clearWrist() => $_clearField(15); + @$pb.TagNumber(15) + WristData ensureWrist() => $_ensure(14); + + @$pb.TagNumber(16) + $3.BoolState get usingIk => $_getN(15); + @$pb.TagNumber(16) + set usingIk($3.BoolState value) => $_setField(16, value); + @$pb.TagNumber(16) + $core.bool hasUsingIk() => $_has(15); + @$pb.TagNumber(16) + void clearUsingIk() => $_clearField(16); + + @$pb.TagNumber(17) + $2.Orientation get currentOrientation => $_getN(16); + @$pb.TagNumber(17) + set currentOrientation($2.Orientation value) => $_setField(17, value); + @$pb.TagNumber(17) + $core.bool hasCurrentOrientation() => $_has(16); + @$pb.TagNumber(17) + void clearCurrentOrientation() => $_clearField(17); + @$pb.TagNumber(17) + $2.Orientation ensureCurrentOrientation() => $_ensure(16); + + @$pb.TagNumber(18) + $2.Orientation get targetOrientation => $_getN(17); + @$pb.TagNumber(18) + set targetOrientation($2.Orientation value) => $_setField(18, value); + @$pb.TagNumber(18) + $core.bool hasTargetOrientation() => $_has(17); + @$pb.TagNumber(18) + void clearTargetOrientation() => $_clearField(18); + @$pb.TagNumber(18) + $2.Orientation ensureTargetOrientation() => $_ensure(17); +} + +class WristCommand extends $pb.GeneratedMessage { + factory WristCommand({ + $core.bool? stop, + $core.bool? calibrate, + $0.MotorCommand? pitch, + $0.MotorCommand? roll, + $1.Version? version, + }) { + final result = create(); + if (stop != null) result.stop = stop; + if (calibrate != null) result.calibrate = calibrate; + if (pitch != null) result.pitch = pitch; + if (roll != null) result.roll = roll; + if (version != null) result.version = version; + return result; + } + + WristCommand._(); + + factory WristCommand.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory WristCommand.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'WristCommand', + createEmptyInstance: create) + ..aOB(1, _omitFieldNames ? '' : 'stop') + ..aOB(2, _omitFieldNames ? '' : 'calibrate') + ..aOM<$0.MotorCommand>(3, _omitFieldNames ? '' : 'pitch', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(4, _omitFieldNames ? '' : 'roll', + subBuilder: $0.MotorCommand.create) + ..aOM<$1.Version>(5, _omitFieldNames ? '' : 'version', + subBuilder: $1.Version.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + WristCommand clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + WristCommand copyWith(void Function(WristCommand) updates) => + super.copyWith((message) => updates(message as WristCommand)) + as WristCommand; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static WristCommand create() => WristCommand._(); + @$core.override + WristCommand createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static WristCommand getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static WristCommand? _defaultInstance; + + /// General commands for wrist + @$pb.TagNumber(1) + $core.bool get stop => $_getBF(0); + @$pb.TagNumber(1) + set stop($core.bool value) => $_setBool(0, value); + @$pb.TagNumber(1) + $core.bool hasStop() => $_has(0); + @$pb.TagNumber(1) + void clearStop() => $_clearField(1); + + @$pb.TagNumber(2) + $core.bool get calibrate => $_getBF(1); + @$pb.TagNumber(2) + set calibrate($core.bool value) => $_setBool(1, value); + @$pb.TagNumber(2) + $core.bool hasCalibrate() => $_has(1); + @$pb.TagNumber(2) + void clearCalibrate() => $_clearField(2); + + /// Virtual joints (preferred): command the coupled wrist DOFs. + /// Firmware may execute one axis at a time for mechanical safety. + @$pb.TagNumber(3) + $0.MotorCommand get pitch => $_getN(2); + @$pb.TagNumber(3) + set pitch($0.MotorCommand value) => $_setField(3, value); + @$pb.TagNumber(3) + $core.bool hasPitch() => $_has(2); + @$pb.TagNumber(3) + void clearPitch() => $_clearField(3); + @$pb.TagNumber(3) + $0.MotorCommand ensurePitch() => $_ensure(2); + + @$pb.TagNumber(4) + $0.MotorCommand get roll => $_getN(3); + @$pb.TagNumber(4) + set roll($0.MotorCommand value) => $_setField(4, value); + @$pb.TagNumber(4) + $core.bool hasRoll() => $_has(3); + @$pb.TagNumber(4) + void clearRoll() => $_clearField(4); + @$pb.TagNumber(4) + $0.MotorCommand ensureRoll() => $_ensure(3); + + @$pb.TagNumber(5) + $1.Version get version => $_getN(4); + @$pb.TagNumber(5) + set version($1.Version value) => $_setField(5, value); + @$pb.TagNumber(5) + $core.bool hasVersion() => $_has(4); + @$pb.TagNumber(5) + void clearVersion() => $_clearField(5); + @$pb.TagNumber(5) + $1.Version ensureVersion() => $_ensure(4); } class ArmCommand extends $pb.GeneratedMessage { factory ArmCommand({ $core.bool? stop, $core.bool? calibrate, - $1.MotorCommand? swivel, - $1.MotorCommand? shoulder, - $1.MotorCommand? elbow, - $1.MotorCommand? gripperLift, + $0.MotorCommand? swivel, + $0.MotorCommand? shoulder, + $0.MotorCommand? elbow, + $0.MotorCommand? gripperLift, $core.double? ikX, $core.double? ikY, $core.double? ikZ, $core.bool? jab, - $2.Version? version, + $1.Version? version, $3.BoolState? startUss, - $1.MotorCommand? lift, - $1.MotorCommand? rotate, - $1.MotorCommand? pinch, + $0.MotorCommand? lift, + $0.MotorCommand? rotate, + $0.MotorCommand? pinch, $core.bool? open, $core.bool? close, $core.bool? spin, $core.int? servoAngle, $3.BoolState? laserState, - $1.MotorCommand? roll, + $0.MotorCommand? roll, + WristCommand? wrist, + $3.BoolState? usingIk, + $core.double? ikPitch, + $core.double? ikYaw, + $2.Pose3d? pose, }) { final result = create(); if (stop != null) result.stop = stop; @@ -478,6 +792,11 @@ class ArmCommand extends $pb.GeneratedMessage { if (servoAngle != null) result.servoAngle = servoAngle; if (laserState != null) result.laserState = laserState; if (roll != null) result.roll = roll; + if (wrist != null) result.wrist = wrist; + if (usingIk != null) result.usingIk = usingIk; + if (ikPitch != null) result.ikPitch = ikPitch; + if (ikYaw != null) result.ikYaw = ikYaw; + if (pose != null) result.pose = pose; return result; } @@ -495,36 +814,44 @@ class ArmCommand extends $pb.GeneratedMessage { createEmptyInstance: create) ..aOB(1, _omitFieldNames ? '' : 'stop') ..aOB(2, _omitFieldNames ? '' : 'calibrate') - ..aOM<$1.MotorCommand>(3, _omitFieldNames ? '' : 'swivel', - subBuilder: $1.MotorCommand.create) - ..aOM<$1.MotorCommand>(4, _omitFieldNames ? '' : 'shoulder', - subBuilder: $1.MotorCommand.create) - ..aOM<$1.MotorCommand>(5, _omitFieldNames ? '' : 'elbow', - subBuilder: $1.MotorCommand.create) - ..aOM<$1.MotorCommand>(6, _omitFieldNames ? '' : 'gripperLift', - subBuilder: $1.MotorCommand.create) + ..aOM<$0.MotorCommand>(3, _omitFieldNames ? '' : 'swivel', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(4, _omitFieldNames ? '' : 'shoulder', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(5, _omitFieldNames ? '' : 'elbow', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(6, _omitFieldNames ? '' : 'gripperLift', + subBuilder: $0.MotorCommand.create) ..aD(7, _omitFieldNames ? '' : 'ikX', fieldType: $pb.PbFieldType.OF) ..aD(8, _omitFieldNames ? '' : 'ikY', fieldType: $pb.PbFieldType.OF) ..aD(9, _omitFieldNames ? '' : 'ikZ', fieldType: $pb.PbFieldType.OF) ..aOB(10, _omitFieldNames ? '' : 'jab') - ..aOM<$2.Version>(11, _omitFieldNames ? '' : 'version', - subBuilder: $2.Version.create) + ..aOM<$1.Version>(11, _omitFieldNames ? '' : 'version', + subBuilder: $1.Version.create) ..aE<$3.BoolState>(12, _omitFieldNames ? '' : 'startUss', enumValues: $3.BoolState.values) - ..aOM<$1.MotorCommand>(13, _omitFieldNames ? '' : 'lift', - subBuilder: $1.MotorCommand.create) - ..aOM<$1.MotorCommand>(14, _omitFieldNames ? '' : 'rotate', - subBuilder: $1.MotorCommand.create) - ..aOM<$1.MotorCommand>(15, _omitFieldNames ? '' : 'pinch', - subBuilder: $1.MotorCommand.create) + ..aOM<$0.MotorCommand>(13, _omitFieldNames ? '' : 'lift', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(14, _omitFieldNames ? '' : 'rotate', + subBuilder: $0.MotorCommand.create) + ..aOM<$0.MotorCommand>(15, _omitFieldNames ? '' : 'pinch', + subBuilder: $0.MotorCommand.create) ..aOB(16, _omitFieldNames ? '' : 'open') ..aOB(17, _omitFieldNames ? '' : 'close') ..aOB(18, _omitFieldNames ? '' : 'spin') ..aI(19, _omitFieldNames ? '' : 'servoAngle') ..aE<$3.BoolState>(20, _omitFieldNames ? '' : 'laserState', enumValues: $3.BoolState.values) - ..aOM<$1.MotorCommand>(21, _omitFieldNames ? '' : 'roll', - subBuilder: $1.MotorCommand.create) + ..aOM<$0.MotorCommand>(21, _omitFieldNames ? '' : 'roll', + subBuilder: $0.MotorCommand.create) + ..aOM(22, _omitFieldNames ? '' : 'wrist', + subBuilder: WristCommand.create) + ..aE<$3.BoolState>(23, _omitFieldNames ? '' : 'usingIk', + enumValues: $3.BoolState.values) + ..aD(24, _omitFieldNames ? '' : 'ikPitch', fieldType: $pb.PbFieldType.OF) + ..aD(25, _omitFieldNames ? '' : 'ikYaw', fieldType: $pb.PbFieldType.OF) + ..aOM<$2.Pose3d>(26, _omitFieldNames ? '' : 'pose', + subBuilder: $2.Pose3d.create) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -566,50 +893,48 @@ class ArmCommand extends $pb.GeneratedMessage { /// Move individual motors @$pb.TagNumber(3) - $1.MotorCommand get swivel => $_getN(2); + $0.MotorCommand get swivel => $_getN(2); @$pb.TagNumber(3) - set swivel($1.MotorCommand value) => $_setField(3, value); + set swivel($0.MotorCommand value) => $_setField(3, value); @$pb.TagNumber(3) $core.bool hasSwivel() => $_has(2); @$pb.TagNumber(3) void clearSwivel() => $_clearField(3); @$pb.TagNumber(3) - $1.MotorCommand ensureSwivel() => $_ensure(2); + $0.MotorCommand ensureSwivel() => $_ensure(2); @$pb.TagNumber(4) - $1.MotorCommand get shoulder => $_getN(3); + $0.MotorCommand get shoulder => $_getN(3); @$pb.TagNumber(4) - set shoulder($1.MotorCommand value) => $_setField(4, value); + set shoulder($0.MotorCommand value) => $_setField(4, value); @$pb.TagNumber(4) $core.bool hasShoulder() => $_has(3); @$pb.TagNumber(4) void clearShoulder() => $_clearField(4); @$pb.TagNumber(4) - $1.MotorCommand ensureShoulder() => $_ensure(3); + $0.MotorCommand ensureShoulder() => $_ensure(3); @$pb.TagNumber(5) - $1.MotorCommand get elbow => $_getN(4); + $0.MotorCommand get elbow => $_getN(4); @$pb.TagNumber(5) - set elbow($1.MotorCommand value) => $_setField(5, value); + set elbow($0.MotorCommand value) => $_setField(5, value); @$pb.TagNumber(5) $core.bool hasElbow() => $_has(4); @$pb.TagNumber(5) void clearElbow() => $_clearField(5); @$pb.TagNumber(5) - $1.MotorCommand ensureElbow() => $_ensure(4); + $0.MotorCommand ensureElbow() => $_ensure(4); - /// Needed for IK: If the wrist-lift moves, we need to re-calculate IK to keep the end-effector - /// stationary. See /Arm/src/ik/README.md in the Arm-Firmware repository. @$pb.TagNumber(6) - $1.MotorCommand get gripperLift => $_getN(5); + $0.MotorCommand get gripperLift => $_getN(5); @$pb.TagNumber(6) - set gripperLift($1.MotorCommand value) => $_setField(6, value); + set gripperLift($0.MotorCommand value) => $_setField(6, value); @$pb.TagNumber(6) $core.bool hasGripperLift() => $_has(5); @$pb.TagNumber(6) void clearGripperLift() => $_clearField(6); @$pb.TagNumber(6) - $1.MotorCommand ensureGripperLift() => $_ensure(5); + $0.MotorCommand ensureGripperLift() => $_ensure(5); /// Can be removed in future versions @$pb.TagNumber(7) @@ -650,15 +975,15 @@ class ArmCommand extends $pb.GeneratedMessage { void clearJab() => $_clearField(10); @$pb.TagNumber(11) - $2.Version get version => $_getN(10); + $1.Version get version => $_getN(10); @$pb.TagNumber(11) - set version($2.Version value) => $_setField(11, value); + set version($1.Version value) => $_setField(11, value); @$pb.TagNumber(11) $core.bool hasVersion() => $_has(10); @$pb.TagNumber(11) void clearVersion() => $_clearField(11); @$pb.TagNumber(11) - $2.Version ensureVersion() => $_ensure(10); + $1.Version ensureVersion() => $_ensure(10); /// USS commands @$pb.TagNumber(12) @@ -672,37 +997,37 @@ class ArmCommand extends $pb.GeneratedMessage { /// Move individual motors @$pb.TagNumber(13) - $1.MotorCommand get lift => $_getN(12); + $0.MotorCommand get lift => $_getN(12); @$pb.TagNumber(13) - set lift($1.MotorCommand value) => $_setField(13, value); + set lift($0.MotorCommand value) => $_setField(13, value); @$pb.TagNumber(13) $core.bool hasLift() => $_has(12); @$pb.TagNumber(13) void clearLift() => $_clearField(13); @$pb.TagNumber(13) - $1.MotorCommand ensureLift() => $_ensure(12); + $0.MotorCommand ensureLift() => $_ensure(12); @$pb.TagNumber(14) - $1.MotorCommand get rotate => $_getN(13); + $0.MotorCommand get rotate => $_getN(13); @$pb.TagNumber(14) - set rotate($1.MotorCommand value) => $_setField(14, value); + set rotate($0.MotorCommand value) => $_setField(14, value); @$pb.TagNumber(14) $core.bool hasRotate() => $_has(13); @$pb.TagNumber(14) void clearRotate() => $_clearField(14); @$pb.TagNumber(14) - $1.MotorCommand ensureRotate() => $_ensure(13); + $0.MotorCommand ensureRotate() => $_ensure(13); @$pb.TagNumber(15) - $1.MotorCommand get pinch => $_getN(14); + $0.MotorCommand get pinch => $_getN(14); @$pb.TagNumber(15) - set pinch($1.MotorCommand value) => $_setField(15, value); + set pinch($0.MotorCommand value) => $_setField(15, value); @$pb.TagNumber(15) $core.bool hasPinch() => $_has(14); @$pb.TagNumber(15) void clearPinch() => $_clearField(15); @$pb.TagNumber(15) - $1.MotorCommand ensurePinch() => $_ensure(14); + $0.MotorCommand ensurePinch() => $_ensure(14); /// Custom actions @$pb.TagNumber(16) @@ -751,15 +1076,64 @@ class ArmCommand extends $pb.GeneratedMessage { void clearLaserState() => $_clearField(20); @$pb.TagNumber(21) - $1.MotorCommand get roll => $_getN(20); + $0.MotorCommand get roll => $_getN(20); @$pb.TagNumber(21) - set roll($1.MotorCommand value) => $_setField(21, value); + set roll($0.MotorCommand value) => $_setField(21, value); @$pb.TagNumber(21) $core.bool hasRoll() => $_has(20); @$pb.TagNumber(21) void clearRoll() => $_clearField(21); @$pb.TagNumber(21) - $1.MotorCommand ensureRoll() => $_ensure(20); + $0.MotorCommand ensureRoll() => $_ensure(20); + + @$pb.TagNumber(22) + WristCommand get wrist => $_getN(21); + @$pb.TagNumber(22) + set wrist(WristCommand value) => $_setField(22, value); + @$pb.TagNumber(22) + $core.bool hasWrist() => $_has(21); + @$pb.TagNumber(22) + void clearWrist() => $_clearField(22); + @$pb.TagNumber(22) + WristCommand ensureWrist() => $_ensure(21); + + @$pb.TagNumber(23) + $3.BoolState get usingIk => $_getN(22); + @$pb.TagNumber(23) + set usingIk($3.BoolState value) => $_setField(23, value); + @$pb.TagNumber(23) + $core.bool hasUsingIk() => $_has(22); + @$pb.TagNumber(23) + void clearUsingIk() => $_clearField(23); + + @$pb.TagNumber(24) + $core.double get ikPitch => $_getN(23); + @$pb.TagNumber(24) + set ikPitch($core.double value) => $_setFloat(23, value); + @$pb.TagNumber(24) + $core.bool hasIkPitch() => $_has(23); + @$pb.TagNumber(24) + void clearIkPitch() => $_clearField(24); + + @$pb.TagNumber(25) + $core.double get ikYaw => $_getN(24); + @$pb.TagNumber(25) + set ikYaw($core.double value) => $_setFloat(24, value); + @$pb.TagNumber(25) + $core.bool hasIkYaw() => $_has(24); + @$pb.TagNumber(25) + void clearIkYaw() => $_clearField(25); + + @$pb.TagNumber(26) + $2.Pose3d get pose => $_getN(25); + @$pb.TagNumber(26) + set pose($2.Pose3d value) => $_setField(26, value); + @$pb.TagNumber(26) + $core.bool hasPose() => $_has(25); + @$pb.TagNumber(26) + void clearPose() => $_clearField(26); + @$pb.TagNumber(26) + $2.Pose3d ensurePose() => $_ensure(25); } const $core.bool _omitFieldNames = diff --git a/burt_network/lib/src/generated/arm.pbjson.dart b/burt_network/lib/src/generated/arm.pbjson.dart index 8b9cb1fc..8429942f 100644 --- a/burt_network/lib/src/generated/arm.pbjson.dart +++ b/burt_network/lib/src/generated/arm.pbjson.dart @@ -55,6 +55,42 @@ final $typed_data.Uint8List jointAngleDataDescriptor = $convert.base64Decode( 'KAJSCXJvbGxNdWx0aRIqChF3cmlzdF9waXRjaF9tdWx0aRgKIAEoAlIPd3Jpc3RQaXRjaE11bH' 'Rp'); +@$core.Deprecated('Use wristDataDescriptor instead') +const WristData$json = { + '1': 'WristData', + '2': [ + {'1': 'pitch_angle', '3': 1, '4': 1, '5': 2, '10': 'pitchAngle'}, + {'1': 'roll_angle', '3': 2, '4': 1, '5': 2, '10': 'rollAngle'}, + {'1': 'motorA', '3': 3, '4': 1, '5': 11, '6': '.MotorData', '10': 'motorA'}, + {'1': 'motorB', '3': 4, '4': 1, '5': 11, '6': '.MotorData', '10': 'motorB'}, + { + '1': 'is_moving', + '3': 5, + '4': 1, + '5': 14, + '6': '.BoolState', + '10': 'isMoving' + }, + { + '1': 'is_calibrated', + '3': 6, + '4': 1, + '5': 14, + '6': '.BoolState', + '10': 'isCalibrated' + }, + {'1': 'version', '3': 7, '4': 1, '5': 11, '6': '.Version', '10': 'version'}, + ], +}; + +/// Descriptor for `WristData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List wristDataDescriptor = $convert.base64Decode( + 'CglXcmlzdERhdGESHwoLcGl0Y2hfYW5nbGUYASABKAJSCnBpdGNoQW5nbGUSHQoKcm9sbF9hbm' + 'dsZRgCIAEoAlIJcm9sbEFuZ2xlEiIKBm1vdG9yQRgDIAEoCzIKLk1vdG9yRGF0YVIGbW90b3JB' + 'EiIKBm1vdG9yQhgEIAEoCzIKLk1vdG9yRGF0YVIGbW90b3JCEicKCWlzX21vdmluZxgFIAEoDj' + 'IKLkJvb2xTdGF0ZVIIaXNNb3ZpbmcSLwoNaXNfY2FsaWJyYXRlZBgGIAEoDjIKLkJvb2xTdGF0' + 'ZVIMaXNDYWxpYnJhdGVkEiIKB3ZlcnNpb24YByABKAsyCC5WZXJzaW9uUgd2ZXJzaW9u'); + @$core.Deprecated('Use armDataDescriptor instead') const ArmData$json = { '1': 'ArmData', @@ -67,6 +103,14 @@ const ArmData$json = { '6': '.Coordinates', '10': 'currentPosition' }, + { + '1': 'current_orientation', + '3': 17, + '4': 1, + '5': 11, + '6': '.Orientation', + '10': 'currentOrientation' + }, { '1': 'target_position', '3': 2, @@ -75,6 +119,14 @@ const ArmData$json = { '6': '.Coordinates', '10': 'targetPosition' }, + { + '1': 'target_orientation', + '3': 18, + '4': 1, + '5': 11, + '6': '.Orientation', + '10': 'targetOrientation' + }, {'1': 'base', '3': 3, '4': 1, '5': 11, '6': '.MotorData', '10': 'base'}, { '1': 'shoulder', @@ -90,6 +142,7 @@ const ArmData$json = { {'1': 'uss_distance', '3': 7, '4': 1, '5': 2, '10': 'ussDistance'}, {'1': 'lift', '3': 8, '4': 1, '5': 11, '6': '.MotorData', '10': 'lift'}, {'1': 'rotate', '3': 9, '4': 1, '5': 11, '6': '.MotorData', '10': 'rotate'}, + {'1': 'wrist', '3': 15, '4': 1, '5': 11, '6': '.WristData', '10': 'wrist'}, {'1': 'pinch', '3': 10, '4': 1, '5': 11, '6': '.MotorData', '10': 'pinch'}, {'1': 'servo_angle', '3': 11, '4': 1, '5': 5, '10': 'servoAngle'}, { @@ -108,22 +161,59 @@ const ArmData$json = { '6': '.JointAngleData', '10': 'jointAngles' }, + { + '1': 'using_ik', + '3': 16, + '4': 1, + '5': 14, + '6': '.BoolState', + '10': 'usingIk' + }, ], }; /// Descriptor for `ArmData`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List armDataDescriptor = $convert.base64Decode( 'CgdBcm1EYXRhEjcKEGN1cnJlbnRfcG9zaXRpb24YASABKAsyDC5Db29yZGluYXRlc1IPY3Vycm' - 'VudFBvc2l0aW9uEjUKD3RhcmdldF9wb3NpdGlvbhgCIAEoCzIMLkNvb3JkaW5hdGVzUg50YXJn' - 'ZXRQb3NpdGlvbhIeCgRiYXNlGAMgASgLMgouTW90b3JEYXRhUgRiYXNlEiYKCHNob3VsZGVyGA' - 'QgASgLMgouTW90b3JEYXRhUghzaG91bGRlchIgCgVlbGJvdxgFIAEoCzIKLk1vdG9yRGF0YVIF' - 'ZWxib3cSHgoEcm9sbBgNIAEoCzIKLk1vdG9yRGF0YVIEcm9sbBIiCgd2ZXJzaW9uGAYgASgLMg' - 'guVmVyc2lvblIHdmVyc2lvbhIhCgx1c3NfZGlzdGFuY2UYByABKAJSC3Vzc0Rpc3RhbmNlEh4K' - 'BGxpZnQYCCABKAsyCi5Nb3RvckRhdGFSBGxpZnQSIgoGcm90YXRlGAkgASgLMgouTW90b3JEYX' - 'RhUgZyb3RhdGUSIAoFcGluY2gYCiABKAsyCi5Nb3RvckRhdGFSBXBpbmNoEh8KC3NlcnZvX2Fu' - 'Z2xlGAsgASgFUgpzZXJ2b0FuZ2xlEisKC2xhc2VyX3N0YXRlGAwgASgOMgouQm9vbFN0YXRlUg' - 'psYXNlclN0YXRlEjIKDGpvaW50X2FuZ2xlcxgOIAEoCzIPLkpvaW50QW5nbGVEYXRhUgtqb2lu' - 'dEFuZ2xlcw=='); + 'VudFBvc2l0aW9uEj0KE2N1cnJlbnRfb3JpZW50YXRpb24YESABKAsyDC5PcmllbnRhdGlvblIS' + 'Y3VycmVudE9yaWVudGF0aW9uEjUKD3RhcmdldF9wb3NpdGlvbhgCIAEoCzIMLkNvb3JkaW5hdG' + 'VzUg50YXJnZXRQb3NpdGlvbhI7ChJ0YXJnZXRfb3JpZW50YXRpb24YEiABKAsyDC5PcmllbnRh' + 'dGlvblIRdGFyZ2V0T3JpZW50YXRpb24SHgoEYmFzZRgDIAEoCzIKLk1vdG9yRGF0YVIEYmFzZR' + 'ImCghzaG91bGRlchgEIAEoCzIKLk1vdG9yRGF0YVIIc2hvdWxkZXISIAoFZWxib3cYBSABKAsy' + 'Ci5Nb3RvckRhdGFSBWVsYm93Eh4KBHJvbGwYDSABKAsyCi5Nb3RvckRhdGFSBHJvbGwSIgoHdm' + 'Vyc2lvbhgGIAEoCzIILlZlcnNpb25SB3ZlcnNpb24SIQoMdXNzX2Rpc3RhbmNlGAcgASgCUgt1' + 'c3NEaXN0YW5jZRIeCgRsaWZ0GAggASgLMgouTW90b3JEYXRhUgRsaWZ0EiIKBnJvdGF0ZRgJIA' + 'EoCzIKLk1vdG9yRGF0YVIGcm90YXRlEiAKBXdyaXN0GA8gASgLMgouV3Jpc3REYXRhUgV3cmlz' + 'dBIgCgVwaW5jaBgKIAEoCzIKLk1vdG9yRGF0YVIFcGluY2gSHwoLc2Vydm9fYW5nbGUYCyABKA' + 'VSCnNlcnZvQW5nbGUSKwoLbGFzZXJfc3RhdGUYDCABKA4yCi5Cb29sU3RhdGVSCmxhc2VyU3Rh' + 'dGUSMgoMam9pbnRfYW5nbGVzGA4gASgLMg8uSm9pbnRBbmdsZURhdGFSC2pvaW50QW5nbGVzEi' + 'UKCHVzaW5nX2lrGBAgASgOMgouQm9vbFN0YXRlUgd1c2luZ0lr'); + +@$core.Deprecated('Use wristCommandDescriptor instead') +const WristCommand$json = { + '1': 'WristCommand', + '2': [ + {'1': 'stop', '3': 1, '4': 1, '5': 8, '10': 'stop'}, + {'1': 'calibrate', '3': 2, '4': 1, '5': 8, '10': 'calibrate'}, + { + '1': 'pitch', + '3': 3, + '4': 1, + '5': 11, + '6': '.MotorCommand', + '10': 'pitch' + }, + {'1': 'roll', '3': 4, '4': 1, '5': 11, '6': '.MotorCommand', '10': 'roll'}, + {'1': 'version', '3': 5, '4': 1, '5': 11, '6': '.Version', '10': 'version'}, + ], +}; + +/// Descriptor for `WristCommand`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List wristCommandDescriptor = $convert.base64Decode( + 'CgxXcmlzdENvbW1hbmQSEgoEc3RvcBgBIAEoCFIEc3RvcBIcCgljYWxpYnJhdGUYAiABKAhSCW' + 'NhbGlicmF0ZRIjCgVwaXRjaBgDIAEoCzINLk1vdG9yQ29tbWFuZFIFcGl0Y2gSIQoEcm9sbBgE' + 'IAEoCzINLk1vdG9yQ29tbWFuZFIEcm9sbBIiCgd2ZXJzaW9uGAUgASgLMgguVmVyc2lvblIHdm' + 'Vyc2lvbg=='); @$core.Deprecated('Use armCommandDescriptor instead') const ArmCommand$json = { @@ -167,6 +257,9 @@ const ArmCommand$json = { {'1': 'ik_x', '3': 7, '4': 1, '5': 2, '10': 'ikX'}, {'1': 'ik_y', '3': 8, '4': 1, '5': 2, '10': 'ikY'}, {'1': 'ik_z', '3': 9, '4': 1, '5': 2, '10': 'ikZ'}, + {'1': 'ik_pitch', '3': 24, '4': 1, '5': 2, '10': 'ikPitch'}, + {'1': 'ik_yaw', '3': 25, '4': 1, '5': 2, '10': 'ikYaw'}, + {'1': 'pose', '3': 26, '4': 1, '5': 11, '6': '.Pose3d', '10': 'pose'}, {'1': 'jab', '3': 10, '4': 1, '5': 8, '10': 'jab'}, { '1': 'version', @@ -193,6 +286,14 @@ const ArmCommand$json = { '6': '.MotorCommand', '10': 'rotate' }, + { + '1': 'wrist', + '3': 22, + '4': 1, + '5': 11, + '6': '.WristCommand', + '10': 'wrist' + }, { '1': 'pinch', '3': 15, @@ -213,6 +314,14 @@ const ArmCommand$json = { '6': '.BoolState', '10': 'laserState' }, + { + '1': 'using_ik', + '3': 23, + '4': 1, + '5': 14, + '6': '.BoolState', + '10': 'usingIk' + }, ], }; @@ -223,11 +332,13 @@ final $typed_data.Uint8List armCommandDescriptor = $convert.base64Decode( 'ZXIYBCABKAsyDS5Nb3RvckNvbW1hbmRSCHNob3VsZGVyEiMKBWVsYm93GAUgASgLMg0uTW90b3' 'JDb21tYW5kUgVlbGJvdxIhCgRyb2xsGBUgASgLMg0uTW90b3JDb21tYW5kUgRyb2xsEjAKDGdy' 'aXBwZXJfbGlmdBgGIAEoCzINLk1vdG9yQ29tbWFuZFILZ3JpcHBlckxpZnQSEQoEaWtfeBgHIA' - 'EoAlIDaWtYEhEKBGlrX3kYCCABKAJSA2lrWRIRCgRpa196GAkgASgCUgNpa1oSEAoDamFiGAog' - 'ASgIUgNqYWISIgoHdmVyc2lvbhgLIAEoCzIILlZlcnNpb25SB3ZlcnNpb24SJwoJc3RhcnRfdX' - 'NzGAwgASgOMgouQm9vbFN0YXRlUghzdGFydFVzcxIhCgRsaWZ0GA0gASgLMg0uTW90b3JDb21t' - 'YW5kUgRsaWZ0EiUKBnJvdGF0ZRgOIAEoCzINLk1vdG9yQ29tbWFuZFIGcm90YXRlEiMKBXBpbm' - 'NoGA8gASgLMg0uTW90b3JDb21tYW5kUgVwaW5jaBISCgRvcGVuGBAgASgIUgRvcGVuEhQKBWNs' - 'b3NlGBEgASgIUgVjbG9zZRISCgRzcGluGBIgASgIUgRzcGluEh8KC3NlcnZvX2FuZ2xlGBMgAS' - 'gFUgpzZXJ2b0FuZ2xlEisKC2xhc2VyX3N0YXRlGBQgASgOMgouQm9vbFN0YXRlUgpsYXNlclN0' - 'YXRl'); + 'EoAlIDaWtYEhEKBGlrX3kYCCABKAJSA2lrWRIRCgRpa196GAkgASgCUgNpa1oSGQoIaWtfcGl0' + 'Y2gYGCABKAJSB2lrUGl0Y2gSFQoGaWtfeWF3GBkgASgCUgVpa1lhdxIbCgRwb3NlGBogASgLMg' + 'cuUG9zZTNkUgRwb3NlEhAKA2phYhgKIAEoCFIDamFiEiIKB3ZlcnNpb24YCyABKAsyCC5WZXJz' + 'aW9uUgd2ZXJzaW9uEicKCXN0YXJ0X3VzcxgMIAEoDjIKLkJvb2xTdGF0ZVIIc3RhcnRVc3MSIQ' + 'oEbGlmdBgNIAEoCzINLk1vdG9yQ29tbWFuZFIEbGlmdBIlCgZyb3RhdGUYDiABKAsyDS5Nb3Rv' + 'ckNvbW1hbmRSBnJvdGF0ZRIjCgV3cmlzdBgWIAEoCzINLldyaXN0Q29tbWFuZFIFd3Jpc3QSIw' + 'oFcGluY2gYDyABKAsyDS5Nb3RvckNvbW1hbmRSBXBpbmNoEhIKBG9wZW4YECABKAhSBG9wZW4S' + 'FAoFY2xvc2UYESABKAhSBWNsb3NlEhIKBHNwaW4YEiABKAhSBHNwaW4SHwoLc2Vydm9fYW5nbG' + 'UYEyABKAVSCnNlcnZvQW5nbGUSKwoLbGFzZXJfc3RhdGUYFCABKA4yCi5Cb29sU3RhdGVSCmxh' + 'c2VyU3RhdGUSJQoIdXNpbmdfaWsYFyABKA4yCi5Cb29sU3RhdGVSB3VzaW5nSWs='); diff --git a/burt_network/lib/src/generated/google/protobuf/timestamp.pb.dart b/burt_network/lib/src/generated/google/protobuf/timestamp.pb.dart new file mode 100644 index 00000000..4f92e8ac --- /dev/null +++ b/burt_network/lib/src/generated/google/protobuf/timestamp.pb.dart @@ -0,0 +1,198 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/timestamp.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a [24-hour linear +/// smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from [RFC +/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(time(NULL)); +/// timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; +/// gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(tv.tv_sec); +/// timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; +/// GetSystemTimeAsFileTime(&ft); +/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +/// Timestamp timestamp; +/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +/// .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// Example 5: Compute Timestamp from Java `Instant.now()`. +/// +/// Instant now = Instant.now(); +/// +/// Timestamp timestamp = +/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +/// .setNanos(now.getNano()).build(); +/// +/// Example 6: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() +/// timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +/// where {year} is always expressed using four digits while {month}, {day}, +/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +/// is required. A proto3 JSON serializer should always use UTC (as indicated by +/// "Z") when printing the Timestamp type and a proto3 JSON parser should be +/// able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +/// 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the +/// standard +/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +/// method. In Python, a standard `datetime.datetime` object can be converted +/// to this format using +/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +/// ) to obtain a formatter capable of generating timestamps in this format. +class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { + factory Timestamp({ + $fixnum.Int64? seconds, + $core.int? nanos, + }) { + final result = create(); + if (seconds != null) result.seconds = seconds; + if (nanos != null) result.nanos = nanos; + return result; + } + + Timestamp._(); + + factory Timestamp.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Timestamp.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Timestamp', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.timestamp) + ..aInt64(1, _omitFieldNames ? '' : 'seconds') + ..aI(2, _omitFieldNames ? '' : 'nanos') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Timestamp clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Timestamp copyWith(void Function(Timestamp) updates) => + super.copyWith((message) => updates(message as Timestamp)) as Timestamp; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Timestamp create() => Timestamp._(); + @$core.override + Timestamp createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Timestamp getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Timestamp? _defaultInstance; + + /// Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + /// be between -315576000000 and 315576000000 inclusive (which corresponds to + /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). + @$pb.TagNumber(1) + $fixnum.Int64 get seconds => $_getI64(0); + @$pb.TagNumber(1) + set seconds($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasSeconds() => $_has(0); + @$pb.TagNumber(1) + void clearSeconds() => $_clearField(1); + + /// Non-negative fractions of a second at nanosecond resolution. This field is + /// the nanosecond portion of the duration, not an alternative to seconds. + /// Negative second values with fractions must still have non-negative nanos + /// values that count forward in time. Must be between 0 and 999,999,999 + /// inclusive. + @$pb.TagNumber(2) + $core.int get nanos => $_getIZ(1); + @$pb.TagNumber(2) + set nanos($core.int value) => $_setSignedInt32(1, value); + @$pb.TagNumber(2) + $core.bool hasNanos() => $_has(1); + @$pb.TagNumber(2) + void clearNanos() => $_clearField(2); + + /// Creates a new instance from [dateTime]. + /// + /// Time zone information will not be preserved. + static Timestamp fromDateTime($core.DateTime dateTime) { + final result = create(); + $mixin.TimestampMixin.setFromDateTime(result, dateTime); + return result; + } +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/burt_network/lib/src/generated/google/protobuf/timestamp.pbenum.dart b/burt_network/lib/src/generated/google/protobuf/timestamp.pbenum.dart new file mode 100644 index 00000000..cdbd00bc --- /dev/null +++ b/burt_network/lib/src/generated/google/protobuf/timestamp.pbenum.dart @@ -0,0 +1,11 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/timestamp.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports diff --git a/burt_network/lib/src/generated/google/protobuf/timestamp.pbjson.dart b/burt_network/lib/src/generated/google/protobuf/timestamp.pbjson.dart new file mode 100644 index 00000000..739dd55a --- /dev/null +++ b/burt_network/lib/src/generated/google/protobuf/timestamp.pbjson.dart @@ -0,0 +1,30 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/timestamp.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use timestampDescriptor instead') +const Timestamp$json = { + '1': 'Timestamp', + '2': [ + {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, + {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, + ], +}; + +/// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode( + 'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm' + 'Fub3M='); diff --git a/burt_network/lib/src/generated/video.pbenum.dart b/burt_network/lib/src/generated/video.pbenum.dart index a6d716ac..810f2c08 100644 --- a/burt_network/lib/src/generated/video.pbenum.dart +++ b/burt_network/lib/src/generated/video.pbenum.dart @@ -70,6 +70,12 @@ class CameraName extends $pb.ProtobufEnum { CameraName._(7, _omitEnumNames ? '' : 'BOTTOM_LEFT'); static const CameraName BOTTOM_RIGHT = CameraName._(8, _omitEnumNames ? '' : 'BOTTOM_RIGHT'); + static const CameraName ARM_LEFT = + CameraName._(9, _omitEnumNames ? '' : 'ARM_LEFT'); + static const CameraName ARM_RIGHT = + CameraName._(10, _omitEnumNames ? '' : 'ARM_RIGHT'); + static const CameraName GAP_CAM = + CameraName._(11, _omitEnumNames ? '' : 'GAP_CAM'); static const $core.List values = [ CAMERA_NAME_UNDEFINED, @@ -81,10 +87,13 @@ class CameraName extends $pb.ProtobufEnum { SUBSYSTEM3, BOTTOM_LEFT, BOTTOM_RIGHT, + ARM_LEFT, + ARM_RIGHT, + GAP_CAM, ]; static final $core.List _byValue = - $pb.ProtobufEnum.$_initByValueList(values, 8); + $pb.ProtobufEnum.$_initByValueList(values, 11); static CameraName? valueOf($core.int value) => value < 0 || value >= _byValue.length ? null : _byValue[value]; diff --git a/burt_network/lib/src/generated/video.pbjson.dart b/burt_network/lib/src/generated/video.pbjson.dart index a32c2b59..a6a1da8f 100644 --- a/burt_network/lib/src/generated/video.pbjson.dart +++ b/burt_network/lib/src/generated/video.pbjson.dart @@ -50,6 +50,9 @@ const CameraName$json = { {'1': 'SUBSYSTEM3', '2': 6}, {'1': 'BOTTOM_LEFT', '2': 7}, {'1': 'BOTTOM_RIGHT', '2': 8}, + {'1': 'ARM_LEFT', '2': 9}, + {'1': 'ARM_RIGHT', '2': 10}, + {'1': 'GAP_CAM', '2': 11}, ], }; @@ -58,7 +61,7 @@ final $typed_data.Uint8List cameraNameDescriptor = $convert.base64Decode( 'CgpDYW1lcmFOYW1lEhkKFUNBTUVSQV9OQU1FX1VOREVGSU5FRBAAEg8KC1JPVkVSX0ZST05UEA' 'ESDgoKUk9WRVJfUkVBUhACEhIKDkFVVE9OT01ZX0RFUFRIEAMSDgoKU1VCU1lTVEVNMRAEEg4K' 'ClNVQlNZU1RFTTIQBRIOCgpTVUJTWVNURU0zEAYSDwoLQk9UVE9NX0xFRlQQBxIQCgxCT1RUT0' - '1fUklHSFQQCA=='); + '1fUklHSFQQCBIMCghBUk1fTEVGVBAJEg0KCUFSTV9SSUdIVBAKEgsKB0dBUF9DQU0QCw=='); @$core.Deprecated('Use cameraDetailsDescriptor instead') const CameraDetails$json = { diff --git a/pubspec.yaml b/pubspec.yaml index f58ebf22..eba815eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,6 +4,7 @@ environment: sdk: ^3.9.0 workspace: + - arm_auxillary - autonomy - burt_network - subsystems diff --git a/subsystems/lib/src/devices/firmware.dart b/subsystems/lib/src/devices/firmware.dart index 599f4bc0..de543eac 100644 --- a/subsystems/lib/src/devices/firmware.dart +++ b/subsystems/lib/src/devices/firmware.dart @@ -5,8 +5,6 @@ import "package:collection/collection.dart"; import "package:subsystems/subsystems.dart"; import "package:burt_network/burt_network.dart"; -import "serial_utils.dart"; - /// Maps command names to [Device]s. final nameToDevice = { ArmCommand().messageName: Device.ARM, diff --git a/subsystems/lib/subsystems.dart b/subsystems/lib/subsystems.dart index ce023b35..1729d498 100644 --- a/subsystems/lib/subsystems.dart +++ b/subsystems/lib/subsystems.dart @@ -9,6 +9,7 @@ import "src/devices/firmware.dart"; export "src/devices/firmware.dart"; export "src/devices/imu.dart"; export "src/devices/gps.dart"; +export "src/devices/serial_utils.dart"; export "src/can/ffi.dart"; export "src/can/message.dart";