Public Member Functions | Public Attributes | List of all members
mycroft.enclosure.api.EnclosureAPI Class Reference

Public Member Functions

def __init__ (self, bus, name="")
 
def activate_mouth_events (self)
 
def deactivate_mouth_events (self)
 
def eyes_blink (self, side)
 
def eyes_brightness (self, level=30)
 
def eyes_color (self, r=255, g=255, b=255)
 
def eyes_fill (self, percentage)
 
def eyes_look (self, side)
 
def eyes_narrow (self)
 
def eyes_off (self)
 
def eyes_on (self)
 
def eyes_reset (self)
 
def eyes_setpixel (self, idx, r=255, g=255, b=255)
 
def eyes_spin (self)
 
def eyes_timed_spin (self, length)
 
def eyes_volume (self, volume)
 
def mouth_display (self, img_code="", x=0, y=0, refresh=True)
 
def mouth_display_png (self, image_absolute_path, invert=False, x=0, y=0, refresh=True)
 
def mouth_listen (self)
 
def mouth_reset (self)
 
def mouth_smile (self)
 
def mouth_talk (self)
 
def mouth_text (self, text="")
 
def mouth_think (self)
 
def mouth_viseme (self, start, viseme_pairs)
 
def register (self, skill_name="")
 
def reset (self)
 
def system_blink (self, times)
 
def system_mute (self)
 
def system_reset (self)
 
def system_unmute (self)
 
def weather_display (self, img_code, temp)
 

Public Attributes

 bus
 
 display_manager
 
 name
 

Detailed Description

This API is intended to be used to interface with the hardware
that is running Mycroft.  It exposes all possible commands which
can be sent to a Mycroft enclosure implementation.

Different enclosure implementations may implement this differently
and/or may ignore certain API calls completely.  For example,
the eyes_color() API might be ignore on a Mycroft that uses simple
LEDs which only turn on/off, or not at all on an implementation
where there is no face at all.

Definition at line 26 of file api.py.

Constructor & Destructor Documentation

def mycroft.enclosure.api.EnclosureAPI.__init__ (   self,
  bus,
  name = "" 
)

Definition at line 39 of file api.py.

Member Function Documentation

def mycroft.enclosure.api.EnclosureAPI.activate_mouth_events (   self)
Enable movement of the mouth with speech

Definition at line 291 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.deactivate_mouth_events (   self)
Disable movement of the mouth with speech

Definition at line 295 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_blink (   self,
  side 
)
Make the eyes blink
Args:
    side (str): 'r', 'l', or 'b' for 'right', 'left' or 'both'

Definition at line 87 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_brightness (   self,
  level = 30 
)
Set the brightness of the eyes in the display.
Args:
    level (int): 1-30, bigger numbers being brighter

Definition at line 143 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_color (   self,
  r = 255,
  g = 255,
  b = 255 
)
Change the eye color to the given RGB color
Args:
    r (int): 0-255, red value
    g (int): 0-255, green value
    b (int): 0-255, blue value

Definition at line 109 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_fill (   self,
  percentage 
)
Use the eyes as a type of progress meter
Args:
    amount (int): 0-49 fills the right eye, 50-100 also covers left

Definition at line 132 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_look (   self,
  side 
)
Make the eyes look to the given side
Args:
    side (str): 'r' for right
        'l' for left
        'u' for up
        'd' for down
        'c' for crossed

Definition at line 98 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_narrow (   self)
Make the eyes look narrow, like a squint

Definition at line 94 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_off (   self)
Turn off or hide the eyes.

Definition at line 83 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_on (   self)
Illuminate or show the eyes.

Definition at line 79 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_reset (   self)
Restore the eyes to their default (ready) state.

Definition at line 150 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_setpixel (   self,
  idx,
  r = 255,
  g = 255,
  b = 255 
)
Set individual pixels of the Mark 1 neopixel eyes
Args:
    idx (int): 0-11 for the right eye, 12-23 for the left
    r (int): The red value to apply
    g (int): The green value to apply
    b (int): The blue value to apply

Definition at line 119 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_spin (   self)
Make the eyes 'roll'

