Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add testing documentation to readmes #91

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
7 changes: 7 additions & 0 deletions harmoni_actuators/harmoni_face/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ Parameters input for the nose service are:


## Testing
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.


For testing the service you have to run:

Expand Down
3 changes: 1 addition & 2 deletions harmoni_actuators/harmoni_gesture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ Parameters input for the gesture service corresponds the the $ROBOT_param which

## 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.
This testing works for the simulator on kinetic.
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.

TODO:
- Testing to perform on the real robot
Expand Down
2 changes: 2 additions & 0 deletions harmoni_actuators/harmoni_speaker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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)
3 changes: 1 addition & 2 deletions harmoni_actuators/harmoni_tts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Parameters input for the local TTS service:
|sample_rate | | |

## Testing

The local test will save a wav file of the speech specified in the tts.test test_tts_input parameter in the temp_data directory.
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)

Expand Down
1 change: 1 addition & 0 deletions harmoni_actuators/harmoni_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Parameters input for the web service:
| | | |

## Testing
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)
1 change: 1 addition & 0 deletions harmoni_core/harmoni_pattern/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions harmoni_detectors/harmoni_face_detect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions harmoni_dialogues/harmoni_bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +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 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)
2 changes: 2 additions & 0 deletions harmoni_sensors/harmoni_camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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)
1 change: 1 addition & 0 deletions harmoni_sensors/harmoni_microphone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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)
23 changes: 22 additions & 1 deletion harmoni_sensors/harmoni_microphone/test/rostest_microphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from collections import deque
import os, io
import ast
import numpy as np
import wave


class TestMicrophone(unittest.TestCase):
Expand Down Expand Up @@ -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
Expand Down