This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample.py
68 lines (49 loc) · 2.19 KB
/
sample.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Sample script
"""
import pytemi as temi
import time
# parameters
MQTT_HOST = "test.mosquitto.org"
MQTT_PORT = 1883
TEMI_SERIAL = "01234567890"
# connect to the MQTT broker
mqtt_client = temi.connect(MQTT_HOST, MQTT_PORT)
# create robot object
robot = temi.Robot(mqtt_client, TEMI_SERIAL)
# --------------------------------------------------------------
# TEXT-TO-SPEECH COMMANDS
# --------------------------------------------------------------
robot.tts("Hello World!") # command the robot to speak
time.sleep(1) # wait some time for action to complete
# --------------------------------------------------------------
# WAYPOINT COMMANDS
# --------------------------------------------------------------
robot.goto("entrance") # command the robot to go to a saved location
time.sleep(3) # wait some time for action to complete
# --------------------------------------------------------------
# MOVE COMMANDS
# --------------------------------------------------------------
robot.tilt(+45) # tilt the robot's head (absolute angle)
time.sleep(3) # wait some time for action to complete
robot.tilt(-15) # tilt the robot's head (absolute angle)
time.sleep(3) # wait some time for action to complete
robot.tilt_by(+30) # tilt the robot's head (relative angle)
time.sleep(3) # wait some time for action to complete
robot.tilt_by(-10) # tilt the robot's head (relative angle)
time.sleep(3) # wait some time for action to complete
robot.rotate(90) # rotate the robot (relative angle)
time.sleep(5) # wait some time for action to complete
robot.rotate(-30) # rotate the robot (relative angle)
time.sleep(5) # wait some time for action to complete
# --------------------------------------------------------------
# MEDIA COMMANDS
# --------------------------------------------------------------
robot.video(
"https://roboteam-assets.s3.eu-central-1.amazonaws.com/ui/skills/tutorials/videos/intorducing+temi.mp4"
) # play online video by passing a URL; make sure video is optimized for the web (this sample video is not)
time.sleep(30) # wait some time for action to complete
# show webview by passing a URL
robot.webview("https://www.google.com/")
time.sleep(5)