This package provides capability to run the Text-To-Speech, Speech-To-Text and Skill functionality of Mycroft AI as ROS nodes providing topics, services and actions for communication.
The package makes use of the catkin_virtualenv library to run the Mycroft nodes within a seperate Python virtual environment
Install Python virtualenvironment
sudo apt install python3-venv
Install packaging using pip
python -m pip install packaging --user
Clone catkin_virtualenv into your workspace
cd workspace/src
git clone https://github.com/locusrobotics/catkin_virtualenv.git
cd catkin_virtualenv
git checkout 0.5.2
If you're using Python 3 you will need to edit the catkin_virtualenv/catkin_virtualenv/scripts/global_requirements
file of the catkin_virtualenv package by changing the line import Queue as Queue
at the top of the file to from queue import Queue
Install catkin_virtualenv using pip.
cd workspace/src/catkin_virtualenv/catkin_virtualenv/
python setup.py install
Install catkin_virtualenv
cd workspace
catkin_make install --only-pkg-with-deps catkin_virtualenv
Run the dev_setup.sh
./workspace/src/mycroft_ros/dev.setup.sh
Build mycroft_ros
catkin_make --only-pkg-with-deps mycroft_ros
Mycroft can be configured using either ~/.mycroft/mycroft.conf or /etc/mycroft/mycroft.conf
To launch all Mycroft nodes run mycroft.launch which will lanch the following nodes
roslaunch mycroft_ros mycroft.launch
mycroft/ask_yesno (mycroft_ros/GetResponse) - Reads dialog before recording and returning "yes" or "no" based on user response
ROS nodes that are to be used as MycroftSkill's should be placed within their own directory with relevent 'vocab', 'dialog' and 'regex' directories to use for intents and entities
The mycroft_ros Python module provides helper functions and classes for convenience such as the RosMycroftSkill which can be used to register a node as a MycroftSkill in the Mycroft SkillManager
class ExampleSkill(RosMycroftSkill):
def __init__(self):
super(ExampleSkill, self).__init__("/home/vagrant/dev/catkin_ws/src/mycroft_ros/scripts/example")
self.register_intent(IntentBuilder("MycroftRos").require("mycroft").require("ros"), self.example)
self.register_intent_file("mytest.intent", self.mytest)
if self.initialise():
rospy.loginfo("MycroftSkill created")
else:
rospy.loginfo("Error creating MycroftSkill")
def example(self, data):
rospy.loginfo("MycroftRos callback")
user_response = self.get_response(dialog="say something cool to me")
rospy.loginfo("Response: " + user_response)
def mytest(self, data):
rospy.loginfo("mytest callback")
rospy.loginfo("testentity: " + data.entities.get("testentity", ""))
if name == "main": rospy.init_node('mycroft_skill_test') example = ExampleSkill() rospy.spin() rospy.on_shutdown(example.shutdown)
## TODO
* add context to Skills
* add speak_dialog to Skills
* add events / repeating events to Skills
* error handling for skills