Skip to content

Commit 4f5bacf

Browse files
committed
Version 0.1
1 parent 0f2fb00 commit 4f5bacf

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

examples/basics/README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The `camera.subscribe` function allows you to subscribe to video frames incoming
9494
firing the `onFrame` function 30 times a second with [numpy](https://en.wikipedia.org/wiki/NumPy) arrays containing BGR images captured by the camera.
9595
The `put_nowait` function is then used to send the frame to the window where the image is displayed.
9696

97-
These two functions form the core of RTCBot's abilities. Every producer of data (like `CVCamera`) has a `subscribe()` method, and every consumer of data (like `CVDisplay`) has a `put_nowait` method to insert data.
97+
These two functions are part of RTCBot's core abilities. Every producer of data (like `CVCamera`) has a `subscribe()` method, and every consumer of data (like `CVDisplay`) has a `put_nowait` method to insert data.
9898

9999
```eval_rst
100100
.. note::
@@ -108,19 +108,25 @@ These two functions form the core of RTCBot's abilities. Every producer of data
108108

109109
## Subscriptions
110110

111-
In RTCBot, a subscription is any object with a `put_nowait` method, and a `get` coroutine:
111+
Using a callback function with the `subscribe` method is not the only way to
112+
get data out of a data-producing object. The `subscribe` method is also able
113+
to create what is called a `subscription`.
114+
115+
To understand subscriptions, let's take a quick detour to python Queues:
112116

113117
```python
114118
import asyncio
115119

116-
# An asyncio Queue is a subscription
120+
# An asyncio Queue has put_nowait and get coroutine
117121
q = asyncio.Queue()
118122

123+
# Sends data each second
119124
async def sender():
120125
while True:
121126
await asyncio.sleep(1)
122127
q.put_nowait("hi!")
123128

129+
# Receives the data
124130
async def receiver():
125131
while True:
126132
data = await q.get()
@@ -131,10 +137,9 @@ asyncio.ensure_future(receiver())
131137
asyncio.get_event_loop().run_forever()
132138
```
133139

134-
Here, the `sender` function sends data, and the `receiver` awaits for incoming data, and prints it.
140+
Here, the `sender` function sends data, and the `receiver` awaits for incoming data, and prints it. Notice how the queue had a `get` coroutine from which data could be awaited.
135141

136-
In the example where we viewed a video feed, `subscribe` was used as a decorator for a callback function.
137-
This is just a small part of the actual power of the `subscribe` method. When run without an argument, it actually returns a subscription, which `CVCamera` automatically keeps updated with new video frames as they come in:
142+
We can use the `subscribe` method in a similar way to the above code snippet. When run without an argument, `subscribe` actually returns a subscription, which `CVCamera` automatically keeps updated with new video frames as they come in:
138143

139144
```python
140145
import asyncio
@@ -200,7 +205,7 @@ finally:
200205

201206
## Generalizing to Audio
202207

203-
The above code examples created a video stream, and displayed it in a window. RTCBot uses _exactly the same_ API for **everything**. This means that we can trivially add audio to the previous example:
208+
The above code examples all created a video stream, and displayed it in a window. RTCBot uses _exactly the same_ API for **everything**. This means that we can trivially add audio to the previous example:
204209

205210
```python
206211
import asyncio
@@ -223,7 +228,7 @@ finally:
223228
speaker.close()
224229
```
225230

226-
With this example, a video stream should be displayed in a window, and all microphone input should be playing in your headphones (or speakers).
231+
Here, a video stream should be displayed in a window, and all microphone input should be playing in your headphones (or speakers).
227232

228233
## Summary
229234

examples/offloading/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,3 @@ Control message: {'timestamp': 1553379217.004892, 'code': 'ABS_X', 'state': -125
131131
The output for the `Gamepad` object is currently different in Javascript and in Python. Make sure you don't mix them up!
132132
```
133133

134-
## Machine Learning a Controller
135-
136-
This portion of the tutorial focuses on modifying the desktop code from the previous portion to include
137-
a neural network which is trained exploiting the computational power available on a desktop PC.
138-
139-
This is an _advanced_ topic, requiring a working knowledge of machine learning basics. It is also assumed
140-
that you are using linux on your desktop, and that you have an nvidia graphics card compatible with [pytorch](https://pytorch.org). If you choose to attempt this part on a windows desktop or on a mac, be aware that you might run into some problems that might require some googling skills to solve.
141-
142-
### Under Construction...

examples/remotecontrol/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ key press {'value': -0.8708761930465698, 'type': 'axis2'}
214214
key press {'value': -0.7945494055747986, 'type': 'axis2'}
215215
```
216216

217-
The controller's buttons give boolean values, and the joysticks give float values between -1 and 1. By default, the controller is polled at 10Hz as not to overwhelm an embedded computer like the Pi with tons of data each time a joystick is moved.
217+
The controller's buttons give boolean values, and the joysticks give float values between -1 and 1. By default, the controller is polled at 10Hz as not to overwhelm a Pi 3 with tons of data each time a joystick is moved.
218218

219219
## Remote Control
220220

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rtcbot",
3-
"version": "0.0.9",
3+
"version": "0.1.0",
44
"description": "",
55
"main": "dist/rtcbot.cjs.js",
66
"module": "dist/rtcbot.esm.js",

rtcbot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
from .devices import *
1111

1212

13-
__version__="0.0.9"
13+
__version__="0.1.0"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# This call to setup() does all the work
1111
setuptools.setup(
1212
name="rtcbot",
13-
version="0.0.9",
13+
version="0.1.0",
1414
description="An asyncio-focused library for webrtc robot control",
1515
long_description=README,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)