The hackerbot
Python package provides modules for controlling and managing the Hackerbot robotics system.
You can now install the package directly from PyPI:
pip install hackerbot
This will automatically install all required dependencies and make the hackerbot
package available in your Python environment.
If you prefer to install from source for development purposes:
-
Clone the Repository
git clone https://github.com/hackerbotindustries/hackerbot-python-package.git cd hackerbot-python-package/
-
Install Locally
pip install .
SSH into the Raspberry Pi or open a VNC viewer, then install the official Python package:
pip install hackerbot
Or upgrade the existing package:
pip install --upgrade hackerbot
Then, run python3
to open up the Python interactive shell and copy and paste the following:
from hackerbot import Hackerbot
bot = Hackerbot()
bot.base.drive(0, 65)
bot.base.drive(200, 0)
You should see your Hackerbot leave the charger and move in the opposite direction.
bot.head.look(180, 250, 70)
Now your robot should move its head and look up at you!
bot.arm.move_joints(0, 0, 0, 0, 0, 0, 10)
You should see your elephant arm moving to a straight-up position.
bot.base.destroy(auto_dock=True)
Safely clean up, and your Hackerbot will return to the charger. Once destroy
is called, you need to create a new Hackerbot instance to perform new actions.
After installation, you can import and use the package in your Python scripts:
import hackerbot
To run the unit tests:
cd tests/unit_tests
pytest
If you run into issues during installation or usage, try the following:
-
Use a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Upgrade
pip
:pip install --upgrade pip