@blueyerobotics/protocol-definitions 3.4.0-sonar3d-slam.4e329580 → 3.4.0-sonar3d-slam.ba63462d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3445,6 +3445,25 @@ export interface SlamSubmapPoints {
3445
3445
  /** Sensor the points come from (SlamSensor.id). */
3446
3446
  sensorId: string;
3447
3447
  }
3448
+ /**
3449
+ * A loop closure: a keyframe's scan matched to the map where the trajectory had
3450
+ * been before, which corrected the trajectory. The keyframes the correction moved
3451
+ * come in the same update, so a client that held the map before has the
3452
+ * trajectory as it was.
3453
+ */
3454
+ export interface SlamLoopClosure {
3455
+ /** Keyframe whose scan closed the loop. */
3456
+ keyframeId: number;
3457
+ /** Earlier keyframe it was matched near. */
3458
+ matchedKeyframeId: number;
3459
+ /** How far the correction moved the keyframe that closed the loop (m). */
3460
+ positionCorrection: number;
3461
+ /**
3462
+ * How far it turned that keyframe about the map's z axis (°, positive clockwise seen from
3463
+ * above in a gravity-aligned map).
3464
+ */
3465
+ headingCorrection: number;
3466
+ }
3448
3467
  /**
3449
3468
  * A change to the SLAM map.
3450
3469
  *
@@ -3466,6 +3485,8 @@ export interface SlamMapUpdate {
3466
3485
  * learns more of it: a recording cut short has it without its last SlamMapTel.
3467
3486
  */
3468
3487
  frame: SlamMapFrame | undefined;
3488
+ /** Loop closures whose correction moved the keyframes. */
3489
+ loopClosures: SlamLoopClosure[];
3469
3490
  }
3470
3491
  /**
3471
3492
  * How a SLAM map's frame lies in the world, for placing the map on a chart.
@@ -3511,6 +3532,8 @@ export interface SlamMap {
3511
3532
  submaps: SlamSubmapPoints[];
3512
3533
  /** How the map's frame lies in the world (unset before the first scan). */
3513
3534
  frame: SlamMapFrame | undefined;
3535
+ /** Every loop closure, in the order they were made. */
3536
+ loopClosures: SlamLoopClosure[];
3514
3537
  }
3515
3538
  /** The latest scan of a sensor, as the SLAM placed it. */
3516
3539
  export interface SlamScan {
@@ -3666,6 +3689,7 @@ export declare const SlamPose: MessageFns<SlamPose>;
3666
3689
  export declare const SlamPoseEstimate: MessageFns<SlamPoseEstimate>;
3667
3690
  export declare const SlamKeyframe: MessageFns<SlamKeyframe>;
3668
3691
  export declare const SlamSubmapPoints: MessageFns<SlamSubmapPoints>;
3692
+ export declare const SlamLoopClosure: MessageFns<SlamLoopClosure>;
3669
3693
  export declare const SlamMapUpdate: MessageFns<SlamMapUpdate>;
3670
3694
  export declare const SlamMapFrame: MessageFns<SlamMapFrame>;
3671
3695
  export declare const SlamMap: MessageFns<SlamMap>;
@@ -22238,8 +22238,106 @@ export const SlamSubmapPoints = {
22238
22238
  return message;
22239
22239
  },
22240
22240
  };
