ekms 9.6.3-beta.11 → 9.6.3-beta.13
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.
- package/common/articles.js +1 -2
- package/common/colors.instance.json +28 -0
- package/common/concept.js +1 -1
- package/common/conjunction.js +2 -4
- package/common/crew.instance.json +120 -36
- package/common/dates.instance.json +84 -0
- package/common/drone.instance.json +7467 -377
- package/common/drone.js +103 -29
- package/common/drone.test.json +117044 -28465
- package/common/drone_v1.instance.json +343 -0
- package/common/edible.instance.json +56 -0
- package/common/fastfood.instance.json +360 -108
- package/common/pipboy.instance.json +56 -0
- package/common/reports.instance.json +2 -2
- package/common/stm.js +13 -0
- package/common/time.instance.json +7551 -907
- package/common/time.js +3 -1
- package/common/time.test.json +9914 -0
- package/common/wp.instance.json +56 -0
- package/package.json +2 -2
package/common/drone.js
CHANGED
|
@@ -16,14 +16,17 @@ const { rotateDelta, degreesToRadians, radiansToDegrees, cartesianToPolar, small
|
|
|
16
16
|
/*
|
|
17
17
|
NEED TO CHECK ON ACTUAL DRONE
|
|
18
18
|
|
|
19
|
+
stopping 2 seconds at each point
|
|
19
20
|
patrols x do that again
|
|
20
21
|
DONE go to the end of the patrol
|
|
21
|
-
patrol x three times
|
|
22
|
+
DONE patrol x three times
|
|
23
|
+
patrol x continuously
|
|
22
24
|
patrol x for 5 minutes
|
|
23
|
-
|
|
25
|
+
go to the start
|
|
26
|
+
DONE node drone -q 'north 1 meter\neast 1 meter\ncall that route 2\nwhat is the second point of route 2' -g -
|
|
24
27
|
|
|
25
|
-
go to the second point of route 1
|
|
26
|
-
do route 1 pausing 10 seconds at each point
|
|
28
|
+
DONE go to the second point of route 1
|
|
29
|
+
DONE do route 1 pausing 10 seconds at each point
|
|
27
30
|
|
|
28
31
|
what is the drone's position
|
|
29
32
|
DONE go back
|
|
@@ -41,7 +44,7 @@ TODO should there be two hierarchy one as a concept car is a vehicle and one as
|
|
|
41
44
|
|
|
42
45
|
turn left\nturn back
|
|
43
46
|
|
|
44
|
-
do route 1 pausing 10 seconds at each point
|
|
47
|
+
DONE do route 1 pausing 10 seconds at each point
|
|
45
48
|
do route 1 pausing 1 second at point 1 and 2 seconds for the rest
|
|
46
49
|
|
|
47
50
|
forward 1 foot\nwest 1 foot\ngo back to the start <<<<<<<< turn the longer way not he shorter way
|
|
@@ -455,13 +458,14 @@ class API {
|
|
|
455
458
|
}
|
|
456
459
|
|
|
457
460
|
if (objects.current.path.length > 0) {
|
|
458
|
-
if (objects.current.timeRepeats) {
|
|
459
|
-
this.startRepeats(objects.current.timeRepeats)
|
|
460
|
-
}
|
|
461
461
|
let currentPoint = (await this.args.recall({ context: { marker: 'point' } })).point
|
|
462
462
|
this._objects.history.push({ marker: 'history', debug: 'doing path' })
|
|
463
|
-
for (const pathComponent of objects.current.path) {
|
|
464
|
-
if (pathComponent.
|
|
463
|
+
for (const [pathIndex, pathComponent] of objects.current.path.entries()) {
|
|
464
|
+
if (pathComponent.repeatStart) {
|
|
465
|
+
if (objects.current.timeRepeats) {
|
|
466
|
+
this.startRepeats(objects.current.timeRepeats)
|
|
467
|
+
}
|
|
468
|
+
} else if (pathComponent.marker == 'pause') {
|
|
465
469
|
this.pause(pathComponent.pauseSeconds, { batched: true })
|
|
466
470
|
} else {
|
|
467
471
|
const points = this.args.toArray(pathComponent)
|
|
@@ -475,12 +479,12 @@ class API {
|
|
|
475
479
|
// const angleDelta = (destinationAngleInRadians - objects.current.angleInRadians)
|
|
476
480
|
const angleDelta = rotateDelta(objects.current.angleInRadians, destinationAngleInRadians)
|
|
477
481
|
await this.rotate(angleDelta, { batched: true })
|
|
478
|
-
if (!pathComponent
|
|
482
|
+
if (!pathComponent.aimOnly) {
|
|
479
483
|
await this.forward(objects.current.speed, { batched: true })
|
|
480
484
|
await stopAtDistance("forward", polar.radius)
|
|
485
|
+
currentPoint = destinationPoint
|
|
481
486
|
}
|
|
482
487
|
}
|
|
483
|
-
currentPoint = destinationPoint
|
|
484
488
|
}
|
|
485
489
|
}
|
|
486
490
|
if (objects.current.timeRepeats) {
|
|
@@ -608,6 +612,7 @@ class API {
|
|
|
608
612
|
const ordinal = this.currentOrdinal()
|
|
609
613
|
const currentPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
610
614
|
const lastPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal-1 })
|
|
615
|
+
current.path.push({ repeatStart: true })
|
|
611
616
|
current.path.push(lastPoint)
|
|
612
617
|
current.path.push(currentPoint)
|
|
613
618
|
objects.runCommand = true
|
|
@@ -808,7 +813,22 @@ const template = {
|
|
|
808
813
|
"around, forward, left, right, back, forth and backward are directions",
|
|
809
814
|
"paths are nameable and memorable",
|
|
810
815
|
"start and end are properties of path",
|
|
816
|
+
({apis}) => {
|
|
817
|
+
apis('properties').addHierarchyWatcher({
|
|
818
|
+
match: ({childId}) => childId == 'point',
|
|
819
|
+
apply: ({config, childId}) => {
|
|
820
|
+
config.updateBridge(childId, ({ bridge }) => {
|
|
821
|
+
if (!bridge.init) {
|
|
822
|
+
bridge.init = {}
|
|
823
|
+
}
|
|
824
|
+
bridge.init['notConjunctableWith'] = ['quantity']
|
|
825
|
+
})
|
|
826
|
+
}
|
|
827
|
+
})
|
|
828
|
+
},
|
|
829
|
+
|
|
811
830
|
"start and end are points",
|
|
831
|
+
"rest and remaining are concepts",
|
|
812
832
|
{
|
|
813
833
|
hierarchy: [
|
|
814
834
|
['point', 'distributable'],
|
|
@@ -872,8 +892,33 @@ const template = {
|
|
|
872
892
|
"([stop] ([drone|])?)",
|
|
873
893
|
"([toPoint|to] (point))",
|
|
874
894
|
"([atPoint|at] (point))",
|
|
895
|
+
// "([forRest|for] (rest/* || remaining/*))",
|
|
896
|
+
"((context.unit.dimension == 'time') [timeAtPoint|] (atPoint))",
|
|
897
|
+
// "((context.unit.dimension == 'time') [timeForRest|] (forRest))",
|
|
875
898
|
],
|
|
876
899
|
bridges: [
|
|
900
|
+
/*
|
|
901
|
+
{
|
|
902
|
+
id: 'forRest',
|
|
903
|
+
isA: ['preposition'],
|
|
904
|
+
bridge: "{ ...next(operator), rest: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'rest' }] }"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
id: 'timeForRest',
|
|
908
|
+
before: ['verb'],
|
|
909
|
+
after: ['preposition'],
|
|
910
|
+
convolution: true,
|
|
911
|
+
bridge: "{ ...next(operator), time: before[0], point: after[0], operator: operator, interpolate: [{ property: 'time' }, { property: 'point' }] }"
|
|
912
|
+
},
|
|
913
|
+
*/
|
|
914
|
+
{
|
|
915
|
+
id: 'timeAtPoint',
|
|
916
|
+
before: ['verb'],
|
|
917
|
+
after: ['preposition'],
|
|
918
|
+
convolution: true,
|
|
919
|
+
bridge: "{ ...next(operator), time: before[0], point: after[0], operator: operator, interpolate: [{ property: 'time' }, { property: 'point' }] }",
|
|
920
|
+
check: defaultContextCheckProperties(['time', 'point']),
|
|
921
|
+
},
|
|
877
922
|
{
|
|
878
923
|
id: 'atPoint',
|
|
879
924
|
isA: ['preposition'],
|
|
@@ -898,34 +943,57 @@ const template = {
|
|
|
898
943
|
bridge: `{
|
|
899
944
|
...next(operator), operator: operator, path: after[0], interpolate: append(default(operator.interpolate, [{ property: 'operator'}]), [{ property: 'path' }])
|
|
900
945
|
}`,
|
|
901
|
-
semantic: async ({context, e, fragments, toEValue, toFinalValue, objects}) => {
|
|
946
|
+
semantic: async ({context, e, toArray, fragments, toEValue, toFinalValue, recall, objects}) => {
|
|
902
947
|
const evaluated = await(e(context.path))
|
|
903
948
|
const path = toEValue(evaluated)
|
|
949
|
+
|
|
950
|
+
// TODO put this in a common place for use by do+patrol
|
|
951
|
+
|
|
952
|
+
// ordinal to pause time in seconds
|
|
953
|
+
const pauseTimeInSeconds = {}
|
|
954
|
+
if (context.pause) {
|
|
955
|
+
const timeAtPoints = toArray(context.pause.timeAtPoint)
|
|
956
|
+
for (const timeAtPoint of timeAtPoints) {
|
|
957
|
+
const instantiation = await fragments("quantity in seconds", { quantity: timeAtPoint.time })
|
|
958
|
+
const result = await e(instantiation)
|
|
959
|
+
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
960
|
+
|
|
961
|
+
const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })
|
|
962
|
+
for (const point of toArray(points)) {
|
|
963
|
+
pauseTimeInSeconds[point.ordinal] = seconds
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// get to the start of the patrol
|
|
969
|
+
objects.current.path.push(path.points[0])
|
|
970
|
+
objects.current.path.push({ aimOnly: true, ...path.points[1] })
|
|
971
|
+
objects.current.path.push({ repeatStart: true })
|
|
904
972
|
for (const point of path.points) {
|
|
905
973
|
objects.current.path.push(point)
|
|
974
|
+
if (pauseTimeInSeconds[point.ordinal]) {
|
|
975
|
+
objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })
|
|
976
|
+
}
|
|
906
977
|
}
|
|
907
978
|
if (context.repeats) {
|
|
908
|
-
objects.current.timeRepeats = toFinalValue(context.repeats)
|
|
979
|
+
objects.current.timeRepeats = toFinalValue(context.repeats.repeats)
|
|
909
980
|
}
|
|
910
981
|
// if the patrol does not start and end at the same spot then
|
|
911
982
|
// go back to the start along the same path
|
|
912
983
|
|
|
913
984
|
|
|
914
|
-
|
|
915
|
-
if (context.pause) {
|
|
916
|
-
const instantiation = await fragments("quantity in seconds", { quantity: context.pause.time })
|
|
917
|
-
const result = await e(instantiation)
|
|
918
|
-
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
919
|
-
pauseTimeInSeconds = seconds
|
|
920
|
-
}
|
|
921
|
-
|
|
985
|
+
// if the start is not the end of the patrol then go backwards along the patrol
|
|
922
986
|
if (JSON.stringify(path.points[0].point) !== JSON.stringify(path.points[path.points.length-1].point)) {
|
|
923
|
-
for (const point of [...path.points].reverse()) {
|
|
987
|
+
for (const point of [...path.points].reverse().slice(1)) {
|
|
924
988
|
objects.current.path.push(point)
|
|
925
|
-
if (pauseTimeInSeconds) {
|
|
926
|
-
objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds })
|
|
989
|
+
if (pauseTimeInSeconds[point.ordinal]) {
|
|
990
|
+
objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })
|
|
927
991
|
}
|
|
928
992
|
}
|
|
993
|
+
|
|
994
|
+
const secondPoint = path.points[1]
|
|
995
|
+
objects.current.path.push({ ...secondPoint, aimOnly: true })
|
|
996
|
+
|
|
929
997
|
}
|
|
930
998
|
objects.runCommand = true
|
|
931
999
|
}
|
|
@@ -1117,17 +1185,22 @@ const template = {
|
|
|
1117
1185
|
words: [
|
|
1118
1186
|
...conjugateVerb('pause'),
|
|
1119
1187
|
],
|
|
1120
|
-
bridge: "{ ...next(operator), time: or(time?, forTime), operator: operator, atPoint: atPoint?, interpolate: [{ property: 'operator' }, { property: 'time' }, { property: 'atPoint' }] }",
|
|
1121
|
-
check: defaultContextCheckProperties(['
|
|
1188
|
+
bridge: "{ ...next(operator), timeAtPoint: timeAtPoint?, time: or(time?, forTime?), operator: operator, atPoint: atPoint?, interpolate: [{ property: 'operator' }, { property: 'time' }, { property: 'forTime' }, { property: 'atPoint' }, { property: 'timeAtPoint' } ] }",
|
|
1189
|
+
check: defaultContextCheckProperties(['timeAtPoint']),
|
|
1122
1190
|
selector: {
|
|
1123
1191
|
arguments: {
|
|
1124
1192
|
forTime: "(@<= 'forQuantity' && context.quantity.unit.dimension == 'time')",
|
|
1125
1193
|
time: "(@<= 'quantity' && context.unit.dimension == 'time')",
|
|
1126
1194
|
atPoint: "(@<= 'atPoint')",
|
|
1195
|
+
timeAtPoint: "(@<= 'timeAtPoint')",
|
|
1127
1196
|
},
|
|
1128
1197
|
},
|
|
1129
1198
|
semantic: async ({context, remember, api, e, fragments, toFinalValue}) => {
|
|
1130
1199
|
let time = context.time
|
|
1200
|
+
if (!time) {
|
|
1201
|
+
return
|
|
1202
|
+
}
|
|
1203
|
+
debugger
|
|
1131
1204
|
if (time.marker == 'forQuantity') {
|
|
1132
1205
|
time = time.quantity
|
|
1133
1206
|
}
|
|
@@ -1184,7 +1257,8 @@ const template = {
|
|
|
1184
1257
|
const path = toEValue(evaluated)
|
|
1185
1258
|
let pauseTimeInSeconds = 0
|
|
1186
1259
|
if (context.pause) {
|
|
1187
|
-
|
|
1260
|
+
debugger
|
|
1261
|
+
const instantiation = await fragments("quantity in seconds", { quantity: context.pause.timeAtPoint.time })
|
|
1188
1262
|
const result = await e(instantiation)
|
|
1189
1263
|
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
1190
1264
|
pauseTimeInSeconds = seconds
|
|
@@ -1201,7 +1275,7 @@ const template = {
|
|
|
1201
1275
|
},
|
|
1202
1276
|
{
|
|
1203
1277
|
match: ({context, contextHierarchy}) => {
|
|
1204
|
-
if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate', 'patrol'])) {
|
|
1278
|
+
if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.instance) {
|
|
1205
1279
|
return false
|
|
1206
1280
|
}
|
|
1207
1281
|
|