ROS与语音交互教程-ROS下安装并测试pocketsphinx功能包
ROS与语音交互教程-ROS下安装并测试pocketsphinx功能包
说明:
- 介绍如何在ROS下安装并测试pocketsphinx功能包
步骤:
- 安装依赖 ros-kinetic-audio-common
sudo apt-get install ros-kinetic-audio-common
- 安装依赖 libasound2
sudo apt-get install libasound2
- 安装依赖 libgstreamer0.10
sudo apt-get install gstreamer0.10-*
- 安装依赖 python-gst0.10
sudo apt-get install python-gst0.10
- 安装 libsphinxbase1_0.8-6(点击下载)
sudo dpkg -i libsphinxbase1_0.8-6_amd64.deb
- 安装libpocketsphinx1_0.8-5(点击下载)
sudo dpkg -i libpocketsphinx1_0.8-5_amd64.deb
- 安装gstreamer0.10-pocketsphinx(点击下载)
sudo dpkg -i gstreamer0.10-pocketsphinx_0.8-5_amd64.deb
- 进入工作空间目录,下载pocketsphinx功能包的源码,编译功能包
cd ~/catkin_ws/src
git clone https://github.com/mikeferguson/pocketsphinx
cd ~/catkin_ws/
catkin_make
- 下载英文语音包pocketsphinx-hmm-en-tidigits_0.8-5(点击下载)
sudo dpkg -i pocketsphinx-hmm-en-tidigits_0.8-5_all.deb
- 在pocketsphinx包里创建一个model目录,存放解压的语音模型文件
cd ~/dev/catkin_ws/src/pocketsphinx
mkdir model
sudo cp /usr/share/pocketsphinx/model/* ~/catkin_ws/src/pocketsphinx/model -r
- 修改recognizer.py
cd ~/catkin_ws/src/pocketsphinx/nodes
vim recognizer.py
注释掉self.asr.set_property('configured', True)
添加lm,dict,hmm支持英语识别(如果是其他语言可以改为别的路径)
self.asr.set_property('lm', '/usr/share/pocketsphinx/model/lm/en/tidigits.DMP')
self.asr.set_property('dict', '/usr/share/pocketsphinx/model/lm/en/tidigits.dic')
self.asr.set_property('hmm', '/usr/share/pocketsphinx/model/hmm/en/tidigits')
- 测试pocketsphinx的语音识别功能
roslaunch pocketsphinx robocup.launch
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号