Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ pip install ovos-skill-mark1-ctrl
* "look up and down"
* "reset enclosure"

* "narrow your eyes"
* "spin your eyes"
* "blink your eyes"
* "narrow eyes"
* "spin eyes"
* "blink"
* "blink left"

* "smile animation"
* "listen animation"
Expand Down
72 changes: 23 additions & 49 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import random

Check failure on line 1 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (N999)

__init__.py:1:1: N999 Invalid module name: 'ovos-skill-mark1-ctrl'
import time
from ast import literal_eval as parse_tuple
from ovos_color_parser import color_from_description, sRGBAColor
Expand All @@ -6,11 +6,10 @@
from ovos_utils.log import LOG
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.decorators import intent_handler
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.skills import OVOSSkill
from ovos_bus_client.message import Message

Check failure on line 10 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (F401)

__init__.py:10:37: F401 `ovos_bus_client.message.Message` imported but unused help: Remove unused import: `ovos_bus_client.message.Message`
from ovos_i2c_detection import is_mark_1
from threading import Thread

Check failure on line 12 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (F401)

__init__.py:12:23: F401 `threading.Thread` imported but unused help: Remove unused import: `threading.Thread`

Check failure on line 12 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (I001)

__init__.py:1:1: I001 Import block is un-sorted or un-formatted help: Organize imports


def _hex_to_rgb(_hex):
Expand All @@ -27,7 +26,7 @@
return None
(r, g, b) = int(_hex[0:2], 16), int(_hex[2:4], 16), int(_hex[4:6], 16)
return (r, g, b)
except Exception:

Check failure on line 29 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (BLE001)

__init__.py:29:12: BLE001 Do not catch blind exception: `Exception`
return None

class EnclosureControlSkill(OVOSSkill):
Expand Down Expand Up @@ -74,7 +73,7 @@
(self.enclosure.eyes_blink, None)]

anim = []
for i in range(0, 10):

Check failure on line 76 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (PIE808)

__init__.py:76:24: PIE808 Unnecessary `start` argument in `range` help: Remove `start` argument
frame = random.choice(choices)
anim.append(self.animate(i, 3, frame[0], frame[1]))
return anim
Expand Down Expand Up @@ -156,113 +155,88 @@
self.animations = animation
self.thread = create_daemon(self.run)

@intent_handler(IntentBuilder("EnclosureLookRight")
.require("look").require("right")
.optionally("enclosure"))
@intent_handler("look_right.intent")
def handle_look_right(self, message):
self.speak("looking right")
self.enclosure.eyes_look("r")

@intent_handler(IntentBuilder("EnclosureLookLeft")
.require("look").require("left").optionally("enclosure"))
@intent_handler("look_left.intent")
def handle_look_left(self, message):
self.speak("looking left")
self.enclosure.eyes_look("l")

@intent_handler(IntentBuilder("EnclosureLookUp")
.require("look").require("up").optionally("enclosure"))
@intent_handler("look_up.intent")
def handle_look_up(self, message):
self.speak("looking up")
self.enclosure.eyes_look("u")

@intent_handler(IntentBuilder("EnclosureLookDown")
.require("look").require("down").optionally("enclosure"))
@intent_handler("look_down.intent")
def handle_look_down(self, message):
self.speak("looking down")
self.enclosure.eyes_look("d")

@intent_handler(IntentBuilder("EnclosureLookUpDown")
.require("look").require("up")
.require("down").optionally("enclosure")
.optionally("animation"))
@intent_handler("look_up_down.intent")
def handle_look_up_down(self, message):
self.speak("up and down, up and down")
self.play_animation(self.up_down_animation)

@intent_handler(IntentBuilder("EnclosureLookLeftRight")
.require("look").require("right")
.require("left").optionally("enclosure")
.optionally("animation"))
@intent_handler("look_left_right.intent")
def handle_look_left_right(self, message):
self.speak("left and right, left and right")
self.play_animation(self.left_right_animation)

@intent_handler(IntentBuilder("EnclosureEyesBlink")
.require("blink")
.optionally("eyes").optionally("animation")
.optionally("enclosure").optionally("right")
.optionally("left"))
@intent_handler("blink.intent")
def handle_blink_eyes(self, message):
""" Blink the eyes, optionally in just one direction.

Args:
message (Message): carries an optional {direction} slot
("left"/"right"); absent means blink both eyes.
"""
direction = message.data.get("direction")
for i in range(0, 10):

Check failure on line 197 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (PIE808)

__init__.py:197:24: PIE808 Unnecessary `start` argument in `range` help: Remove `start` argument
if "right" in message.data:
if direction == "right":
self.enclosure.eyes_blink("r")
if "left" in message.data:
elif direction == "left":
self.enclosure.eyes_blink("l")
else:
self.enclosure.eyes_blink("b")
self.speak("so this is what it feels like having low F P S")

@intent_handler(IntentBuilder("EnclosureEyesSpin")
.require("spin")
.optionally("eyes").optionally("animation")
.optionally("enclosure"))
@intent_handler("spin.intent")
def handle_spin_eyes(self, message):
self.speak("around the world, here i go")
self.enclosure.eyes_spin()

@intent_handler(IntentBuilder("EnclosureEyesNarrow")
.require("narrow").require("eyes")
.optionally("enclosure"))
@intent_handler("narrow_eyes.intent")
def handle_narrow_eyes(self, message):
self.speak("this is my evil face")
self.enclosure.eyes_narrow()
self.enclosure.eyes_color(255, 0, 0)

