# Mic Array紀錄 上面的python都要改成python3 https://wiki.seeedstudio.com/cn/ReSpeaker_Mic_Array_v2.0/#_8 然後這網站很雷不要用 用這個 http://www.playrobot.com/robotpress/archives/5466 https://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/ ## 步驟 ``` catkin_create_pkg doa rospy std_msgs //資料夾名稱不能大寫 ``` 然後把Reaspeaker的usb_4_mic_array程式下載下來 ``` git clone https://github.com/respeaker/usb_4_mic_array.git ``` 在~/catkin_ws/src/doa/src裡面創建一個doa.py ``` //append括弧裡面改成usb_4_mic_array那個資料夾的位置 import sys sys.path.append('/home/ubuntu/catkin_ws/src/doa/src') from tuning import Tuning import rospy import usb.core import usb.util import time from std_msgs.msg import UInt16 dev = usb.core.find(idVendor=0x2886, idProduct=0x0018) def sound_position(): rospy.init_node('sound_position', anonymous=True) sound_position_puber = rospy.Publisher('/sound_position', UInt16, queue_size=10) rate = rospy.Rate(10) while not rospy.is_shutdown(): if dev: Mic_tuning = Tuning(dev) rospy.loginfo(Mic_tuning.direction) sound_position_puber.publish(Mic_tuning.direction) if __name__ == '__main__': try: sound_position() except rospy.ROSInterruptException: pass ``` 然後把檔案的權限改成可讀寫 如果用cmd可以 ``` sudo chmod 777 doa.py ``` 這樣rosrun doa doa.py應該就能跑了 螢幕會輸出目前的角度