You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.6 KiB

2 years ago
  1. ## ReSpeaker Microphone Array
  2. For this tutorial, we will go over on a high level how to use Stretch's [ReSpeaker Mic Array v2.0](https://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/).
  3. <p align="center">
  4. <img src="https://raw.githubusercontent.com/hello-robot/stretch_tutorials/main/images/respeaker.jpg"/>
  5. </p>
  6. ### Stretch Body Package
  7. In this tutorial's section we will use command line tools in the [Stretch_Body](https://github.com/hello-robot/stretch_body) package, a low level Python API for Stretch's hardware, to directly interact with the ReSpeaker.
  8. Begin by typing the following command in a new terminal.
  9. ```bash
  10. stretch_respeaker_test.py
  11. ```
  12. The following will be displayed in your terminal
  13. ```bash
  14. hello-robot@stretch-re1-1005:~$ stretch_respeaker_test.py
  15. For use with S T R E T C H (TM) RESEARCH EDITION from Hello Robot Inc.
  16. * waiting for audio...
  17. * recording 3 seconds
  18. * done
  19. * playing audio
  20. * done
  21. ```
  22. The ReSpeaker Mico Array will wait until it hears audio loud enough to trigger its recording feature. Stretch will record audio for 3 seconds and then replay it through its speakers. This command line is a good method to see if the hardware is working correctly.
  23. To stop the python script, type **Ctrl** + **c** in the terminal.
  24. ### ReSpeaker_ROS Package
  25. A [ROS package for the ReSpeaker](https://index.ros.org/p/respeaker_ros/#melodic) is utilized for this tutorial's section.
  26. Begin by running the `sample_respeaker.launch` file in a terminal.
  27. ```bash
  28. # Terminal 1
  29. roslaunch respeaker_ros sample_respeaker.launch
  30. ```
  31. This will bring up the necessary nodes that will allow the ReSpeaker to implement a voice and sound interface with the robot.
  32. Below are executables you can run and see the ReSpeaker results.
  33. ```bash
  34. rostopic echo /sound_direction # Result of Direction (in Radians) of Audio
  35. rostopic echo /sound_localization # Result of Direction as Pose (Quaternion values)
  36. rostopic echo /is_speeching # Result of Voice Activity Detector
  37. rostopic echo /audio # Raw audio data
  38. rostopic echo /speech_audio # Raw audio data when there is speech
  39. rostopic echo /speech_to_text # Voice recognition
  40. ```
  41. An example is when you run the `speech_to_text` executable and speak near the microphone array. In this instance, "hello robot" was said.
  42. ```bash
  43. # Terminal 2
  44. hello-robot@stretch-re1-1005:~$ rostopic echo /speech_to_text
  45. transcript:
  46. - hello robot
  47. confidence: []
  48. ---
  49. ```
  50. You can also set various parameters via`dynamic_reconfigure` running the following command in a new terminal.
  51. ```bash
  52. # Terminal 3
  53. rosrun rqt_reconfigure rqt_reconfigure
  54. ```