A SPADE-based XMPP agent for controlling an AlphaBot2 robot using the Raspberry Pi Zero.
This project implements a SPADE (Smart Python Agent Development Environment) agent that controls an AlphaBot2 robot. The agent uses XMPP (Extensible Messaging and Presence Protocol) for communication, allowing remote control of the robot through messaging.
- Remote control of AlphaBot2 robot via XMPP messages
- Movement commands: forward, backward, left, right, stop
- Direct motor control with specified speed values
- Containerized deployment with Docker
- Raspberry Pi Zero (or compatible)
- AlphaBot2 robot kit
- GPIO access
- Python 3.9+
- SPADE 3.3.3
- RPi.GPIO
- spidev
- rpi_ws281x
-
Install Docker:
curl -sSL https://get.docker.com | sh sudo usermod -aG docker $USER restart terminal -
Clone this repository:
git clone <repository-url> cd AlphaPiZeroAgent -
Configure the XMPP settings in
docker-compose.yml: (Leave as it is unless configured)environment: XMPP_SERVER: "prosody" XMPP_PORT: 5222 XMPP_DOMAIN: "prosody" XMPP_USERNAME: "alpha-pi-zero-agent" XMPP_PASSWORD: "top_secret"
-
Build and run with Docker Compose:
docker-compose up -d
-
Install the required dependencies:
pip install -r requirements.txt -
Set the required environment variables:
export XMPP_SERVER="prosody" export XMPP_PORT=5222 export XMPP_DOMAIN="prosody" export XMPP_USERNAME="alpha-pi-zero-agent" export XMPP_PASSWORD="top_secret" -
Run the agent:
python -m agent
Send XMPP messages to the agent with the following commands:
forward- Move the robot forward for 2 secondsbackward- Move the robot backward for 2 secondsleft- Turn the robot left for 2 secondsright- Turn the robot right for 2 secondsstop- Stop all motorsmotor <left_speed> <right_speed>- Set specific motor speeds (range: -100 to 100)
agent/__main__.py- Main agent implementationagent/alphabotlib/- Library for controlling the AlphaBot2 hardwareAlphaBot2.py- Core motor control functions- Additional sensor and control modules
The agent uses environment variables for configuration:
XMPP_SERVER- XMPP server hostnameXMPP_PORT- XMPP server port (default: 5222)XMPP_DOMAIN- XMPP domainXMPP_USERNAME- XMPP username for the agentXMPP_PASSWORD- XMPP password for the agent
[Add your license information here]
- This project uses the SPADE framework for agent development
- AlphaBot2 is a product of Waveshare