This repository contains the code and configuration for the AlphaBot project, which includes various agents and services to control and monitor an AlphaBot robot. The project uses Docker to containerize the different components and Prosody for XMPP communication.
alphabot_agent/: Contains the code for the AlphaBot agent that controls the robot.calibration_agent/: Contains the code for the calibration agent.prosody/: Contains the configuration and modules for the Prosody XMPP server.runner_agent/: Contains the code for the runner agent that sends commands to the AlphaBot.env/: Contains environment configuration files.run_remote.sh: Script to deploy and run the agents on remote Raspberry Pi devices.
- Docker and Docker Compose installed on your machine.
- Ensure the IP addresses in the
.envfile are correctly set for your network.
-
Build and Run the Docker Containers
Navigate to the root of the repository and run the following command to build and start the Docker containers:
docker-compose up --build
This will start the following services:
alphabot_agent: The agent controlling the AlphaBot.calibration_agent: The agent responsible for calibrating the AlphaBot.prosody: The Prosody XMPP server.api: The API server for message monitoring.dashboard: The dashboard for monitoring the XMPP messages.
-
Running on Remote Raspberry Pi
Use the
run_remote.shscript to deploy and run the agents on remote Raspberry Pi devices. The script requires a host parameter (1 or 2) to specify which Raspberry Pi to deploy to../run_remote.sh <host_number>
Replace
<host_number>with1or2depending on the target Raspberry Pi.
Use the command :
uv run --project ./runner_agent --env-file ./env/prosody.env ./runner_agent/runner.pyThe .env file contains the following environment variables:
PROSODY_IP: IP address of the Prosody server.AGENT_1_IP: IP address of the first Raspberry Pi.AGENT_2_IP: IP address of the second Raspberry Pi.
The prosody/prosody.cfg.lua file contains the configuration for the Prosody XMPP server, including the enabled modules and SSL/TLS settings.
The docker-compose.yml file defines the services and their configurations. It includes the following services:
alphabot_agentcalibration_agentprosodyapidashboard
The AlphaBot agent is responsible for controlling the AlphaBot robot. It uses the RPi.GPIO library to interact with the hardware and the spade library for XMPP communication.
The calibration agent is responsible for calibrating the AlphaBot's sensors and camera. It uses the camera-sync library for camera calibration and the spade library for XMPP communication.
The runner agent sends commands to the AlphaBot agent. It includes various command files in the commands directory, which define the instructions to be sent to the AlphaBot.
The API server is built using Bun and provides endpoints for monitoring and controlling the XMPP messages. It includes WebSocket support for real-time message updates.
/api/status: Returns the status of the API server./api/ban: Endpoint to ban an agent./api/messages: Endpoint to receive and broadcast XMPP messages.
The dashboard service provides a web interface for monitoring the XMPP messages. It uses the dij0s/expose image.
The prosody/generate-certs.sh script generates the necessary SSL/TLS certificates for the Prosody server.
cd prosody
./generate-certs.shThis will generate the certificates in the prosody/certs directory.