tpmkms 9.6.1 → 9.6.2

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.
Files changed (37) hide show
  1. package/common/actions.instance.json +99 -0
  2. package/common/actions.js +67 -0
  3. package/common/actions.test.json +656 -0
  4. package/common/angle.instance.json +20 -0
  5. package/common/colors.instance.json +0 -28
  6. package/common/compass.instance.json +15 -0
  7. package/common/dates.instance.json +0 -84
  8. package/common/dialogues.js +1 -1
  9. package/common/dimension.instance.json +96 -12
  10. package/common/dimension.js +12 -3
  11. package/common/drone.instance.json +10130 -1641
  12. package/common/drone.js +217 -71
  13. package/common/drone.test.json +192134 -3455
  14. package/common/drone_v1.instance.json +38 -31
  15. package/common/drone_v1.js +20 -15
  16. package/common/drone_v1.test.json +659 -389
  17. package/common/edible.instance.json +0 -128
  18. package/common/fastfood.instance.json +72 -392
  19. package/common/gdefaults.js +5 -1
  20. package/common/helpers/conjunction.js +9 -5
  21. package/common/helpers/drone.js +13 -1
  22. package/common/length.instance.json +135 -0
  23. package/common/nameable.js +63 -24
  24. package/common/nameable.test.json +3270 -3912
  25. package/common/ordinals.js +13 -0
  26. package/common/pipboy.instance.json +0 -56
  27. package/common/pressure.instance.json +20 -0
  28. package/common/properties.js +16 -6
  29. package/common/reports.instance.json +1 -1
  30. package/common/stm.js +119 -25
  31. package/common/temperature.instance.json +20 -0
  32. package/common/time.instance.json +45 -0
  33. package/common/time.test.json +3403 -0
  34. package/common/weight.instance.json +60 -0
  35. package/common/wp.instance.json +0 -56
  36. package/main.js +2 -0
  37. package/package.json +6 -2
@@ -6,7 +6,7 @@
6
6
  "point is a concept",
7
7
  "points are nameable orderable and memorable",
8
8
  {
9
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n api.sendCommand()\n }\n }\n })\n }"
9
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
10
10
  },
11
11
  {
12
12
  "operators": [
@@ -62,7 +62,7 @@
62
62
  "1": "{ marker: 'drone' }"
63
63
  },
64
64
  "bridge": "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
65
- "semantic": "({mentioned, context, objects, api, say}) => {\n if (!objects.calibration.startTime) {\n return // ignore\n }\n if (objects.calibration.speed) {\n /*\n const stopTime = api.stop()\n const ordinal = api.nextOrdinal()\n const point = api.currentPoint()\n mentioned({ marker: 'point', ordinal, point })\n objects.current.ordinal = ordinal\n */\n api.stop()\n api.markCurrentPoint()\n } else {\n const stopTime = api.stop()\n objects.calibration.endTime = stopTime\n objects.calibration.duration = (objects.calibration.endTime - objects.calibration.startTime)/1000\n }\n }"
65
+ "semantic": "async ({mentioned, context, objects, api, say}) => {\n if (!objects.calibration.startTime) {\n return // ignore\n }\n if (objects.calibration.speed) {\n /*\n const stopTime = api.stop()\n const ordinal = api.nextOrdinal()\n const point = api.currentPoint()\n mentioned({ marker: 'point', ordinal, point })\n objects.current.ordinal = ordinal\n */\n api.stop()\n await api.markCurrentPoint()\n } else {\n const stopTime = api.stop()\n objects.calibration.endTime = stopTime\n objects.calibration.duration = (objects.calibration.endTime - objects.calibration.startTime)/1000\n }\n }"
66
66
  }
67
67
  ],
68
68
  "generators": [
@@ -532,6 +532,11 @@
532
532
  "unit_length",
533
533
  false
534
534
  ],
535
+ [
536
+ "forQuantity",
537
+ "preposition",
538
+ false
539
+ ],
535
540
  [
536
541
  "forVariable",
537
542
  "preposition",
@@ -3405,6 +3410,11 @@
3405
3410
  "unit_length",
3406
3411
  false
3407
3412
  ],
