Skip to content

Commit 8e5a0c5

Browse files
committed
Clean up example for test
1 parent dada438 commit 8e5a0c5

File tree

1 file changed

+0
-362
lines changed

1 file changed

+0
-362
lines changed

examples/introduction.ipynb

Lines changed: 0 additions & 362 deletions
Original file line numberDiff line numberDiff line change
@@ -52,368 +52,6 @@
5252
"w.connect(\"192.168.1.115\", port=\"80\")"
5353
]
5454
},
55-
{
56-
"cell_type": "markdown",
57-
"metadata": {},
58-
"source": [
59-
"### Call services"
60-
]
61-
},
62-
{
63-
"cell_type": "code",
64-
"execution_count": null,
65-
"metadata": {
66-
"tags": []
67-
},
68-
"outputs": [],
69-
"source": [
70-
"w"
71-
]
72-
},
73-
{
74-
"cell_type": "code",
75-
"execution_count": null,
76-
"metadata": {
77-
"tags": []
78-
},
79-
"outputs": [],
80-
"source": [
81-
"tts = w.service(\"ALTextToSpeech\")"
82-
]
83-
},
84-
{
85-
"cell_type": "code",
86-
"execution_count": null,
87-
"metadata": {},
88-
"outputs": [],
89-
"source": [
90-
"tts.say(\"how is it going?\")"
91-
]
92-
},
93-
{
94-
"cell_type": "code",
95-
"execution_count": null,
96-
"metadata": {
97-
"tags": []
98-
},
99-
"outputs": [],
100-
"source": [
101-
"eyes = w.service(\"ALLeds\")"
102-
]
103-
},
104-
{
105-
"cell_type": "code",
106-
"execution_count": null,
107-
"metadata": {
108-
"tags": []
109-
},
110-
"outputs": [],
111-
"source": [
112-
"eyes.rasta(3)"
113-
]
114-
},
115-
{
116-
"cell_type": "markdown",
117-
"metadata": {},
118-
"source": [
119-
"### Retrieve data from the robot\n",
120-
"Prefix method names with `async_` to be able to wait for returns"
121-
]
122-
},
123-
{
124-
"cell_type": "code",
125-
"execution_count": null,
126-
"metadata": {
127-
"tags": []
128-
},
129-
"outputs": [],
130-
"source": [
131-
"w"
132-
]
133-
},
134-
{
135-
"cell_type": "code",
136-
"execution_count": null,
137-
"metadata": {
138-
"tags": []
139-
},
140-
"outputs": [],
141-
"source": [
142-
"motion = w.service(\"ALMotion\")"
143-
]
144-
},
145-
{
146-
"cell_type": "code",
147-
"execution_count": null,
148-
"metadata": {
149-
"tags": []
150-
},
151-
"outputs": [],
152-
"source": [
153-
"robot_summary = asyncio.ensure_future(motion.async_getSummary())"
154-
]
155-
},
156-
{
157-
"cell_type": "code",
158-
"execution_count": null,
159-
"metadata": {
160-
"tags": []
161-
},
162-
"outputs": [],
163-
"source": [
164-
"print(robot_summary.result())"
165-
]
166-
},
167-
{
168-
"cell_type": "code",
169-
"execution_count": null,
170-
"metadata": {
171-
"tags": []
172-
},
173-
"outputs": [],
174-
"source": [
175-
"motion.wakeUp()"
176-
]
177-
},
178-
{
179-
"cell_type": "code",
180-
"execution_count": null,
181-
"metadata": {
182-
"tags": []
183-
},
184-
"outputs": [],
185-
"source": [
186-
"motion.rest()"
187-
]
188-
},
189-
{
190-
"cell_type": "code",
191-
"execution_count": null,
192-
"metadata": {
193-
"tags": []
194-
},
195-
"outputs": [],
196-
"source": [
197-
"w"
198-
]
199-
},
200-
{
201-
"cell_type": "code",
202-
"execution_count": null,
203-
"metadata": {
204-
"tags": []
205-
},
206-
"outputs": [],
207-
"source": [
208-
"posture = w.service(\"ALRobotPosture\")"
209-
]
210-
},
211-
{
212-
"cell_type": "code",
213-
"execution_count": null,
214-
"metadata": {
215-
"tags": []
216-
},
217-
"outputs": [],
218-
"source": [
219-
"posture.goToPosture(\"StandInit\", 0.5)"
220-
]
221-
},
222-
{
223-
"cell_type": "code",
224-
"execution_count": null,
225-
"metadata": {
226-
"tags": []
227-
},
228-
"outputs": [],
229-
"source": [
230-
"motion.rest()"
231-
]
232-
},
233-
{
234-
"cell_type": "markdown",
235-
"metadata": {
236-
"tags": []
237-
},
238-
"source": [
239-
"All events occur at the same time"
240-
]
241-
},
242-
{
243-
"cell_type": "code",
244-
"execution_count": null,
245-
"metadata": {
246-
"tags": []
247-
},
248-
"outputs": [],
249-
"source": [
250-
"eyes.fade(\"AllLedsBlue\", 1.0, 2)\n",
251-
"eyes.fade(\"AllLedsRed\", 1.0, 2)\n",
252-
"eyes.fade(\"AllLedsGreen\", 0, 2)"
253-
]
254-
},
255-
{
256-
"cell_type": "markdown",
257-
"metadata": {},
258-
"source": [
259-
"### Camera images"
260-
]
261-
},
262-
{
263-
"cell_type": "code",
264-
"execution_count": null,
265-
"metadata": {
266-
"tags": []
267-
},
268-
"outputs": [],
269-
"source": [
270-
"w"
271-
]
272-
},
273-
{
274-
"cell_type": "code",
275-
"execution_count": null,
276-
"metadata": {
277-
"tags": []
278-
},
279-
"outputs": [],
280-
"source": [
281-
"vid = w.service(\"ALVideoDevice\")"
282-
]
283-
},
284-
{
285-
"cell_type": "code",
286-
"execution_count": null,
287-
"metadata": {
288-
"tags": []
289-
},
290-
"outputs": [],
291-
"source": [
292-
"resolution = 0\n",
293-
"color_space = 11\n",
294-
"fps = 20\n",
295-
"sub_ID = \"jupy\"\n",
296-
"\n",
297-
"cam_sub = asyncio.ensure_future(vid.async_subscribeCamera(sub_ID, 0, resolution, color_space, fps))"
298-
]
299-
},
300-
{
301-
"cell_type": "code",
302-
"execution_count": null,
303-
"metadata": {
304-
"tags": []
305-
},
306-
"outputs": [],
307-
"source": [
308-
"sub_name = cam_sub.result()\n",
309-
"print(sub_name)"
310-
]
311-
},
312-
{
313-
"cell_type": "code",
314-
"execution_count": null,
315-
"metadata": {
316-
"tags": []
317-
},
318-
"outputs": [],
319-
"source": [
320-
"img_future = asyncio.ensure_future(vid.async_getImageRemote(sub_name))"
321-
]
322-
},
323-
{
324-
"cell_type": "code",
325-
"execution_count": null,
326-
"metadata": {
327-
"tags": []
328-
},
329-
"outputs": [],
330-
"source": [
331-
"img = img_future.result()"
332-
]
333-
},
334-
{
335-
"cell_type": "code",
336-
"execution_count": null,
337-
"metadata": {
338-
"tags": []
339-
},
340-
"outputs": [],
341-
"source": [
342-
"from PIL import Image, ImageOps\n",
343-
"\n",
344-
"wid, hei = img[:2]\n",
345-
"shape = img[:3]\n",
346-
"image_data = img[6]\n",
347-
"pil_img = Image.frombytes('RGB',(wid, hei), bytes(image_data))\n",
348-
"pil_img = ImageOps.mirror(pil_img)"
349-
]
350-
},
351-
{
352-
"cell_type": "code",
353-
"execution_count": null,
354-
"metadata": {
355-
"tags": []
356-
},
357-
"outputs": [],
358-
"source": [
359-
"display(pil_img)"
360-
]
361-
},
362-
{
363-
"cell_type": "markdown",
364-
"metadata": {},
365-
"source": [
366-
"### Awaiting tasks"
367-
]
368-
},
369-
{
370-
"cell_type": "code",
371-
"execution_count": null,
372-
"metadata": {
373-
"tags": []
374-
},
375-
"outputs": [],
376-
"source": [
377-
"w"
378-
]
379-
},
380-
{
381-
"cell_type": "code",
382-
"execution_count": null,
383-
"metadata": {
384-
"tags": []
385-
},
386-
"outputs": [],
387-
"source": [
388-
"animate = w.service(\"ALAnimationPlayer\")"
389-
]
390-
},
391-
{
392-
"cell_type": "code",
393-
"execution_count": null,
394-
"metadata": {
395-
"tags": []
396-
},
397-
"outputs": [],
398-
"source": [
399-
"async def little_dance():\n",
400-
" await motion.async_wakeUp()\n",
401-
" await animate.async_run(\"animations/Stand/Gestures/Hey_3\")\n",
402-
" await animate.async_run(\"animations/Stand/Gestures/No_3\")\n",
403-
" await motion.async_rest()"
404-
]
405-
},
406-
{
407-
"cell_type": "code",
408-
"execution_count": null,
409-
"metadata": {
410-
"tags": []
411-
},
412-
"outputs": [],
413-
"source": [
414-
"asyncio.ensure_future(little_dance())"
415-
]
416-
},
41755
{
41856
"cell_type": "code",
41957
"execution_count": null,

0 commit comments

Comments
 (0)