Bagman is a ROS 2 bag (.mcap) management tool.
Table of Contents
- CLI Tool: includes administrative commands for managing recordings
- NoSQL Database Support: compatible with MongoDB, Elasticsearch, and TinyDB
- Streamlit Dashboard: interactively search for recordings and explore their content
- Prefect Pipeline (in development): define and execute workflows by selecting tasks and applying them to recordings
- Docker (
apt install docker.io
) - Docker Compose (
apt install docker-compose
) - yq (
snap install yq
)
Clone the repository:
git clone https://github.com/yannikmotzet/bagman.git && cd bagman
-
Build the Docker image:
docker build -t bagman .
-
Set environment variables for docker-compose:
echo "RECORDINGS_STORAGE=$(yq '.recordings_storage' config.yaml)" > .env echo "DASHBOARD_PORT=$(yq '.dashboard_port' config.yaml)" >> .env
-
Start the application:
docker-compose up -d
-
Open Dashboard in browser: localhost:8502
-
Install the package:
pip install .
Note: For development use
pip install -e .
which creates a symbolic link to the source code. -
Execute the CLI:
bagman
bagman CLI positional arguments: {upload,add,update,delete,remove,exist,connection,metadata} upload upload local recording to storage (optional: add to database) add add a recording to database or update existing one update update an existing recording in database delete delete a recording from storage (optional: remove from database) remove remove a recording from database exist check if recording exists in storage and database connection check connection to the storage and database metadata (re)generate metadata file for a local recording options: -h, --help show this help message and exit -c CONFIG, --config CONFIG path to config file, default: config.yaml in current directory
Currently, the following databases are supported:
- MongoDB
- Elasticsearch
- TinyDB (based on .json file)
Database integration is managed through the config.yaml
file and environment variables. The database_uri
field specifies the connection details for the selected database, while authentication credentials can be provided via a .env
file.
For TinyDB, set the database_uri
field in config.yaml
to the path of the .json
file:
database_uri: path/to/database.json
For Elasticsearch, set the database_uri
field in config.yaml
to the URL of the database:
database_uri: http://localhost:9200
Additionally, specify the database_name
field in config.yaml
to define the Elasticsearch index name:
database_name: your_index_name
If authentication is required, add the credentials to a .env
file:
For username/password authentication:
DATABASE_USER=your_username
DATABASE_PASSWORD=your_password
For API key authentication, use a Base64-encoded key:
DATABASE_TOKEN=your_base64_encoded_api_key
Note: Use either username/password or API key, but not both.
For MongoDB, set the database_uri
field in config.yaml
to the connection URL:
database_uri: mongodb://localhost:27017
Additionally, specify the database_name
field in config.yaml
to define both the MongoDB database name and the collection name:
database_name: your_collection_name
If authentication is required, add the credentials to a .env
file:
DATABASE_USER=your_username
DATABASE_PASSWORD=your_password
- Ensure the
.env
file is located in the same directory as your application. - The application will automatically load the environment variables from the
.env
file during runtime. - Using username and password inside the database URL is not recommended for security reasons.
- For more details, refer to the documentation of the respective database.
Use pre-commit:
-
Install pre-commit:
pip install pre-commit
-
Run pre-commit:
pre-commit