3413
+ [
3414
+ "forQuantity",
3415
+ "preposition",
3416
+ false
3417
+ ],
3408
3418
  [
3409
3419
  "forVariable",
3410
3420
  "preposition",
@@ -6111,20 +6121,6 @@
6111
6121
  0
6112
6122
  ]
6113
6123
  ],
6114
- [
6115
- [
6116
- "is",
6117
- 0
6118
- ],
6119
- [
6120
- "list",
6121
- 1
6122
- ],
6123
- [
6124
- "unknown",
6125
- 0
6126
- ]
6127
- ],
6128
6124
  [
6129
6125
  [
6130
6126
  "is",
@@ -8291,6 +8287,11 @@
8291
8287
  "unit_length",
8292
8288
  false
8293
8289
  ],
8290
+ [
8291
+ "forQuantity",
8292
+ "preposition",
8293
+ false
8294
+ ],
8294
8295
  [
8295
8296
  "forVariable",
8296
8297
  "preposition",
@@ -11545,6 +11546,11 @@
11545
11546
  "unit_length",
11546
11547
  false
11547
11548
  ],
11549
+ [
11550
+ "forQuantity",
11551
+ "preposition",
11552
+ false
11553
+ ],
11548
11554
  [
11549
11555
  "forVariable",
11550
11556
  "preposition",
@@ -14763,6 +14769,11 @@
14763
14769
  "unit_length",
14764
14770
  false
14765
14771
  ],
14772
+ [
14773
+ "forQuantity",
14774
+ "preposition",
14775
+ false
14776
+ ],
14766
14777
  [
14767
14778
  "forVariable",
14768
14779
  "preposition",
@@ -17771,7 +17782,7 @@
17771
17782
  }
17772
17783
  },
17773
17784
  {
17774
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n api.sendCommand()\n }\n }\n })\n }"
17785
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
17775
17786
  },
17776
17787
  {
17777
17788
  "extraConfig": true,
@@ -18470,6 +18481,11 @@
18470
18481
  "unit_length",
18471
18482
  false
18472
18483
  ],
18484
+ [
18485
+ "forQuantity",
18486
+ "preposition",
18487
+ false
18488
+ ],
18473
18489
  [
18474
18490
  "forVariable",
18475
18491
  "preposition",
@@ -21630,6 +21646,11 @@
21630
21646
  "unit_length",
21631
21647
  false
21632
21648
  ],
21649
+ [
21650
+ "forQuantity",
21651
+ "preposition",
21652
+ false
21653
+ ],
21633
21654
  [
21634
21655
  "forVariable",
21635
21656
  "preposition",
@@ -24649,20 +24670,6 @@
24649
24670
  0
24650
24671
  ]
24651
24672
  ],