22241
+ function createBaseSlamLoopClosure() {
22242
+ return { keyframeId: 0, matchedKeyframeId: 0, positionCorrection: 0, headingCorrection: 0 };
22243
+ }
22244
+ export const SlamLoopClosure = {
22245
+ encode(message, writer = new BinaryWriter()) {
22246
+ if (message.keyframeId !== 0) {
22247
+ writer.uint32(8).uint32(message.keyframeId);
22248
+ }
22249
+ if (message.matchedKeyframeId !== 0) {
22250
+ writer.uint32(16).uint32(message.matchedKeyframeId);
22251
+ }
22252
+ if (message.positionCorrection !== 0) {
22253
+ writer.uint32(29).float(message.positionCorrection);
22254
+ }
22255
+ if (message.headingCorrection !== 0) {
22256
+ writer.uint32(37).float(message.headingCorrection);
22257
+ }
22258
+ return writer;
22259
+ },
22260
+ decode(input, length) {
22261
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
22262
+ const end = length === undefined ? reader.len : reader.pos + length;
22263
+ const message = createBaseSlamLoopClosure();
22264
+ while (reader.pos < end) {
22265
+ const tag = reader.uint32();
22266
+ switch (tag >>> 3) {
22267
+ case 1: {
22268
+ if (tag !== 8) {
22269
+ break;
22270
+ }
22271
+ message.keyframeId = reader.uint32();
22272
+ continue;
22273
+ }
22274
+ case 2: {
22275
+ if (tag !== 16) {
22276
+ break;
22277
+ }
22278
+ message.matchedKeyframeId = reader.uint32();
22279
+ continue;
22280
+ }
22281
+ case 3: {
22282
+ if (tag !== 29) {
22283
+ break;
22284
+ }
22285
+ message.positionCorrection = reader.float();
22286
+ continue;
22287
+ }
22288
+ case 4: {
22289
+ if (tag !== 37) {
22290
+ break;
22291
+ }
22292
+ message.headingCorrection = reader.float();
22293
+ continue;
22294
+ }
22295
+ }
22296
+ if ((tag & 7) === 4 || tag === 0) {
22297
+ break;
22298
+ }
22299
+ reader.skip(tag & 7);
22300
+ }
22301
+ return message;
22302
+ },
22303
+ fromJSON(object) {
22304
+ return {
22305
+ keyframeId: isSet(object.keyframeId) ? gt.Number(object.keyframeId) : 0,
22306
+ matchedKeyframeId: isSet(object.matchedKeyframeId) ? gt.Number(object.matchedKeyframeId) : 0,
22307
+ positionCorrection: isSet(object.positionCorrection) ? gt.Number(object.positionCorrection) : 0,
22308
+ headingCorrection: isSet(object.headingCorrection) ? gt.Number(object.headingCorrection) : 0,
22309
+ };
22310
+ },
22311
+ toJSON(message) {
22312
+ const obj = {};
22313
+ if (message.keyframeId !== 0) {
22314
+ obj.keyframeId = Math.round(message.keyframeId);
22315
+ }
22316
+ if (message.matchedKeyframeId !== 0) {
22317
+ obj.matchedKeyframeId = Math.round(message.matchedKeyframeId);
22318
+ }
22319
+ if (message.positionCorrection !== 0) {
22320
+ obj.positionCorrection = message.positionCorrection;
22321
+ }
22322
+ if (message.headingCorrection !== 0) {
22323
+ obj.headingCorrection = message.headingCorrection;
22324
+ }
22325
+ return obj;
22326
+ },
22327
+ create(base) {
22328
+ return SlamLoopClosure.fromPartial(base ?? {});
22329
+ },
22330
+ fromPartial(object) {
22331
+ const message = createBaseSlamLoopClosure();
22332
+ message.keyframeId = object.keyframeId ?? 0;
22333
+ message.matchedKeyframeId = object.matchedKeyframeId ?? 0;
22334
+ message.positionCorrection = object.positionCorrection ?? 0;
22335
+ message.headingCorrection = object.headingCorrection ?? 0;
22336
+ return message;
22337
+ },
22338
+ };
22241
22339
  function createBaseSlamMapUpdate() {
22242
- return { mapId: 0, sequence: 0, keyframes: [], points: [], frame: undefined };
22340
+ return { mapId: 0, sequence: 0, keyframes: [], points: [], frame: undefined, loopClosures: [] };
22243
22341
  }
