For a detailed view of the architecture diagram, see architecture.md.
Manages the Redis connection and implements advanced features for vector search with RedisSearch and RedisJSON. Key functions are:
createvectorestore: creates a Redis index for vector search.addtocosincollection: adds normalized vectors and associated commands to the Redis database via hash.selectcommandcosinsimilarity: performs a cosine similarity search on Redis to select the most relevant command given a query vector.- Supports the use of Redis commands such as
FT.CREATE,HSET, andFT.SEARCHto index and query vectors.
Subscribes to the Redis channel sensorsdata, receives sensor data, compares it with vectors in the database using RedisVectorClient, and publishes control commands on channel cmd. Uses in particular:
pubsub.subscribeandpubsub.listenfor real-time communication.redis.publishto send movement or stop commands based on calculated similarity.
Simulates communication with a virtual robot, reads sensor data, and sends data to Redis via publish on channel sensorsdata. Listens on channel cmd for movement commands.
Script that prepares and loads vector data into the Redis database for search, creating the index and populating the database with normalized vectors and commands.
Main script that starts the simulation, the sensor data sending thread, and the controller that receives commands from Redis to guide the robot.
1. Ensure that Redis is started and accessible on port 6379 (default).
2. Start Redis with Docker Compose:
docker-compose up -d3. Run the script to create the index and load data into the vector Redis this if exist a csv file:
./train.sh4. Start the simulation and control with:
python src/start_navigation.py5. To terminate, interrupt with Ctrl+C.
1.If you have executed previously a train.sh file execute these commands else go to point 2
docker stop redis-server
docker compose rm redis2.If you want create a csv file for training:
docker compose up -d redis
python src/start_human_navigation.py
later the execution of src/start_human_navigation.py you can execute file for training:
python src/redis_start_train.pyTo set up the runtime environment using uv, follow these steps:
1. Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | shOr using Homebrew on macOS:
brew install uv2. Create and activate a virtual environment:
uv venv
source .venv/bin/activate # On macOS/Linux
# or
.venv\Scripts\activate # On Windows3. Install project dependencies:
uv pip install -r requirements.txt4. Run the project scripts using uv:
# Run training script
uv run src/redis_start_train.py
# Run navigation script
uv run src/start_navigation.pyNote: Make sure you have Python 3.12 or higher installed, as required by the project configuration.
To run the Python interpreter defined in your virtual environment from within the CoppeliaSim simulators scripts:
echo "defaultPython = /absolute/path/venv/bin/python" > $USER/.CoppeliaSim/usrset.txt