24652
- [
24653
- [
24654
- "is",
24655
- 0
24656
- ],
24657
- [
24658
- "list",
24659
- 1
24660
- ],
24661
- [
24662
- "unknown",
24663
- 0
24664
- ]
24665
- ],
24666
24673
  [
24667
24674
  [
24668
24675
  "is",
@@ -141,12 +141,12 @@ class API {
141
141
  return this._objects.ordinal += 1
142
142
  }
143
143
 
144
- currentPoint() {
144
+ async currentPoint() {
145
145
  if (!this._objects.current.endTime) {
146
146
  return null // in motion
147
147
  }
148
148
  const ordinal = this._objects.current.ordinal
149
- const lastPoint = this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
149
+ const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
150
150
 
151
151
  const durationInSeconds = (this._objects.current.endTime - this._objects.current.startTime) / 1000
152
152
  const speedInMetersPerSecond = (this._objects.current.power / this._objects.calibration.power) * this._objects.calibration.speed
@@ -159,9 +159,9 @@ class API {
159
159
  return { x: xPrime, y: yPrime }
160
160
  }
161
161
 
162
- markCurrentPoint() {
162
+ async markCurrentPoint() {
163
163
  const ordinal = this.nextOrdinal()
164
- const point = this.currentPoint()
164
+ const point = await this.currentPoint()
165
165
  this.args.mentioned({ marker: 'point', ordinal, point })
166
166
  this._objects.current.ordinal = ordinal
167
167
  this._objects.current.endTime = null
@@ -186,17 +186,17 @@ class API {
186
186
  this.testDate = new Date(this.testDate.getTime() + (duration_in_seconds-1)*1000)
187
187
  }
188
188
 
189
- sendCommand() {
190
- const stopAtDistance = (distanceMeters) => {
189
+ async sendCommand() {
190
+ const stopAtDistance = async (distanceMeters) => {
191
191
  const speed_meters_per_second = this._objects.calibration.speed
192
192
  const duration_seconds = distanceMeters / speed_meters_per_second
193
193
  this.pause(duration_seconds)
194
194
  this.stop()
195
- this.markCurrentPoint()
195
+ await this.markCurrentPoint()
196
196
  }
197
197
 
198
198
  if (this._objects.current.destination) {
199
- const currentPoint = this.args.mentions({ context: { marker: 'point' } })
199
+ const currentPoint = await this.args.mentions({ context: { marker: 'point' } })
200
200
  const polar = cartesianToPolar(currentPoint.point, this._objects.current.destination.point)
201
201
  const destinationAngleInDegrees = radiansToDegrees(polar.angle)
202
202
  let angleDelta = destinationAngleInDegrees - this._objects.current.angleInDegrees
@@ -207,7 +207,7 @@ class API {
207
207
  }
208
208
  this.rotate(angleDelta)
209
209
  this.forward(this._objects.current.power)
210
- stopAtDistance(polar.radius)
210
+ await stopAtDistance(polar.radius)
211
211
  return
212
212
  }
213
213
 
@@ -232,7 +232,7 @@ class API {
232
232
 
233
233
  if (command.distance) {
234
234
  const distanceMeters = command.distance
235
- stopAtDistance(distanceMeters)
235
+ await stopAtDistance(distanceMeters)
236
236
  }
237
237
  }
238
238
 
@@ -456,11 +456,11 @@ const template = {
456
456
  args.config.addSemantic({
457
457
  // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),
458
458
  match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',
459
- apply: ({context, objects, api}) => {
459
+ apply: async ({context, objects, api}) => {
460
460
  // send a command to the drone
461
461
  if (objects.runCommand) {
462
462
  // debugger
463
- api.sendCommand()
463
+ await api.sendCommand()
464
464
  }
465
465
  }
466
466
  })
@@ -529,7 +529,7 @@ const template = {
529
529
  1: "{ marker: 'drone' }",
530
530
  },
531
531
  bridge: "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
532
- semantic: ({mentioned, context, objects, api, say}) => {
532
+ semantic: async ({mentioned, context, objects, api, say}) => {
533
533
  if (!objects.calibration.startTime) {
534
534
  return // ignore
535
535
  }
@@ -542,7 +542,7 @@ const template = {
542
542
  objects.current.ordinal = ordinal
543
543
  */
544
544
  api.stop()
545
- api.markCurrentPoint()
545
+ await api.markCurrentPoint()
546
546
  } else {
547
547
  const stopTime = api.stop()
548
548
  objects.calibration.endTime = stopTime
@@ -576,7 +576,12 @@ knowledgeModule( {
576
576
  contents: droneV1_tests,
577
577
  checks: {
578
578
  context: [
579
- defaultContextCheck({ marker: 'point', exported: true, extra: ['ordinal', { property: 'point', check: ['x', 'y'] }, 'description', { property: 'stm', check: ['id', 'names'] }] }),
579
+ defaultContextCheck({ marker: 'point', exported: true, extra: [
580
+ 'ordinal',
581
+ { property: 'point', check: ['x', 'y'] },
582
+ 'description',
583
+ { property: 'namespaced', check: [{ property: 'stm', check: ['id', 'names'] }] },
584
+ ] }),
580
585
  defaultContextCheck({ marker: 'turn', exported: true, extra: ['direction'] }),
581
586
  defaultContextCheck({ marker: 'history', exported: true, extra: ['pause', 'direction', 'power', 'turn', 'time'] }),
582
587
  defaultContextCheck(),