luxai-qtrobot / QA

Virtual repository for Questions & Answers system
http://luxai-qtrobot.github.io
5 stars 0 forks source link

Audio/play #38

Open dsafaei69 opened 4 years ago

dsafaei69 commented 4 years ago

Dear Luxai experts,

I am trying to play audio which is located inside my laptop on QT but I have issues in giving the path in both python scripts and calling rostopic. Could you please help me? the path of my mp3 file is: /home/chili/catkin_ws/src/iReCHeCk_repo/scripts/QT/fileQTs.mp3

I have tried the following commands in the scripts: data_folder = Path("home/chili/catkin_ws/src/iReCHeCk_repo/scripts/") file_to_open = data_folder/"fileQT.mp3" f = open (file_to_open) audioPlay_pub.publish('f') or myfile = open('/home/chili/catkin_ws/src/iReCHeCk_repo/scripts/QT/fileQTs.mp3') myaudio=myfile.read() audioPlay_pub.publish('myaudio') or audioPlay_pub.publish('/home/chili/catkin_ws/src/iReCHeCk_repo/scripts/QT/fileQTs.mp3')

and in the terminal I tried:

rostopic pub /qt_robot/audio/play std_msgs/String "data: '/home/chili/catkin_ws/src/iReCHeCk_repo/scripts/QT/fileQTs.mp3' "

Best Regards Dorsa Safaei