Only released in EOL distros:  

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)
  • String for Mycroft TTS to read
mycroft/stop (std_msgs/String)
  • Signal to Mycroft to stop the TTS from speaking

mycroft_stt

Manages the Speech-To-Text engine used by Mycroft

Published Topics

mycroft/speech (mycroft_ros/Speech)
  • Publish list of Strings received from Mycroft STT engine

mycroft_skills

Configures and manages the Skill Manager

Action Result

get_response (mycroft/GetResponseResult)
  • Returns user response as a String
ask_yesno (mycroft/GetResponseResult)
  • Returns the String "yes" or "no" based on user response

Subscribed Topics

mycroft/utterance (std_msgs/String)
  • String to pass directly to the intent service of the Skill Manager
mycroft/remove_skill (std_msgs/String)
  • Path of skill to remove from Skill Manager as a String

Published Topics

mycroft/skill_id (mycroft/IntentResponse)
  • Returns intent name that was matched based on user speech, the user's utterance as a String, the entities belonging to the intent to the topic 'mycroft/skill_id' where 'skill_id' is the ID of the Mycroft Skill that the matched intent belongs to.

Services

mycroft/register_skill (mycroft_ros/MycroftSkill)
  • Creates and registers a new Mycroft Skill within the Skill Manager

Wiki: mycroft_ros (last edited 2019-07-20 17:54:43 by IeuanJones)