CostumePy is a library designed to allow developers to create smart wearable costumes.
The overall aim is to create a more ROS-like, dynamic programming style compared to the linear while True:
systems.
Here is an example file which listens for a nose_press message then reacts with a callback
import CostumePy
def nose_press_function(msg):
print("You pressed my nose %s!" % msg["data"])
CostumePy.listen("nose_press", nose_press_function)
CostumePy.broadcast("nose_press", data="hard")
CostumePy is currently only compatible with Python 3.x
If you've installed Python 3 directly yourself simply run:
python setup.py install
If you're using a Raspberry Pi or a machine with both Python 2 and 3 installed, replace python
with python3
To use CostumePy, you first have to launch the server. To start the server run:
python -m CostumePy.server
To run this in the background on a Linux system, append the command with an &
If you try to use CostumePy without the server, you will get the following error when trying to broadcast or listen to a topic:
File "/usr/local/lib/python3.5/dist-packages/CostumePy-0.0.1-py3.5.egg/CostumePy/cospy_node.py", line 33, in _request_socket_ip
ConnectionRefusedError: Cannot contact manager, has it been started?
If you wish to test CostumePy. Simply run the following command in the CostumePy directory:
python -m unittest discover -s tests -v
This will search for all files starting with test_
in the tests
directory.
If you want to create your own tests for new features, please have a look at test_basic_functionality.py
to see how to structure your tests.
This project is still in development so please expect wild code changes.
If you would like to contribute to this project please contact me below.
- Samuel Martin - [email protected]