Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from hapi-robo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
r-oung authored Sep 9, 2021
2 parents 8d413e2 + 3e11113 commit 5fb2d00
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions pytemi/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
"""temi Robot Class
"""
import math
import json
Expand Down Expand Up @@ -77,13 +76,13 @@ def rotate(self, angle):

self.client.publish(topic, payload, qos=0)

def translate(self, value):
"""Translate"""
def joystick(self, x, y):
"""Joystick"""
if not self.silent:
print("[CMD] Translate: {} [unitless]".format(value))
print("[CMD] Translate: {} {} [unitless]".format(x, y))

topic = "temi/" + self.id + "/command/move/joystick"
payload = json.dumps({"x": value, "y": 0})
payload = json.dumps({"x": x, "y": y})

self.client.publish(topic, payload, qos=0)

Expand Down Expand Up @@ -145,17 +144,6 @@ def tts(self, text):

self.client.publish(topic, payload, qos=1)

# def audio(self, url):
# """Play audio

# """
# print("[CMD] Play Audio: {}".format(url))

# topic = "temi/" + self.id + "/command/media/audio"
# payload = json.dumps({"url": url})

# self.client.publish(topic, payload, qos=1)

def video(self, url):
"""Play video"""
if not self.silent:
Expand All @@ -166,18 +154,6 @@ def video(self, url):

self.client.publish(topic, payload, qos=1)

# def youtube(self, video_id):
# """Play YouTube

# """
# if not self.silent:
# print("[CMD] Play YouTube: {}".format(video_id))

# topic = "temi/" + self.id + "/command/media/youtube"
# payload = json.dumps({"video_id": video_id})

# self.client.publish(topic, payload, qos=1)

def webview(self, url):
"""Show webview"""
if not self.silent:
Expand All @@ -188,6 +164,16 @@ def webview(self, url):

self.client.publish(topic, payload, qos=1)

def custom(self, topic, data):
"""Send custom message"""
if not self.silent:
print("[CMD] Custom")

topic = "temi/" + self.id + topic
payload = json.dumps(data)

self.client.publish(topic, payload, qos=1)

@property
def locations(self):
"""Return a list of locations"""
Expand Down

0 comments on commit 5fb2d00

Please sign in to comment.