The mycroft_ros package
- Maintainer status: maintained
- Maintainer: Ieuan Jones <ieuanj28 AT googlemail DOT com>
- License: Apache 2.0
- Source: git https://github.com/injones/mycroft_ros.git (branch: devel)
- ROS Nodes
Clone the repo into src
cd ~/catkin_ws/src git clone https://github.com/injones/mycroft_ros.git
The dev_setup.sh can be used to install dependencies and configure the package for use.
Mycroft can be configured using either ~/.mycroft/mycroft.conf or /etc/mycroft/mycroft.conf
Follow the steps below to run the package.
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.
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)
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.
mycroft_message_busCreates the MessageBus WebSocket used for communication between Mycroft source code
mycroft_ttsManages the Text-To-Speech engine used by Mycroft
Subscribed Topicsmycroft/speak (std_msgs/String)
- String for Mycroft TTS to read
- Signal to Mycroft to stop the TTS from speaking
mycroft_sttManages the Speech-To-Text engine used by Mycroft
Published Topicsmycroft/speech (mycroft_ros/Speech)
- Publish list of Strings received from Mycroft STT engine
mycroft_skillsConfigures and manages the Skill Manager
Action Resultget_response (mycroft/GetResponseResult)
- Returns user response as a String
- Returns the String "yes" or "no" based on user response
Subscribed Topicsmycroft/utterance (std_msgs/String)
- String to pass directly to the intent service of the Skill Manager
- Path of skill to remove from Skill Manager as a String
Published Topicsmycroft/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.
- Creates and registers a new Mycroft Skill within the Skill Manager