Robots can connect to basketball manager software over WiFi using WebSocket protocol. Messages use JSON format.
Parameter |
Type |
Description |
signal |
String constant |
|
targets |
String array |
List of Robot IDs. |
baskets |
String array |
List of basket colors. First item is the basket, in which the first target/robot should throw the balls. Second item is the basket for the second robot and so on. |
Examples
Start signal. First robot (Io
) should throw into magenta
basket and second robot (001TRT
) into blue
basket.
{
"signal": "start",
"targets": ["Io", "001TRT"],
"baskets": ["magenta", "blue"]
}
-
Install node.js
Version 14+ should work. Newer versions (18+) are recommended.
Newer versions for Ubuntu: https://github.com/nodesource/distributions/blob/master/README.md#rpminstall
-
Install dependencies
In
server
directory runnpm i
.
-
In
server
directory runnode manual-command-server.mjs
. -
In robot’s code create WebSocket client that connects to
-
localhost:8222
, if the server and robot’s code is on the same computer; -
<server computer IP address>:8222
, if the server and robot’s code are on different computers. Make sure that server and robot are in the same network.
-
-
Open
localhost:8220
or<server computer IP address>:8220
in the web browser to send start and stop commands.