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.

74 lines
2.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. ## ReSpeaker Microphone Array
  2. For this tutorial, we will get a high-level view of 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/noetic/images/respeaker.jpg"/>
  5. </p>
  6. ### Stretch Body Package
  7. In this 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 .shell-prompt}
  10. stretch_respeaker_test.py
  11. ```
  12. The following will be displayed in your terminal:
  13. ```{.bash .no-copy}
  14. For use with S T R E T C H (TM) RESEARCH EDITION from Hello Robot Inc.
  15. * waiting for audio...
  16. * recording 3 seconds
  17. * done
  18. * playing audio
  19. * done
  20. ```
  21. 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.
  22. To stop the python script, type `Ctrl` + `c` in the terminal.
  23. ### ReSpeaker_ROS Package
  24. A [ROS package for the ReSpeaker](https://index.ros.org/p/respeaker_ros/#melodic) is utilized for this section.
  25. Begin by running the `sample_respeaker.launch` file in a terminal.
  26. ```{.bash .shell-prompt}
  27. roslaunch respeaker_ros sample_respeaker.launch
  28. ```
  29. This will bring up the necessary nodes that will allow the ReSpeaker to implement a voice and sound interface with the robot.
  30. Below are executables you can run to see the ReSpeaker results.
  31. ```{.bash .shell-prompt}
  32. rostopic echo /sound_direction # Result of Direction (in Radians) of Audio
  33. rostopic echo /sound_localization # Result of Direction as Pose (Quaternion values)
  34. rostopic echo /is_speeching # Result of Voice Activity Detector
  35. rostopic echo /audio # Raw audio data
  36. rostopic echo /speech_audio # Raw audio data when there is speech
  37. rostopic echo /speech_to_text # Voice recognition
  38. ```
  39. An example is when you run the `speech_to_text` executable and speak near the microphone array. In a new terminal, execute:
  40. ```{.bash .shell-prompt}
  41. rostopic echo /speech_to_text
  42. ```
  43. In this instance, "hello robot" was said. The following will be displayed in your terminal:
  44. ```{.bash .no-copy}
  45. transcript:
  46. - hello robot
  47. confidence: []
  48. ---
  49. ```
  50. You can also set various parameters via `dynamic_reconfigure` by running the following command in a new terminal.
  51. ```{.bash .shell-prompt}
  52. rosrun rqt_reconfigure rqt_reconfigure
  53. ```