22244
22342
  export const SlamMapUpdate = {
22245
22343
  encode(message, writer = new BinaryWriter()) {
@@ -22258,6 +22356,9 @@ export const SlamMapUpdate = {
22258
22356
  if (message.frame !== undefined) {
22259
22357
  SlamMapFrame.encode(message.frame, writer.uint32(42).fork()).join();
22260
22358
  }
22359
+ for (const v of message.loopClosures) {
22360
+ SlamLoopClosure.encode(v, writer.uint32(50).fork()).join();
22361
+ }
22261
22362
  return writer;
22262
22363
  },
22263
22364
  decode(input, length) {
@@ -22302,6 +22403,13 @@ export const SlamMapUpdate = {
22302
22403
  message.frame = SlamMapFrame.decode(reader, reader.uint32());
22303
22404
  continue;
22304
22405
  }
22406
+ case 6: {
22407
+ if (tag !== 50) {
22408
+ break;
22409
+ }
22410
+ message.loopClosures.push(SlamLoopClosure.decode(reader, reader.uint32()));
22411
+ continue;
22412
+ }
22305
22413
  }
22306
22414
  if ((tag & 7) === 4 || tag === 0) {
22307
22415
  break;
@@ -22317,6 +22425,9 @@ export const SlamMapUpdate = {
22317
22425
  keyframes: gt.Array.isArray(object?.keyframes) ? object.keyframes.map((e) => SlamKeyframe.fromJSON(e)) : [],
22318
22426
  points: gt.Array.isArray(object?.points) ? object.points.map((e) => SlamSubmapPoints.fromJSON(e)) : [],
22319
22427
  frame: isSet(object.frame) ? SlamMapFrame.fromJSON(object.frame) : undefined,
22428
+ loopClosures: gt.Array.isArray(object?.loopClosures)
22429
+ ? object.loopClosures.map((e) => SlamLoopClosure.fromJSON(e))
22430
+ : [],
22320
22431
  };
22321
22432
  },
22322
22433
  toJSON(message) {
@@ -22336,6 +22447,9 @@ export const SlamMapUpdate = {
22336
22447
  if (message.frame !== undefined) {
22337
22448
  obj.frame = SlamMapFrame.toJSON(message.frame);
22338
22449
  }
22450
+ if (message.loopClosures?.length) {
22451
+ obj.loopClosures = message.loopClosures.map((e) => SlamLoopClosure.toJSON(e));
22452
+ }
22339
22453
  return obj;
22340
22454
  },
22341
22455
  create(base) {
@@ -22350,6 +22464,7 @@ export const SlamMapUpdate = {
22350
22464
  message.frame = (object.frame !== undefined && object.frame !== null)
22351
22465
  ? SlamMapFrame.fromPartial(object.frame)
22352
22466
  : undefined;
22467
+ message.loopClosures = object.loopClosures?.map((e) => SlamLoopClosure.fromPartial(e)) || [];
22353
22468
  return message;
22354
22469
  },
22355
22470
  };
@@ -22489,7 +22604,7 @@ export const SlamMapFrame = {
22489
22604
  },
22490
22605
  };
22491
22606
  function createBaseSlamMap() {
22492
- return { mapId: 0, sequence: 0, keyframes: [], submaps: [], frame: undefined };
22607
+ return { mapId: 0, sequence: 0, keyframes: [], submaps: [], frame: undefined, loopClosures: [] };
22493
22608
  }
22494
22609
  export const SlamMap = {
22495
22610
  encode(message, writer = new BinaryWriter()) {
@@ -22508,6 +22623,9 @@ export const SlamMap = {
22508
22623
  if (message.frame !== undefined) {
22509
22624
  SlamMapFrame.encode(message.frame, writer.uint32(42).fork()).join();
22510
22625
  }
22626
+ for (const v of message.loopClosures) {
22627
+ SlamLoopClosure.encode(v, writer.uint32(50).fork()).join();
22628
+ }
22511
22629
  return writer;
22512
22630
  },
22513
22631
  decode(input, length) {
@@ -22552,6 +22670,13 @@ export const SlamMap = {
22552
22670
  message.frame = SlamMapFrame.decode(reader, reader.uint32());
22553
22671
  continue;
22554
22672
  }
22673
+ case 6: {
22674
+ if (tag !== 50) {
22675
+ break;
22676
+ }
22677
+ message.loopClosures.push(SlamLoopClosure.decode(reader, reader.uint32()));
22678
+ continue;
22679
+ }
22555
22680
  }
22556
22681
  if ((tag & 7) === 4 || tag === 0) {
22557
22682
  break;
@@ -22567,6 +22692,9 @@ export const SlamMap = {
22567
22692
  keyframes: gt.Array.isArray(object?.keyframes) ? object.keyframes.map((e) => SlamKeyframe.fromJSON(e)) : [],
22568
22693
  submaps: gt.Array.isArray(object?.submaps) ? object.submaps.map((e) => SlamSubmapPoints.fromJSON(e)) : [],
22569
22694
  frame: isSet(object.frame) ? SlamMapFrame.fromJSON(object.frame) : undefined,
22695
+ loopClosures: gt.Array.isArray(object?.loopClosures)
22696
+ ? object.loopClosures.map((e) => SlamLoopClosure.fromJSON(e))
22697
+ : [],
22570
22698
  };
22571
22699
  },
22572
22700
  toJSON(message) {
@@ -22586,6 +22714,9 @@ export const SlamMap = {
22586
22714
  if (message.frame !== undefined) {
22587
22715
  obj.frame = SlamMapFrame.toJSON(message.frame);
22588
22716
  }
22717
+ if (message.loopClosures?.length) {
22718
+ obj.loopClosures = message.loopClosures.map((e) => SlamLoopClosure.toJSON(e));
22719
+ }
22589
22720
  return obj;
22590
22721
  },
22591
22722
  create(base) {
@@ -22600,6 +22731,7 @@ export const SlamMap = {
22600
22731
  message.frame = (object.frame !== undefined && object.frame !== null)
22601
22732
  ? SlamMapFrame.fromPartial(object.frame)
22602
22733
  : undefined;
22734
+ message.loopClosures = object.loopClosures?.map((e) => SlamLoopClosure.fromPartial(e)) || [];
22603
22735
  return message;
22604
22736
  },
22605
22737
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueyerobotics/protocol-definitions",
3
- "version": "3.4.0-sonar3d-slam.4e329580",
3
+ "version": "3.4.0-sonar3d-slam.ba63462d",
4
4
  "license": "LGPL-3.0-only",
5
5
  "description": "TypeScript definitions for Blueye Robotics protocols",
6
6
  "repository": {