Definition at line 154 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_timed_spin (   self,
  length 
)
Make the eyes 'roll' for the given time.
Args:
    length (int): duration in milliseconds of roll, None = forever

Definition at line 159 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.eyes_volume (   self,
  volume 
)
Indicate the volume using the eyes
Args:
    volume (int): 0 to 11

Definition at line 167 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_display (   self,
  img_code = "",
  x = 0,
  y = 0,
  refresh = True 
)
Display images on faceplate. Currently supports images up to 16x8,
   or half the face. You can use the 'x' parameter to cover the other
   half of the faceplate.
Args:
    img_code (str): text string that encodes a black and white image
    x (int): x offset for image
    y (int): y offset for image
    refresh (bool): specify whether to clear the faceplate before
            displaying the new image or not.
            Useful if you'd like to display multiple images
            on the faceplate at once.

Definition at line 230 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_display_png (   self,
  image_absolute_path,
  invert = False,
  x = 0,
  y = 0,
  refresh = True 
)
Send an image to the enclosure.

Args:
    image_absolute_path (string): The absolute path of the image
    invert (bool): inverts the image being drawn.
    x (int): x offset for image
    y (int): y offset for image
    refresh (bool): specify whether to clear the faceplate before
            displaying the new image or not.
            Useful if you'd like to display muliple images
            on the faceplate at once.

Definition at line 251 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_listen (   self)
Show a 'thinking' image or animation

Definition at line 192 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_reset (   self)
Restore the mouth display to normal (blank)

Definition at line 177 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_smile (   self)
Show a 'smile' image or animation

Definition at line 197 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_talk (   self)
Show a generic 'talking' animation for non-synched speech

Definition at line 182 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_text (   self,
  text = "" 
)
Display text (scrolling as needed)
Args:
    text (str): text string to display

Definition at line 222 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_think (   self)
Show a 'thinking' image or animation

Definition at line 187 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.mouth_viseme (   self,
  start,
  viseme_pairs 
)
Send mouth visemes as a list in a single message.

    Arguments:
start (int):    Timestamp for start of speech
viseme_pairs:   Pairs of viseme id and cumulative end times
                (code, end time)

                codes:
                 0 = shape for sounds like 'y' or 'aa'
                 1 = shape for sounds like 'aw'
                 2 = shape for sounds like 'uh' or 'r'
                 3 = shape for sounds like 'th' or 'sh'
                 4 = neutral shape for no sound
                 5 = shape for sounds like 'f' or 'v'
                 6 = shape for sounds like 'oy' or 'ao'

Definition at line 202 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.register (   self,
  skill_name = "" 
)
Registers a skill as active. Used for speak() and speak_dialog()
to 'patch' a previous implementation. Somewhat hacky.

Definition at line 44 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.reset (   self)
The enclosure should restore itself to a started state.
Typically this would be represented by the eyes being 'open'
and the mouth reset to its default (smile or blank).

Definition at line 53 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.system_blink (   self,
  times 
)
The 'eyes' should blink the given number of times.
Args:
    times (int): number of times to blink

Definition at line 72 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.system_mute (   self)
Mute (turn off) the system speaker.

Definition at line 64 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.system_reset (   self)
The enclosure hardware should reset any CPUs, etc.

Definition at line 60 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.system_unmute (   self)
Unmute (turn on) the system speaker.

Definition at line 68 of file api.py.

def mycroft.enclosure.api.EnclosureAPI.weather_display (   self,
  img_code,
  temp 
)
Show a the temperature and a weather icon

Args:
    img_code (char): one of the following icon codes
         0 = sunny
         1 = partly cloudy
         2 = cloudy
         3 = light rain
         4 = raining
         5 = stormy
         6 = snowing
         7 = wind/mist
    temp (int): the temperature (either C or F, not indicated)

Definition at line 272 of file api.py.

Member Data Documentation

mycroft.enclosure.api.EnclosureAPI.bus

Definition at line 40 of file api.py.

mycroft.enclosure.api.EnclosureAPI.display_manager

Definition at line 42 of file api.py.

mycroft.enclosure.api.EnclosureAPI.name

Definition at line 41 of file api.py.


The documentation for this class was generated from the following file:


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40