Tester Programs
The following scripts are available for a developer to rapidly test and debug different components of new Boston Dynamics API services. Specifically, while writing a new service, these tests can be run to check for networking errors in the setup of the service, integration with the robot’s api, and the expected functionality of the service is complete and correct. The tester programs will display the specific test cases being run, execute the test cases, and any warnings or errors that occur.
Currently, there are testing programs for DataAcquisitionPluginService and ImageService services, as well as general testing helpers that could be used for debugging other services being developed as well.
Setup Dependencies
This example requires the Spot SDK to be installed, and must be run using python3. Using pip, these dependencies can be installed using:
python3 -m pip install -r requirements.txt
Note, these dependencies are only for running the tester programs. The specific service examples will likely have different dependencies that
Testing an Image Service
The image service tester script (image_service_tester.py
) can be used while developing a new image service to help ensure that the service can be communicated with and behaves as expected.
Note: check that the camera is powered on, connected, and can be communicated with before running the tester program. This program is to help debug issues with the image service, and not the physical camera hardware.
To use the image service tester script, first create a new guid, a new secret, and register a payload.
export GUID=$(python3 -c 'import uuid; print(uuid.uuid4())')
export SECRET=$(python3 -c 'import uuid; print(uuid.uuid4())')
python3 -m bosdyn.client {ROBOT_IP} payload register --payload-name {PAYLOAD_NAME} --payload-guid $GUID --payload-secret $SECRET
then authorize the payload in Spot’s admin console. Next, get your self-ip:
python3 -m bosdyn.client {ROBOT_IP} self-ip
Next, run your new image service.
python3 your_new_image_service.py --host-ip {SELF_IP} --guid $GUID --secret $SECRET {ROBOT_IP}
Finally, open a new terminal and run image_service_tester.py
python3 image_service_tester.py {ROBOT_IP} --service-name {SERVICE_NAME}
Arguments
The command line argument --service-name
is the name for the image service that is used for directory registration. In the example image services (e.g. the web cam example, the ricoh theta example), the service name is defined near the top of each plugin file by the variable DIRECTORY_NAME
.
Many of the images collected during the test will be saved to a directory, which can be specified through the command line argument --destination-folder
and defaults to the current working directory.
The --verbose
command line argument can be provided, which will allow for even more debug information (e.g. complete RPC requests and responses, extra information about the failure and error messages) to be displayed to the command line when tests run and fail.
Lastly, the robot’s data acquisition should automatically integrate any directory-registered image services with the data acquisition capabilities. The command line argument --check-data-acquisition
can be provided to run an additional test for all image sources available in the image service that will check that the source is listed in the data acquisition capabilities and can be successfully acquired from the data acquisition service.
Testing a Data Acquisition Plugin
The plugin tester script (plugin_tester.py) can be used while developing a new data acquisition plugin service to help ensure that the service can be communicated with and behaves as expected.
To use the data acquisition plugin service tester script, first create a new guid, a new secret, and register a payload.
export GUID=$(python3 -c 'import uuid; print(uuid.uuid4())')
export SECRET=$(python3 -c 'import uuid; print(uuid.uuid4())')
python3 -m bosdyn.client {ROBOT_IP} payload register --payload-name {PAYLOAD_NAME} --payload-guid $GUID --payload-secret $SECRET
then authorize the payload in Spot’s admin console. Next, get your self-ip:
python3 -m bosdyn.client {ROBOT_IP} self-ip
Then, run your new data acquisition plugin.
python3 your_new_data_acquisition_plugin.py --host-ip {SELF_IP} --guid ${GUID} --secret ${SECRET} --port {PORT} {ROBOT_IP}
Finally, open a new terminal and run plugin_tester.py.
python3 plugin_tester.py {ROBOT_IP} --service-name {SERVICE_NAME}
Arguments
The command line argument --service-name
is the name for the data acquisition plugin service that is used for directory registration. In the example plugins, the service name is defined near the top of each plugin file by the variable DIRECTORY_NAME
.
The --verbose
command line argument can be provided, which will allow for even more debug information (e.g. complete RPC requests and responses, extra information about the failure and error messages) to be displayed to the command line when tests run and fail.
All data collected during the test will be downloaded through the REST endpoint and saved to a directory, which can be specified through the command line argument --destination-folder
and defaults to the current working directory.
Troubleshooting
If you have gRPC errors like the following try opening a port.
The gRPC service call has timed out. Check that the service is still running and the service port is NOT blocked by any firewalls.
To open a port:
sudo ufw allow {PORT}