This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
shim.json
69 lines (62 loc) · 2.17 KB
/
shim.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
"getUS" : [
"new __PyFunction__ ('getUS',[], [] , function () {",
"let __scope___ = __scope__;",
"return (new __PyInt__ (12));",
"});"
],
"getIR" : [
"new __PyFunction__ ('getIR',[], [] , function () {",
"return __PyTrue__;",
"});"
],
"setV" : [
"new __PyFunction__ ('setV',['linearSpeed', ], [] , function (linearSpeed, ) {",
"if (linearSpeed.__class__ !== __PyInt__ && linearSpeed.__class__ !== __PyFloat__) {",
"throw new __PyTypeError__ ('linear speed argument must be of type int or float');",
"}",
"myRobot.setV (linearSpeed.x);",
"return __PyNone__;",
"});"
],
"setW" : [
"new __PyFunction__ ('setW',['angularSpeed', ], [] , function (angularSpeed, ) {",
"if (angularSpeed.__class__ !== __PyInt__ && angularSpeed.__class__ !== __PyFloat__) {",
"throw new __PyTypeError__ ('angular speed argument must be of type int or float');",
"}",
"myRobot.setW (angularSpeed.x);",
"return __PyNone__;",
"});"
],
"getEncoders" : [
"new __PyFunction__ ('getEncoders',[], [] , function () {",
"return new __PyTuple__ ([(new __PyInt__ (1)), (new __PyInt__ (2)), ]);",
"});"
],
"getLaser" : [
"new __PyFunction__ ('getLaser',[], [] , function () {",
"return __PyFalse__;",
"});"
],
"getV" : [
"new __PyFunction__ ('getV',[], [] , function () {",
"return new __PyFloat__ (myRobot.getV ());",
"});"
],
"getW" : [
"new __PyFunction__ ('getW',[], [] , function () {",
"return new __PyFloat__ (myRobot.getW ());",
"});"
],
"getInfrared" : [
"new __PyFunction__ ('getW',[], [] , function () {",
"var d = new __PyDict__ ([], []);",
"var o = myRobot.getInfrared ();",
"var left = o.Left, right = o.Right, front = o.Front;",
"__setitem__ (d, (new __PyStr__ ('Front')), new __PyList__ ([(new __PyInt__ (front[0])), (new __PyInt__ (front[1])), (new __PyInt__ (front[2])), ]));",
"__setitem__ (d, (new __PyStr__ ('Left')), new __PyList__ ([(new __PyInt__ (left[0])), (new __PyInt__ (left[1])), (new __PyInt__ (left[2])), ]));",
"__setitem__ (d, (new __PyStr__ ('Right')), new __PyList__ ([(new __PyInt__ (right[0])), (new __PyInt__ (right[1])), (new __PyInt__ (right[2])), ]));",
"return d;",
"});"
]
}