tpmkms_4wp 9.5.1-beta.32 → 9.5.1-beta.34

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.
@@ -1111,7 +1111,7 @@
1111
1111
  "end": 24
1112
1112
  },
1113
1113
  "dead": true,
1114
- "modifiers": [
1114
+ "conceptModifiers": [
1115
1115
  {
1116
1116
  "value": "measurement",
1117
1117
  "unknown": true,
@@ -5444,7 +5444,7 @@
5444
5444
  "end": 21
5445
5445
  },
5446
5446
  "dead": true,
5447
- "modifiers": [
5447
+ "conceptModifiers": [
5448
5448
  {
5449
5449
  "value": "metric",
5450
5450
  "unknown": true,
@@ -6889,7 +6889,7 @@
6889
6889
  "end": 23
6890
6890
  },
6891
6891
  "dead": true,
6892
- "modifiers": [
6892
+ "conceptModifiers": [
6893
6893
  {
6894
6894
  "value": "imperial",
6895
6895
  "unknown": true,
@@ -8438,7 +8438,7 @@
8438
8438
  "end": 26
8439
8439
  },
8440
8440
  "dead": true,
8441
- "modifiers": [
8441
+ "conceptModifiers": [
8442
8442
  {
8443
8443
  "value": "measurement",
8444
8444
  "number": "one",
@@ -14103,7 +14103,7 @@
14103
14103
  "end": 21
14104
14104
  },
14105
14105
  "dead": true,
14106
- "modifiers": [
14106
+ "conceptModifiers": [
14107
14107
  {
14108
14108
  "value": "imperial",
14109
14109
  "number": "one",
@@ -15772,7 +15772,7 @@
15772
15772
  "end": 19
15773
15773
  },
15774
15774
  "dead": true,
15775
- "modifiers": [
15775
+ "conceptModifiers": [
15776
15776
  {
15777
15777
  "value": "metric",
15778
15778
  "number": "one",
@@ -6,7 +6,7 @@
6
6
  "point is a concept",
7
7
  "points are nameable",
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.calibration.power * (desired_speed / objects.calibration.speed)\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 == 'controlEnd',\n apply: ({context, objects, api}) => {\n // send a command to the drone\n api.sendCommand()\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.calibration.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 api.sendCommand()\n }\n }\n })\n }"
10
10
  },
11
11
  {
12
12
  "operators": [
@@ -26,7 +26,7 @@
26
26
  "verb"
27
27
  ],
28
28
  "bridge": "{ ...next(operator), direction: after[0], interpolate: [{ context: operator }, { property: 'direction' }] }",
29
- "semantic": "({context, objects, api}) => {\n objects.current.direction = context.direction.marker\n }"
29
+ "semantic": "({context, objects, api}) => {\n objects.runCommand = true\n objects.current.direction = context.direction.marker\n }"
30
30
  },
31
31
  {
32
32
  "id": "calibrate",
@@ -61,7 +61,8 @@
61
61
  "match": "({context}) => context.marker == 'help' && !context.paraphrase && context.isResponse",
62
62
  "apply": "() => ''"
63
63
  }
64
- ]
64
+ ],
65
+ "semantics": []
65
66
  }
66
67
  ],
67
68
  "resultss": [
@@ -15079,7 +15080,7 @@
15079
15080
  }
15080
15081
  },
15081
15082
  {
15082
- "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.calibration.power * (desired_speed / objects.calibration.speed)\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 == 'controlEnd',\n apply: ({context, objects, api}) => {\n // send a command to the drone\n api.sendCommand()\n }\n })\n }"
15083
+ "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.calibration.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 api.sendCommand()\n }\n }\n })\n }"
15083
15084
  },
15084
15085
  {
15085
15086
  "extraConfig": true,
@@ -15128,7 +15129,8 @@
15128
15129
  ],
15129
15130
  "generators": [
15130
15131
  {}
15131
- ]
15132
+ ],
15133
+ "semantics": []
15132
15134
  }
15133
15135
  ],
15134
15136
  "fragments": [
package/common/drone.js CHANGED
@@ -151,27 +151,28 @@ class API {
151
151
  }
152
152
 
153
153
  pause(duration_seconds) {
154
- this._objects.history.push({ pause: duration_seconds })
154
+ this._objects.history.push({ marker: 'history', pause: duration_seconds })
155
155
  }
156
156
 
157
157
  // subclass and override the remaining to call the car
158
158
 
159
159
  forward(power) {
160
- this._objects.history.push({ direction: 'forward', power })
160
+ this._objects.history.push({ marker: 'history', direction: 'forward', power })
161
161
  }
162
162
 
163
163
  backward(power) {
164
- this._objects.history.push({ direction: 'backward', power })
164
+ this._objects.history.push({ marker: 'history', direction: 'backward', power })
165
165
  }
166
166
 
167
167
  // -angle is counterclockwise
168
168
  // +angle is clockwise
169
169
 
170
170
  rotate(angle) {
171
- this._objects.history.push({ turn: angle })
171
+ this._objects.history.push({ marker: 'history', turn: angle })
172
172
  }
173
173
 
174
174
  turn(angle) {
175
+ this._objects.runCommand = true
175
176
  }
176
177
 
177
178
  tilt_angle(angle) {
@@ -181,7 +182,7 @@ class API {
181
182
  }
182
183
 
183
184
  stop() {
184
- this._objects.history.push({ power: 0 })
185
+ this._objects.history.push({ marker: 'history', power: 0 })
185
186
  }
186
187
  }
187
188
 
@@ -243,6 +244,7 @@ function expectDirection(args) {
243
244
  args.config.addSemantic({
244
245
  match: ({context, isA}) => isA(context.marker, 'direction'),
245
246
  apply: ({objects, context}) => {
247
+ objects.runCommand = true
246
248
  objects.current.direction = context.marker
247
249
  }
248
250
  })
@@ -268,6 +270,7 @@ function expectDistanceForMove(args) {
268
270
  apply: async ({context, objects, fragments, e}) => {
269
271
  const instantiation = await fragments("quantity in meters", { quantity: context })
270
272
  const result = await e(instantiation)
273
+ objects.runCommand = true
271
274
  objects.current.distance = result.evalue.amount.evalue.evalue
272
275
  }
273
276
  })
@@ -318,15 +321,26 @@ const template = {
318
321
  const result = await e(instantiation)
319
322
  const desired_speed = result.evalue.amount.evalue.evalue
320
323
  const desired_power = objects.calibration.power * (desired_speed / objects.calibration.speed)
324
+ objects.runCommand = true
321
325
  objects.current.power = desired_power
322
326
  }
323
327
  })
324
328
 
325
329
  args.config.addSemantic({
330
+ match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',
331
+ apply: ({context, objects, api}) => {
332
+ objects.runCommand = false
333
+ }
334
+ })
335
+
336
+ args.config.addSemantic({
337
+ // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),
326
338
  match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',
327
339
  apply: ({context, objects, api}) => {
328
340
  // send a command to the drone
329
- api.sendCommand()
341
+ if (objects.runCommand) {
342
+ api.sendCommand()
343
+ }
330
344
  }
331
345
  })
332
346
  },
@@ -345,6 +359,7 @@ const template = {
345
359
  isA: ['verb'],
346
360
  bridge: "{ ...next(operator), direction: after[0], interpolate: [{ context: operator }, { property: 'direction' }] }",
347
361
  semantic: ({context, objects, api}) => {
362
+ objects.runCommand = true
348
363
  objects.current.direction = context.direction.marker
349
364
  },
350
365
  // check: { marker: 'turn', exported: true, extra: ['direction'] }
@@ -392,6 +407,9 @@ const template = {
392
407
  apply: () => ''
393
408
  },
394
409
  ],
410
+ semantics: [
411
+
412
+ ],
395
413
  },
396
414
  ],
397
415
  }
@@ -408,8 +426,9 @@ knowledgeModule( {
408
426
  contents: drone_tests,
409
427
  checks: {
410
428
  context: [
411
- defaultContextCheck({ marker: 'point', exported: true, extra: ['ordinal'] }),
429
+ defaultContextCheck({ marker: 'point', exported: true, extra: ['ordinal', { property: 'stm', check: ['id', 'names'] }] }),
412
430
  defaultContextCheck({ marker: 'turn', exported: true, extra: ['direction'] }),
431
+ defaultContextCheck({ marker: 'history', exported: true, extra: ['pause', 'direction', 'power', 'turn'] }),
413
432
  defaultContextCheck(),
414
433
  ],
415
434
  objects: [
@@ -417,7 +436,7 @@ knowledgeModule( {
417
436
  { path: ['calibration'] },
418
437
  { path: ['history'] },
419
438
  { path: ['current'] },
420
- // defaultContextCheck(['calibration', 'history', 'current']),
439
+ { path: ['runCommand'] },
421
440
  ],
422
441
  }
423
442
  },