ekms 9.6.1-beta.1 → 9.6.1-beta.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.
- package/common/drone.js +7 -3
- package/common/drone.test.json +22 -29
- package/common/helpers/drone.js +13 -1
- package/package.json +2 -2
package/common/drone.js
CHANGED
|
@@ -11,7 +11,7 @@ const actions = require('./actions')
|
|
|
11
11
|
const angle = require('./angle')
|
|
12
12
|
const rates = require('./rates')
|
|
13
13
|
const help = require('./help')
|
|
14
|
-
const { rotateDelta, degreesToRadians, radiansToDegrees, cartesianToPolar } = require('./helpers/drone')
|
|
14
|
+
const { rotateDelta, degreesToRadians, radiansToDegrees, cartesianToPolar, smallestRotate } = require('./helpers/drone')
|
|
15
15
|
|
|
16
16
|
/*
|
|
17
17
|
go back
|
|
@@ -19,6 +19,9 @@ go back another point
|
|
|
19
19
|
go back again
|
|
20
20
|
go back to the start
|
|
21
21
|
|
|
22
|
+
forward 1 foot\nwest 1 foot\ngo back to the start <<<<<<<< turn the longer way not he shorter way
|
|
23
|
+
forward 1 foot\nwest 1 foot\ncall the path route 1\ngo to the start of route 1\npatrol route 1\npatrol route 1 <<<<< does the patrol more than once
|
|
24
|
+
|
|
22
25
|
?? elipses of the verb go or some kind of conjunction?!?!?
|
|
23
26
|
go forward 1 meter turn right forward 2 meters stop
|
|
24
27
|
|
|
@@ -415,7 +418,8 @@ class API {
|
|
|
415
418
|
} else {
|
|
416
419
|
const polar = cartesianToPolar(currentPoint, destinationPoint)
|
|
417
420
|
const destinationAngleInRadians = polar.angle
|
|
418
|
-
const angleDelta = (destinationAngleInRadians - objects.current.angleInRadians)
|
|
421
|
+
// const angleDelta = (destinationAngleInRadians - objects.current.angleInRadians)
|
|
422
|
+
const angleDelta = rotateDelta(objects.current.angleInRadians, destinationAngleInRadians)
|
|
419
423
|
await this.rotate(angleDelta, { batched: true })
|
|
420
424
|
if (!pathComponent .aimOnly) {
|
|
421
425
|
await this.forward(objects.current.speed, { batched: true })
|
|
@@ -563,7 +567,7 @@ class API {
|
|
|
563
567
|
shortestRotate = shortestRotate + Math.PI*2
|
|
564
568
|
}
|
|
565
569
|
await this.rotateDrone(angleInRadians, options)
|
|
566
|
-
this._objects.current.angleInRadians = (this._objects.current.angleInRadians + angleInRadians)
|
|
570
|
+
this._objects.current.angleInRadians = smallestRotate(this._objects.current.angleInRadians + angleInRadians)
|
|
567
571
|
}
|
|
568
572
|
|
|
569
573
|
async tiltAngle(angle) {
|
package/common/drone.test.json
CHANGED
|
@@ -46984,7 +46984,7 @@
|
|
|
46984
46984
|
},
|
|
46985
46985
|
"drone1": {
|
|
46986
46986
|
"current": {
|
|
46987
|
-
"angleInRadians":
|
|
46987
|
+
"angleInRadians": -1.5707963267948966,
|
|
46988
46988
|
"compass": "north",
|
|
46989
46989
|
"direction": "around",
|
|
46990
46990
|
"ordinal": 1,
|
|
@@ -105567,7 +105567,7 @@
|
|
|
105567
105567
|
"batched": true,
|
|
105568
105568
|
"marker": "history",
|
|
105569
105569
|
"time": "2025-06-29T21:52:19.000Z",
|
|
105570
|
-
"turn": 3.141592653589793
|
|
105570
|
+
"turn": -3.141592653589793
|
|
105571
105571
|
},
|
|
105572
105572
|
{
|
|
105573
105573
|
"batched": true,
|
|
@@ -124983,7 +124983,7 @@
|
|
|
124983
124983
|
"batched": true,
|
|
124984
124984
|
"marker": "history",
|
|
124985
124985
|
"time": "2025-06-29T21:52:19.000Z",
|
|
124986
|
-
"turn": 3.141592653589793
|
|
124986
|
+
"turn": -3.141592653589793
|
|
124987
124987
|
},
|
|
124988
124988
|
{
|
|
124989
124989
|
"batched": true,
|
|
@@ -402038,7 +402038,7 @@
|
|
|
402038
402038
|
"batched": true,
|
|
402039
402039
|
"marker": "history",
|
|
402040
402040
|
"time": "2025-06-29T21:52:05.419Z",
|
|
402041
|
-
"turn": 3.141592653589793
|
|
402041
|
+
"turn": -3.141592653589793
|
|
402042
402042
|
},
|
|
402043
402043
|
{
|
|
402044
402044
|
"batched": true,
|
|
@@ -577256,7 +577256,7 @@
|
|
|
577256
577256
|
"batched": true,
|
|
577257
577257
|
"marker": "history",
|
|
577258
577258
|
"time": "2025-06-29T21:52:10.377Z",
|
|
577259
|
-
"turn":
|
|
577259
|
+
"turn": -2.027865083342686
|
|
577260
577260
|
},
|
|
577261
577261
|
{
|
|
577262
577262
|
"batched": true,
|
|
@@ -585943,8 +585943,7 @@
|
|
|
585943
585943
|
"text": "path",
|
|
585944
585944
|
"topLevel": true,
|
|
585945
585945
|
"touchedBy": [
|
|
585946
|
-
"drone#call3"
|
|
585947
|
-
"drone#call2"
|
|
585946
|
+
"drone#call3"
|
|
585948
585947
|
],
|
|
585949
585948
|
"word": "path"
|
|
585950
585949
|
},
|
|
@@ -588230,7 +588229,7 @@
|
|
|
588230
588229
|
"batched": true,
|
|
588231
588230
|
"marker": "history",
|
|
588232
588231
|
"time": "2025-06-29T21:52:10.377Z",
|
|
588233
|
-
"turn":
|
|
588232
|
+
"turn": -2.027865083342686
|
|
588234
588233
|
},
|
|
588235
588234
|
{
|
|
588236
588235
|
"batched": true,
|
|
@@ -596918,8 +596917,7 @@
|
|
|
596918
596917
|
"text": "path",
|
|
596919
596918
|
"topLevel": true,
|
|
596920
596919
|
"touchedBy": [
|
|
596921
|
-
"drone#call3"
|
|
596922
|
-
"drone#call2"
|
|
596920
|
+
"drone#call3"
|
|
596923
596921
|
],
|
|
596924
596922
|
"word": "path"
|
|
596925
596923
|
},
|
|
@@ -599598,7 +599596,7 @@
|
|
|
599598
599596
|
"batched": true,
|
|
599599
599597
|
"marker": "history",
|
|
599600
599598
|
"time": "2025-06-29T21:52:10.377Z",
|
|
599601
|
-
"turn":
|
|
599599
|
+
"turn": -2.027865083342686
|
|
599602
599600
|
},
|
|
599603
599601
|
{
|
|
599604
599602
|
"batched": true,
|
|
@@ -608286,8 +608284,7 @@
|
|
|
608286
608284
|
"text": "path",
|
|
608287
608285
|
"topLevel": true,
|
|
608288
608286
|
"touchedBy": [
|
|
608289
|
-
"drone#call3"
|
|
608290
|
-
"drone#call2"
|
|
608287
|
+
"drone#call3"
|
|
608291
608288
|
],
|
|
608292
608289
|
"word": "path"
|
|
608293
608290
|
},
|
|
@@ -611070,7 +611067,7 @@
|
|
|
611070
611067
|
"batched": true,
|
|
611071
611068
|
"marker": "history",
|
|
611072
611069
|
"time": "2025-06-29T21:52:10.377Z",
|
|
611073
|
-
"turn":
|
|
611070
|
+
"turn": -2.027865083342686
|
|
611074
611071
|
},
|
|
611075
611072
|
{
|
|
611076
611073
|
"batched": true,
|
|
@@ -619976,8 +619973,7 @@
|
|
|
619976
619973
|
"text": "path",
|
|
619977
619974
|
"topLevel": true,
|
|
619978
619975
|
"touchedBy": [
|
|
619979
|
-
"drone#call3"
|
|
619980
|
-
"drone#call2"
|
|
619976
|
+
"drone#call3"
|
|
619981
619977
|
],
|
|
619982
619978
|
"word": "path"
|
|
619983
619979
|
},
|
|
@@ -641763,7 +641759,7 @@
|
|
|
641763
641759
|
"batched": true,
|
|
641764
641760
|
"marker": "history",
|
|
641765
641761
|
"time": "2025-06-29T21:52:11.000Z",
|
|
641766
|
-
"turn":
|
|
641762
|
+
"turn": 2.356194490192345
|
|
641767
641763
|
},
|
|
641768
641764
|
{
|
|
641769
641765
|
"batched": true,
|
|
@@ -650475,8 +650471,7 @@
|
|
|
650475
650471
|
"text": "path",
|
|
650476
650472
|
"topLevel": true,
|
|
650477
650473
|
"touchedBy": [
|
|
650478
|
-
"drone#call3"
|
|
650479
|
-
"drone#call2"
|
|
650474
|
+
"drone#call3"
|
|
650480
650475
|
],
|
|
650481
650476
|
"word": "path"
|
|
650482
650477
|
},
|
|
@@ -652472,7 +652467,7 @@
|
|
|
652472
652467
|
"batched": true,
|
|
652473
652468
|
"marker": "history",
|
|
652474
652469
|
"time": "2025-06-29T21:52:11.000Z",
|
|
652475
|
-
"turn":
|
|
652470
|
+
"turn": 2.356194490192345
|
|
652476
652471
|
},
|
|
652477
652472
|
{
|
|
652478
652473
|
"batched": true,
|
|
@@ -652554,7 +652549,7 @@
|
|
|
652554
652549
|
"batched": true,
|
|
652555
652550
|
"marker": "history",
|
|
652556
652551
|
"time": "2025-06-29T21:52:27.656Z",
|
|
652557
|
-
"turn":
|
|
652552
|
+
"turn": 2.356194490192345
|
|
652558
652553
|
},
|
|
652559
652554
|
{
|
|
652560
652555
|
"batched": true,
|
|
@@ -661266,8 +661261,7 @@
|
|
|
661266
661261
|
"text": "path",
|
|
661267
661262
|
"topLevel": true,
|
|
661268
661263
|
"touchedBy": [
|
|
661269
|
-
"drone#call3"
|
|
661270
|
-
"drone#call2"
|
|
661264
|
+
"drone#call3"
|
|
661271
661265
|
],
|
|
661272
661266
|
"word": "path"
|
|
661273
661267
|
},
|
|
@@ -674083,7 +674077,7 @@
|
|
|
674083
674077
|
"batched": true,
|
|
674084
674078
|
"marker": "history",
|
|
674085
674079
|
"time": "2025-06-29T21:52:05.419Z",
|
|
674086
|
-
"turn": 3.141592653589793
|
|
674080
|
+
"turn": -3.141592653589793
|
|
674087
674081
|
},
|
|
674088
674082
|
{
|
|
674089
674083
|
"batched": true,
|
|
@@ -696112,7 +696106,7 @@
|
|
|
696112
696106
|
"batched": true,
|
|
696113
696107
|
"marker": "history",
|
|
696114
696108
|
"time": "2025-06-29T21:52:05.419Z",
|
|
696115
|
-
"turn": 3.141592653589793
|
|
696109
|
+
"turn": -3.141592653589793
|
|
696116
696110
|
},
|
|
696117
696111
|
{
|
|
696118
696112
|
"batched": true,
|
|
@@ -818488,7 +818482,7 @@
|
|
|
818488
818482
|
"batched": true,
|
|
818489
818483
|
"marker": "history",
|
|
818490
818484
|
"time": "2025-06-29T21:52:14.419Z",
|
|
818491
|
-
"turn": 3.141592653589793
|
|
818485
|
+
"turn": -3.141592653589793
|
|
818492
818486
|
},
|
|
818493
818487
|
{
|
|
818494
818488
|
"batched": true,
|
|
@@ -827257,8 +827251,7 @@
|
|
|
827257
827251
|
"text": "path",
|
|
827258
827252
|
"topLevel": true,
|
|
827259
827253
|
"touchedBy": [
|
|
827260
|
-
"drone#call3"
|
|
827261
|
-
"drone#call2"
|
|
827254
|
+
"drone#call3"
|
|
827262
827255
|
],
|
|
827263
827256
|
"word": "path"
|
|
827264
827257
|
},
|
|
@@ -838310,7 +838303,7 @@
|
|
|
838310
838303
|
"batched": true,
|
|
838311
838304
|
"marker": "history",
|
|
838312
838305
|
"time": "2025-06-29T21:52:05.419Z",
|
|
838313
|
-
"turn": 3.141592653589793
|
|
838306
|
+
"turn": -3.141592653589793
|
|
838314
838307
|
},
|
|
838315
838308
|
{
|
|
838316
838309
|
"batched": true,
|
package/common/helpers/drone.js
CHANGED
|
@@ -32,8 +32,19 @@ function radiansToDegrees(radians) {
|
|
|
32
32
|
return (radians * 180) / Math.PI;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function smallestRotate(angle) {
|
|
36
|
+
angle = angle % (Math.PI*2)
|
|
37
|
+
if (angle > 0 && angle > Math.PI) {
|
|
38
|
+
angle = -(Math.PI*2 - angle)
|
|
39
|
+
}
|
|
40
|
+
if (angle < 0 && angle < -Math.PI) {
|
|
41
|
+
angle = Math.PI*2 + angle
|
|
42
|
+
}
|
|
43
|
+
return angle
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
function rotateDelta(currentRadians, targetRadians) {
|
|
36
|
-
return (((targetRadians - currentRadians + Math.PI) % (2 * Math.PI)) - Math.PI)
|
|
47
|
+
return smallestRotate(((targetRadians - currentRadians + Math.PI) % (2 * Math.PI)) - Math.PI)
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
module.exports = {
|
|
@@ -41,4 +52,5 @@ module.exports = {
|
|
|
41
52
|
degreesToRadians,
|
|
42
53
|
radiansToDegrees,
|
|
43
54
|
rotateDelta,
|
|
55
|
+
smallestRotate,
|
|
44
56
|
}
|
package/package.json
CHANGED
|
@@ -386,8 +386,8 @@
|
|
|
386
386
|
"scriptjs": "^2.5.9",
|
|
387
387
|
"table": "^6.7.1",
|
|
388
388
|
"uuid": "^9.0.0",
|
|
389
|
-
"theprogrammablemind": "9.6.1-beta.
|
|
389
|
+
"theprogrammablemind": "9.6.1-beta.2"
|
|
390
390
|
},
|
|
391
|
-
"version": "9.6.1-beta.
|
|
391
|
+
"version": "9.6.1-beta.2",
|
|
392
392
|
"license": "UNLICENSED"
|
|
393
393
|
}
|