@intent_handler(IntentBuilder("EnclosureReset")
.require("reset").require("enclosure"))
@intent_handler("reset.intent")
def handle_enclosure_reset(self, message):
self.handle_default_eyes()
self.enclosure.eyes_reset()
self.enclosure.mouth_reset()
self.speak("this was fun")

@intent_handler(IntentBuilder("EnclosureMouthSmile")
.require("smile")
.optionally("animation").optionally("mouth")
.optionally("enclosure"))
@intent_handler("smile.intent")
def handle_enclosure_smile(self, message):
self.enclosure.mouth_smile()
self.speak("i don't know how to smile")

@intent_handler(IntentBuilder("EnclosureMouthListen")
.require("listen")
.optionally("animation").optionally("mouth")
.optionally("enclosure"))
@intent_handler("listen.intent")
def handle_enclosure_listen(self, message):
self.speak("when i do this i feel like I'm dancing")
self.enclosure.mouth_listen()

@intent_handler(IntentBuilder("EnclosureMouthThink")
.require("think")
.optionally("animation").optionally("mouth")
.optionally("enclosure"))
@intent_handler("think.intent")
def handle_enclosure_think(self, message):
self.speak("i love thinking")
self.enclosure.mouth_think()

@intent_handler(IntentBuilder("EnclosureCrazyEyes")
.require("eyes").optionally("animation").require("crazy")
.optionally("enclosure"))
@intent_handler("crazy_eyes.intent")
def handle_enclosure_crazy_eyes(self, message):
self.speak("artificial intelligence performing artificial "
"stupidity, you don't see this every day")
Expand Down Expand Up @@ -291,7 +265,7 @@
self.settings['current_eye_color'] = [r, g, b]
if make_default:
self.settings['default_eye_color'] = [r, g, b]
except Exception:

Check failure on line 268 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (BLE001)

__init__.py:268:16: BLE001 Do not catch blind exception: `Exception`
self.log.debug('Bad color code: ' + str(color))
if speak:
self.speak_dialog('error_set_color')
Expand All @@ -303,7 +277,7 @@
def is_byte(utt):
try:
return 0 <= int(utt) <= 255
except Exception:

Check failure on line 280 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (BLE001)

__init__.py:280:20: BLE001 Do not catch blind exception: `Exception`
return False

self.speak_dialog('set_custom_color', wait=True)
Expand Down Expand Up @@ -369,8 +343,8 @@
return (color.r, color.g, color.b)
else:
return None
except Exception:
pass

Check failure on line 347 in __init__.py

View workflow job for this annotation

GitHub Actions / lint / lint

ruff (S110)

__init__.py:346:9: S110 `try`-`except`-`pass` detected, consider logging the exception

# check if rgb tuple like '(0,0,128)'
try:
Expand Down
1 change: 1 addition & 0 deletions locale/en-US/blink.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blink [{direction}] [<eyes>] [<animation>] [<enclosure>]
1 change: 0 additions & 1 deletion locale/en-US/blink.voc

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-US/crazy.voc

This file was deleted.

1 change: 1 addition & 0 deletions locale/en-US/crazy_eyes.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crazy <eyes> [<animation>] [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/direction.entity
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
right
left
1 change: 0 additions & 1 deletion locale/en-US/down.voc

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-US/left.voc

This file was deleted.

1 change: 1 addition & 0 deletions locale/en-US/listen.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<listen> [<animation>] [mouth] [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_down.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> down [<enclosure>]
down <look> [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_left.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> left [<enclosure>]
left <look> [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_left_right.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> left [and] right [<animation>] [<enclosure>]
left right <look> [<animation>] [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_right.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> right [<enclosure>]
right <look> [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_up.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> up [<enclosure>]
up <look> [<enclosure>]
2 changes: 2 additions & 0 deletions locale/en-US/look_up_down.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<look> up [and] down [<animation>] [<enclosure>]
down up <look> [<animation>] [<enclosure>]
1 change: 0 additions & 1 deletion locale/en-US/mouth.voc

This file was deleted.

4 changes: 0 additions & 4 deletions locale/en-US/mute.voc

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-US/narrow.voc

This file was deleted.

2 changes: 2 additions & 0 deletions locale/en-US/narrow_eyes.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
narrow [<eyes>] [<enclosure>]
<eyes> narrow [<enclosure>]
1 change: 0 additions & 1 deletion locale/en-US/perform.voc

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-US/reboot.voc

This file was deleted.

2 changes: 2 additions & 0 deletions locale/en-US/reset.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<reset> [<enclosure>]
<enclosure> <reset>
1 change: 0 additions & 1 deletion locale/en-US/right.voc

This file was deleted.

1 change: 1 addition & 0 deletions locale/en-US/smile.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<smile> [<animation>] [mouth] [<enclosure>]
1 change: 1 addition & 0 deletions locale/en-US/spin.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<spin> [<eyes>] [<enclosure>]
2 changes: 0 additions & 2 deletions locale/en-US/system.voc

This file was deleted.

1 change: 1 addition & 0 deletions locale/en-US/think.intent
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<think> [<animation>] [mouth] [<enclosure>]
3 changes: 0 additions & 3 deletions locale/en-US/unmute.voc

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-US/up.voc

This file was deleted.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ ovos_skill_mark1_ctrl = [
"locale/*/*.intent",
"locale/*/*.dialog",
"locale/*/*.voc",
"locale/*/*.entity",
]
Loading
Loading