安装ros baidu speech包 :
1、在 ros工作空间下 git clone https://github.com/DinnerHowe/baidu_speech.git
2、cd 工作空间
3、catkin_make
4、安装依赖pyaudio 、python-vlc
sudo apt-get install python-pyaudio (sudo pip install pyaudio)
sudo pip install python-vlc
5、更新包
source ~/catkin_ws/devel/setup.bash
rospack profile
rospack find TestRosNode
6、运行roslaunch baidu_speech simple_voice.launch
报错ImportError: No module named requests
解决:
Requests is not a built in module, so you will have to download it. You can get it here:https://pypi.python.org/pypi/requests
$ sudo pip install requests
报错
requests.exceptions.InvalidHeader:Value for header{Content-length:37523} must be of type str or bytes, not <type 'int'>
解决
voice_node.py修改
- HTTP_HEADER= { 'Content-Type': 'audio/%s;rate=%s'%(self.FORMAT,self.SAMPLING_RATE),
- 'Content-length': len(json.dumps(RegData))}
- #改为
- HTTP_HEADER= { 'Content-Type': 'audio/%s;rate=%s'%(self.FORMAT,self.SAMPLING_RATE),
- 'Content-length': str(len(json.dumps(RegData)))}
百度语音注册账号 http://yuyin.baidu.com/ 获取REG_USER_ID REG_Api_Key REG_Secrect_Key。