-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.js
68 lines (64 loc) · 2.54 KB
/
constants.js
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
/***********************************************************************
* constants.js
* by David Hodges, Outermost Software, LLC, 2019
* various addresses, constants, and classes common to both app.js and phidgetServer.js
***********************************************************************/
//
// network addresses
//
exports.WebCamAddress= "http://phidgetsbc.local:81/?action=stream";
exports.PhidgetSBCServer = "phidgetsbc.local";
exports.PhidgetsSBCServerPort = 5661
//WebCamAddress= "http://192.168.99.1:81/?action=stream";
//PhidgetSBCServer = "http://192.168.99.1:5661";
LocalWebAdminPage = "http://localhost:3001";
// pubsub topics
exports.roverconnection_command = "rcc" // send connect/disconnect commands from web page via sockets to phidget controller
exports.roverconnection_status = "rcs" // send phidget connection status back to sockets controller to send to web page
exports.rovervelocity_command = "rvc" // send velocity commands from web page via sockets to phidget controller
exports.roversteering_command = "rss" // send steering command from web page via sockets to phidgets controller
exports.roverthumbstick_command = "thumbstick" // thumbstick combined velocity/steering command
exports.errorreport = "errorrpt" // report an error from the phidget controller to send to web page
exports.telemetry = "telemetry" // for sensor and controller value reporting. Telemetry data is sent to the web page using "volatile", meaming they can be droped if the client is too busy
// motor definitions (DCMotor controllers)
motor0 = {
hubSerialNumber: 515870,
hubPort: 0
}
motor1 = {
hubSerialNumber: 515870,
hubPort: 1
}
motor2 = {
hubSerialNumber: 515870,
hubPort: 2
}
motor3 = {
hubSerialNumber: 515870,
hubPort: 3
}
motorLeftFront = Object.create(motor0)
motorLeftRear = Object.create(motor2);
motorRightFront = Object.create(motor1);
motorRightRear = Object.create(motor3);
// distance sensors
dist0 = {
hubSerialNumber: 515870,
hubPort: 4
}
dist1 = {
hubSerialNumber: 515870,
hubPort: 5
}
distanceFront = Object.create(dist0);
distanceRear = Object.create(dist1);
// telemetry object. This is for passing data back to the web page in a stream
class objTelemetry {
constructor(event, value, sourceName, sourceIndex){
this.event = event;
this.value = value;
this.sourceName = sourceName; // can be "DCMotor", "distanceSensor", "temperatureSensor"
this.sourceIndex = sourceIndex;// which controller or sensor sent the data value change
}
}
module.exports.objTelemetry = objTelemetry;