以在线命令词识别为例:
链接:http://www.xfyun.cn/sdk/dispatcher
1、下载SDK,解压;
2、在ROS工作空间下创建一个Package;
catkin_create_pkg xfei_asr roscpp rospy std_msgs
3、将SDK文件夹中的头文件,即下载的SDK文件夹中include文件夹下的 .h文件拷贝至xfei_asr/include/下;
4、将SDK文件夹中sample/asr_sample中的asr_sample.c文件拷贝至xfei_asr/src/下;
5、将SDK文件夹中libs/x64/libmsc.so文件拷贝至xfei_asr/lib/下; 没有的话自己新建一个lib文件夹
6、打开CMakelist,
1)修改include_directories为:即包括拷贝的头文件所在的include目录
include_directories(
${catkin_INCLUDE_DIRS}
include
)
2)添加:
add_executable(asr_sample src/asr_sample.c) # 生成可执行文件
target_link_libraries(asr_sample ${catkin_LIBRARIES} /home/cam/catkin_ws/src/xfei_asr/lib/libmsc.so -ldl -pthread) # 添加链接库,其中动态链接库路径按实际修改
编译链接成功
时间: 2024-10-24 16:48:49