From d6492c1165407fcb7d232a176dc07830125c191d Mon Sep 17 00:00:00 2001 From: emdg05 Date: Tue, 13 Jul 2021 14:26:43 -0700 Subject: [PATCH 1/4] add testing documentation to readmes --- harmoni_actuators/harmoni_face/README.md | 3 +++ harmoni_actuators/harmoni_speaker/README.md | 2 ++ harmoni_actuators/harmoni_tts/README.md | 1 + harmoni_actuators/harmoni_web/README.md | 3 +++ harmoni_detectors/harmoni_face_detect/README.md | 2 ++ harmoni_dialogues/harmoni_bot/README.md | 3 +++ harmoni_sensors/harmoni_camera/README.md | 2 ++ harmoni_sensors/harmoni_microphone/README.md | 1 + 8 files changed, 17 insertions(+) diff --git a/harmoni_actuators/harmoni_face/README.md b/harmoni_actuators/harmoni_face/README.md index 455bac29..bbf52cae 100755 --- a/harmoni_actuators/harmoni_face/README.md +++ b/harmoni_actuators/harmoni_face/README.md @@ -11,6 +11,9 @@ We provide a fork of the face of [CoRDial](https://github.com/ndennler/cordial-p ## Parameters ## Testing +The face can be tested by running `rostest harmoni_face face.test`. + +The link for the face must be opened in a browser in order to pass the test. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_face.html) \ No newline at end of file diff --git a/harmoni_actuators/harmoni_speaker/README.md b/harmoni_actuators/harmoni_speaker/README.md index 9853a30f..67302ee6 100755 --- a/harmoni_actuators/harmoni_speaker/README.md +++ b/harmoni_actuators/harmoni_speaker/README.md @@ -29,5 +29,7 @@ Parameters input for the speaker service: ## Testing To test that the speaker has been configured properly, use the command ```roslaunch harmoni_speaker speaker_service.launch``` which will play a short phrase through the configured device. You may need to experiement with different values to ensure the proper speaker is set up. + +The speaker can also be tested by running `rostest harmoni_speaker speaker.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi in order to hear the audio clip be played. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_speaker.html) diff --git a/harmoni_actuators/harmoni_tts/README.md b/harmoni_actuators/harmoni_tts/README.md index b4c1ad70..3b068fcd 100644 --- a/harmoni_actuators/harmoni_tts/README.md +++ b/harmoni_actuators/harmoni_tts/README.md @@ -15,5 +15,6 @@ Parameters input for the aws polly service: |wav_heade_length | | | ## Testing +This package can be tested by running `rostest harmoni_tts polly.test`. Amazon Polly must be set up in order for this test to pass. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_tts.html) \ No newline at end of file diff --git a/harmoni_actuators/harmoni_web/README.md b/harmoni_actuators/harmoni_web/README.md index c3018314..a0b56e0a 100644 --- a/harmoni_actuators/harmoni_web/README.md +++ b/harmoni_actuators/harmoni_web/README.md @@ -11,5 +11,8 @@ Parameters input for the web service: | | | | ## Testing +This package can be tested by running `rostest harmoni_web web.test`. + +The link for the webpage must be opened and elements on the webpage clicked in order for the test to pass. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_web.html) \ No newline at end of file diff --git a/harmoni_detectors/harmoni_face_detect/README.md b/harmoni_detectors/harmoni_face_detect/README.md index 5b4bd9ed..b021f8e3 100644 --- a/harmoni_detectors/harmoni_face_detect/README.md +++ b/harmoni_detectors/harmoni_face_detect/README.md @@ -12,6 +12,8 @@ In the future, an easier workaround might be to just install under ROS Noetic or ## Parameters ## Testing +The face detector can be tested by running `rostest harmoni_face_detect face_detect.test` in the harmoni_face_detector container. + ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_face_detect.html) diff --git a/harmoni_dialogues/harmoni_bot/README.md b/harmoni_dialogues/harmoni_bot/README.md index 00d242fe..9e536d91 100644 --- a/harmoni_dialogues/harmoni_bot/README.md +++ b/harmoni_dialogues/harmoni_bot/README.md @@ -15,5 +15,8 @@ Parameters input for the aws lex service: |region_name | | | ## Testing +This package can be tested by running `rostest harmoni_bot lex.test`. + +Amazon Lex should be set up in order for this test to pass. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_bot.html) \ No newline at end of file diff --git a/harmoni_sensors/harmoni_camera/README.md b/harmoni_sensors/harmoni_camera/README.md index ee700d9b..66f2a4da 100755 --- a/harmoni_sensors/harmoni_camera/README.md +++ b/harmoni_sensors/harmoni_camera/README.md @@ -5,5 +5,7 @@ The harmoni_camera package provides a simple wrapper around the camera for publi ## Usage ## Parameters ## Testing +The camera can be tested by running `rostest harmoni_camera camera.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. + ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_camera.html) \ No newline at end of file diff --git a/harmoni_sensors/harmoni_microphone/README.md b/harmoni_sensors/harmoni_microphone/README.md index 4eb0b58d..badf118f 100755 --- a/harmoni_sensors/harmoni_microphone/README.md +++ b/harmoni_sensors/harmoni_microphone/README.md @@ -14,5 +14,6 @@ Parameters input for the microphone service: ## Testing +The microphone can be tested by running `rostest harmoni_microphone microphone.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_microphone.html) \ No newline at end of file From ff49916d833800906ddca09277cf086b3d75f3e6 Mon Sep 17 00:00:00 2001 From: emdg05 Date: Mon, 26 Jul 2021 12:44:50 -0700 Subject: [PATCH 2/4] readmes updated --- harmoni_actuators/harmoni_face/README.md | 8 +++++-- harmoni_actuators/harmoni_tts/README.md | 2 +- harmoni_actuators/harmoni_web/README.md | 4 +--- harmoni_dialogues/harmoni_bot/README.md | 4 +--- .../test/rostest_microphone.py | 23 ++++++++++++++++++- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/harmoni_actuators/harmoni_face/README.md b/harmoni_actuators/harmoni_face/README.md index bbf52cae..79835c20 100755 --- a/harmoni_actuators/harmoni_face/README.md +++ b/harmoni_actuators/harmoni_face/README.md @@ -11,9 +11,13 @@ We provide a fork of the face of [CoRDial](https://github.com/ndennler/cordial-p ## Parameters ## Testing -The face can be tested by running `rostest harmoni_face face.test`. +The face can be tested by running `rostest harmoni_face face.test`. Once this command is run, the top of the output in the terminal will read +``` +Starting up http-server, serving ./ +Available on: +``` +and then three links will be underneath. The second link must be opened in a browser in order for the test to pass. The webpage should display an animation of the QT's face. This test checks if the face is properly displayed and will fail if the link is not opened or the face is not properly displayed. -The link for the face must be opened in a browser in order to pass the test. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_face.html) \ No newline at end of file diff --git a/harmoni_actuators/harmoni_tts/README.md b/harmoni_actuators/harmoni_tts/README.md index 3b068fcd..a4ac0adc 100644 --- a/harmoni_actuators/harmoni_tts/README.md +++ b/harmoni_actuators/harmoni_tts/README.md @@ -15,6 +15,6 @@ Parameters input for the aws polly service: |wav_heade_length | | | ## Testing -This package can be tested by running `rostest harmoni_tts polly.test`. Amazon Polly must be set up in order for this test to pass. +This package can be tested by running `rostest harmoni_tts polly.test`. Amazon Polly must be set up in order for this test to pass. This test sends a request to connect to AWS services and will fail if the request does not succeed. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_tts.html) \ No newline at end of file diff --git a/harmoni_actuators/harmoni_web/README.md b/harmoni_actuators/harmoni_web/README.md index a0b56e0a..8f502ed6 100644 --- a/harmoni_actuators/harmoni_web/README.md +++ b/harmoni_actuators/harmoni_web/README.md @@ -11,8 +11,6 @@ Parameters input for the web service: | | | | ## Testing -This package can be tested by running `rostest harmoni_web web.test`. - -The link for the webpage must be opened and elements on the webpage clicked in order for the test to pass. +This package can be tested by running `rostest harmoni_web web.test`. After the command is run, a link for the webpage will be printed in the terminal output. The link for the webpage must be opened and elements on the webpage clicked in order for the test to pass. This test checks that the webpage can be displayed and detect user input correctly. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_web.html) \ No newline at end of file diff --git a/harmoni_dialogues/harmoni_bot/README.md b/harmoni_dialogues/harmoni_bot/README.md index 9e536d91..2b1db743 100644 --- a/harmoni_dialogues/harmoni_bot/README.md +++ b/harmoni_dialogues/harmoni_bot/README.md @@ -15,8 +15,6 @@ Parameters input for the aws lex service: |region_name | | | ## Testing -This package can be tested by running `rostest harmoni_bot lex.test`. - -Amazon Lex should be set up in order for this test to pass. +This package can be tested by running `rostest harmoni_bot lex.test`. Amazon Lex should be set up in order for this test to pass. This test sends a request to the real API server and stores the response. The test will fail if the request does not succeed. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_bot.html) \ No newline at end of file diff --git a/harmoni_sensors/harmoni_microphone/test/rostest_microphone.py b/harmoni_sensors/harmoni_microphone/test/rostest_microphone.py index ea622767..6d2e4e84 100755 --- a/harmoni_sensors/harmoni_microphone/test/rostest_microphone.py +++ b/harmoni_sensors/harmoni_microphone/test/rostest_microphone.py @@ -14,6 +14,8 @@ from collections import deque import os, io import ast +import numpy as np +import wave class TestMicrophone(unittest.TestCase): @@ -96,8 +98,27 @@ def test_recording(self): # TODO use microphone service recording functionality # either through an import ant test or may add optional data # which specifies recording - pass + rospy.loginfo(f"Start recording to {self.file_path}") + self.mic_sub = rospy.Subscriber( + self.microphone_topic, + AudioData, + self._record_audio_data_callback, + queue_size=1, + ) + + def _record_audio_data_callback(self, data): + data = np.fromstring(data.data, np.uint8) + if self.first_audio_frame: + self.wf = wave.open(self.file_path, "wb") + self.wf.setnchannels(self.total_channels) + self.wf.setsampwidth(self.p.get_sample_size(self.audio_format)) + self.wf.setframerate(self.audio_rate) + self.wf.setnframes(self.chunk_size) + self.wf.writeframes(b"".join(data)) + self.first_audio_frame = False + else: + self.wf.writeframes(b"".join(data)) def main(): import rostest From 9177be25d14ae5892b5799ac2270230bb8ce37aa Mon Sep 17 00:00:00 2001 From: emdg05 Date: Mon, 2 Aug 2021 11:50:38 -0700 Subject: [PATCH 3/4] add extra information --- harmoni_actuators/harmoni_gesture/README.md | 2 +- harmoni_actuators/harmoni_speaker/README.md | 2 +- harmoni_actuators/harmoni_tts/README.md | 2 +- harmoni_core/harmoni_pattern/README.md | 1 + harmoni_sensors/harmoni_camera/README.md | 2 +- harmoni_sensors/harmoni_microphone/README.md | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/harmoni_actuators/harmoni_gesture/README.md b/harmoni_actuators/harmoni_gesture/README.md index d31a9453..cc87015f 100755 --- a/harmoni_actuators/harmoni_gesture/README.md +++ b/harmoni_actuators/harmoni_gesture/README.md @@ -6,7 +6,7 @@ ## Testing -To test that the gesture has been configured properly, use the command ```rostest harmoni_gesture gesture.test``` which will play a short phrase through the configured device. +To test that the gesture has been configured properly, use the command ```rostest harmoni_gesture gesture.test``` which will play a short phrase through the configured device. This test checks that the joints can be properly controlled to run through gestures. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_gesture.html) \ No newline at end of file diff --git a/harmoni_actuators/harmoni_speaker/README.md b/harmoni_actuators/harmoni_speaker/README.md index 67302ee6..f10b5472 100755 --- a/harmoni_actuators/harmoni_speaker/README.md +++ b/harmoni_actuators/harmoni_speaker/README.md @@ -30,6 +30,6 @@ Parameters input for the speaker service: To test that the speaker has been configured properly, use the command ```roslaunch harmoni_speaker speaker_service.launch``` which will play a short phrase through the configured device. You may need to experiement with different values to ensure the proper speaker is set up. -The speaker can also be tested by running `rostest harmoni_speaker speaker.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi in order to hear the audio clip be played. +The speaker can also be tested by running `rostest harmoni_speaker speaker.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi in order to hear the audio clip be played. This test checks that audio can be successfully played through QT's speaker and will fail if the speaker is not set up or configured properly. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_speaker.html) diff --git a/harmoni_actuators/harmoni_tts/README.md b/harmoni_actuators/harmoni_tts/README.md index a4ac0adc..f04f4331 100644 --- a/harmoni_actuators/harmoni_tts/README.md +++ b/harmoni_actuators/harmoni_tts/README.md @@ -15,6 +15,6 @@ Parameters input for the aws polly service: |wav_heade_length | | | ## Testing -This package can be tested by running `rostest harmoni_tts polly.test`. Amazon Polly must be set up in order for this test to pass. This test sends a request to connect to AWS services and will fail if the request does not succeed. +This package can be tested by running `rostest harmoni_tts polly.test`. Amazon Polly must be set up in order for this test to pass. This test sends a request to connect to AWS services and will fail if the request does not succeed. It also sends text to the server to check that the text to speech services are working properly. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_tts.html) \ No newline at end of file diff --git a/harmoni_core/harmoni_pattern/README.md b/harmoni_core/harmoni_pattern/README.md index 25037922..5a8f7efc 100644 --- a/harmoni_core/harmoni_pattern/README.md +++ b/harmoni_core/harmoni_pattern/README.md @@ -5,5 +5,6 @@ Control and running of behavior patterns ## Usage ## Parameters ## Testing +This test checks that the QT can run through various patterns of services in different orders. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_pattern.html) \ No newline at end of file diff --git a/harmoni_sensors/harmoni_camera/README.md b/harmoni_sensors/harmoni_camera/README.md index 66f2a4da..abf8b440 100755 --- a/harmoni_sensors/harmoni_camera/README.md +++ b/harmoni_sensors/harmoni_camera/README.md @@ -5,7 +5,7 @@ The harmoni_camera package provides a simple wrapper around the camera for publi ## Usage ## Parameters ## Testing -The camera can be tested by running `rostest harmoni_camera camera.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. +The camera can be tested by running `rostest harmoni_camera camera.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. This test checks that the camera can record images and will fail if the camera has not been properly set up or configured. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_camera.html) \ No newline at end of file diff --git a/harmoni_sensors/harmoni_microphone/README.md b/harmoni_sensors/harmoni_microphone/README.md index badf118f..4aa3520e 100755 --- a/harmoni_sensors/harmoni_microphone/README.md +++ b/harmoni_sensors/harmoni_microphone/README.md @@ -14,6 +14,6 @@ Parameters input for the microphone service: ## Testing -The microphone can be tested by running `rostest harmoni_microphone microphone.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. +The microphone can be tested by running `rostest harmoni_microphone microphone.test`. When being tested on a QT robot, this must be run on the QT's Raspberry Pi. This test checks that the microphone can record audio and will fail if the microphone has not been correctly set up or configured. ## References [Documentation](https://harmoni.readthedocs.io/en/latest/packages/harmoni_microphone.html) \ No newline at end of file From 3e4d17664c775bf005893505d1e9acc92d833f28 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Aug 2021 20:14:45 -0700 Subject: [PATCH 4/4] Ignore TTS --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e5c2e6d5..b21ce3d6 100644 --- a/.gitignore +++ b/.gitignore @@ -122,3 +122,5 @@ harmoni_actuators/harmoni_tts/content/* doc/_build harmoni_actuators/harmoni_tts/scale_stats.npy harmoni_actuators/harmoni_tts/temp_data/tts.wav + +harmoni_actuators/harmoni_tts/TTS/