You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This makes it easier to see how to use sensors and other external things with RTCBot.
Also fixed a couple little bugs in closing data channels that are being used to send data.
Copy file name to clipboardExpand all lines: docs/installing.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,16 +22,16 @@ Then, you can complete the installation with pip::
22
22
23
23
sudo pip3 install rtcbot
24
24
25
+
.. warning::
26
+
You might need to reboot your Pi for RTCBot to work! If rtcbot freezes on import, it means that you need to start PulseAudio.
27
+
25
28
.. note::
26
29
It is recommended that you use the Pi 4 with RTCBot. While it was tested to work down to the Raspberry Pi 3B, it was observed to have
27
30
extra latency, since the CPU had difficulty keeping up with encoding the video stream while processing controller input.
28
31
This is because RTCBot currently cannot take advantage of the Pi's hardware acceleration,
29
32
meaning that all video encoding is done in software.
30
33
31
34
.. note::
32
-
You might need to reboot your Pi for RTCBot to work!
33
-
34
-
.. warning::
35
35
These instructions were made with reference to Raspbian Buster.
36
36
While the library *does* work on Raspbian Stretch,
37
37
you'll need to install aiohttp through pip, and avoid installing opencv.
@@ -50,8 +50,8 @@ Then, you can complete the installation with pip::
50
50
51
51
sudo pip3 install rtcbot
52
52
53
-
.. note::
54
-
You might need to reboot, or manually start pulseaudio if it was not previously installed.
53
+
.. warning::
54
+
You might need to reboot, or manually start PulseAudio if it was not previously installed. If RTCBot freezes on import, it means that PulseAudio is not running.
Copy file name to clipboardExpand all lines: examples/mobile/README.md
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ async def index(request):
125
125
</html>
126
126
""")
127
127
128
-
asyncdefcleanup(app):
128
+
asyncdefcleanup(app=None):
129
129
global ws
130
130
if ws isnotNone:
131
131
c = ws.close()
@@ -171,10 +171,9 @@ finally:
171
171
172
172
With these two pieces of code, you first start the server, then start the robot, and finally open `http://localhost:8080` in the browser to view a video stream coming directly from the robot, even if the robot has an unknown IP.
173
173
174
-
175
174
## rtcbot.dev
176
175
177
-
The above example requires you to have your own internet-accessible server at a known IP address to set up the connection, if your remote code is not on your local network. The server's only real purpose is to help *establish* a connection - once the connection is established, it does not do anything.
176
+
The above example requires you to have your own internet-accessible server at a known IP address to set up the connection, if your remote code is not on your local network. The server's only real purpose is to help _establish_ a connection - once the connection is established, it does not do anything.
178
177
179
178
For this reason, I am hosting a free testing server online at `https://rtcbot.dev` that performs the equivalent of the following operation from the above server code:
180
179
@@ -226,11 +225,12 @@ and the local browser's connection code becomes:
226
225
227
226
```js
228
227
let response =awaitfetch("https://rtcbot.dev/myRandomSequence11", {
229
-
method:"POST",
230
-
cache:"no-cache",
231
-
body:JSON.stringify(offer)
228
+
method:"POST",
229
+
cache:"no-cache",
230
+
body:JSON.stringify(offer),
232
231
});
233
232
```
233
+
234
234
With `rtcbot.dev`, you no longer need your local server code to run websockets or a connection service. Its only purpose is to give the browser the html and javascript necessary to establish a connection. We will get rid of the browser entirely in the next tutorial.
235
235
236
236
## If it doesn't work over 4G
@@ -255,6 +255,7 @@ There are two options through which to setup a TURN server: [coTURN](https://git
255
255
The Pion server is easy to set up on Windows,Mac and Linux - all you need to do is [download the executable](https://github.com/pion/turn/releases/tag/1.0.3), and run it from the command line as shown.
256
256
257
257
**Linux/Mac**:
258
+
258
259
```bash
259
260
chmod +x ./simple-turn-linux-amd64 # allow executing the downloaded file
260
261
export USERS='myusername=mypassword'
@@ -264,6 +265,7 @@ export UDP_PORT=3478
264
265
```
265
266
266
267
**Windows**: You can run the following from powershell:
268
+
267
269
```powershell
268
270
$env:USERS = "myusername=mypassword"
269
271
$env:REALM = "my.server.ip"
@@ -272,6 +274,7 @@ $env:UDP_PORT = 3478
272
274
```
273
275
274
276
With the Pion server running, you will need to let both Python and Javascript know about it when creating your `RTCConnection`:
@@ -296,6 +299,7 @@ var conn = new rtcbot.RTCConnection(true, {
296
299
Setting up a coTURN server takes a bit more work and is only supported on Linux and Mac. The following steps will assume a Linux system running Ubuntu.
297
300
298
301
Install coTURN and stop the coTURN service to modify config files with
302
+
299
303
```bash
300
304
sudo apt install coturn
301
305
sudo systemctl stop coturn
@@ -304,6 +308,7 @@ sudo systemctl stop coturn
304
308
Edit the file `/etc/default/coturn` by uncommenting the line `TURNSERVER_ENABLED=1`. This will allow coTURN to start in daemon mode on boot.
305
309
306
310
Edit another file `/etc/turnserver.conf` and add the following lines. Be sure to put your system's public facing IP address in place of `<PUBLIC_NETWORK_IP>`, your domain name in place of `<DOMAIN>`, and your own credentials in place of `<USERNAME>` and `<PASSWORD>`.
311
+
307
312
```
308
313
listening-port=3478
309
314
tls-listening-port=5349
@@ -323,13 +328,15 @@ lt-cred-mech
323
328
```
324
329
325
330
Restart the coTURN service, check that it's running, and reboot.
331
+
326
332
```bash
327
333
sudo systemctl start coturn
328
334
sudo systemctl status coturn
329
335
sudo reboot
330
336
```
331
337
332
338
With the coTURN server running, you will need to let both Python and Javascript know about it when creating your `RTCConnection`:
Copy file name to clipboardExpand all lines: examples/offloading/README.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,7 @@ and an average desktop.
5
5
6
6
The ideal situation would be if you could strap an entire desktop to your robot. With RTCBot, we can do the next best thing: we can stream the robot's inputs to a desktop, which can then perform computation, and send back commands.
7
7
8
-
In this tutorial, we will go back to a single file for both server and robot for simplicitly. The tutorial is split into two parts. In the first part, we set up a connection to the robot from Python, allowing you to control the robot with an xbox controller without a browser.
9
-
10
-
The second part of the tutorial adds a neural network into the mix, which tries to imitate the xbox controller's controls.
8
+
In this tutorial, we will go back to a single file for both server and robot for simplicitly. We set up a connection to the robot from Python, allowing you to control the robot with an xbox controller without a browser.
0 commit comments