[Documentation] [TitleIndex] [WordIndex

Package Summary

The mycroft_ros package

Overview

This package provides capability to run the Text-To-Speech, Speech-To-Text and Skill functionality of Mycroft AI as ROS nodes allowing any node to be configured as a Mycroft Skill

Installation

Clone the repo into src

cd ~/catkin_ws/src
git clone https://github.com/injones/mycroft_ros.git 

Install dependencies

The dev_setup.sh can be used to install dependencies and configure the package for use.

Mycroft setup

Mycroft can be configured using either ~/.mycroft/mycroft.conf or /etc/mycroft/mycroft.conf

Usage

Follow the steps below to run the package.

Launching nodes

To launch all Mycroft nodes run the following

roslaunch mycroft_ros mycroft.launch 

Creating Mycroft Skills from ROS nodes

ROS nodes that are used as MycroftSkill's should be placed within their own directory under your packages scripts directory with any relevent vocab, dialog and regex directories which should contain required intent and entity files.

Using the RosMycroftSkill

The mycroft_ros Python module provides helper functions and classes for convenience such as the 'RosMycroftSkill' class which can be used to register nodes as Mycroft Skills within the Skill Manager of Mycroft.

Example skill

   1 class ExampleSkill(RosMycroftSkill):
   2 
   3     def __init__(self):
   4         super(ExampleSkill, self).__init__("/path/to/directory/")
   5         self.register_intent(IntentBuilder("MycroftRos").require("mycroft").require("ros"), self.example)
   6         self.register_intent_file("mytest.intent", self.mytest)
   7         if self.initialise():
   8             rospy.loginfo("MycroftSkill created")
   9         else:
  10             rospy.loginfo("Error creating MycroftSkill")
  11 
  12     def example(self, data):
  13         rospy.loginfo("MycroftRos callback")
  14         user_response = self.get_response(dialog="say something cool to me")
  15         rospy.loginfo("Response: " + user_response)
  16 
  17     def mytest(self, data):
  18         rospy.loginfo("mytest callback")
  19         rospy.loginfo("testentity: " + data.entities.get("testentity", ""))
  20 
  21 if __name__ == "__main__":
  22     rospy.init_node('mycroft_skill_test')
  23     example = ExampleSkill()
  24     rospy.spin()
  25     rospy.on_shutdown(example.shutdown)

catkin_virtualenv

This package makes use of the 'catkin_virtualenv' ROS package to run the mycroft_message_bus, mycroft_tts, mycroft_stt and mycroft_skills nodes in a seperate Python virtual environment.

ROS Nodes

mycroft_message_bus

Creates the MessageBus WebSocket used for communication between Mycroft source code

mycroft_tts

Manages the Text-To-Speech engine used by Mycroft

Subscribed Topics

mycroft/speak (std_msgs/String) mycroft/stop (std_msgs/String)

mycroft_stt

Manages the Speech-To-Text engine used by Mycroft

Published Topics

mycroft/speech (mycroft_ros/Speech)

mycroft_skills

Configures and manages the Skill Manager

Action Result

get_response (mycroft/GetResponseResult) ask_yesno (mycroft/GetResponseResult)

Subscribed Topics

mycroft/utterance (std_msgs/String) mycroft/remove_skill (std_msgs/String)

Published Topics

mycroft/skill_id (mycroft/IntentResponse)

Services

mycroft/register_skill (mycroft_ros/MycroftSkill)


2019-12-07 12:51