From 2162a1e2348ce8b61c520ee772b773a33df90698 Mon Sep 17 00:00:00 2001 From: adthoms Date: Wed, 20 Aug 2025 01:22:16 -0700 Subject: [PATCH] Fix path handling and update README --- .gitignore | 3 ++ README.md | 63 ++++++++++++++++++-------- examples/MultiRobotExample.cpp | 3 +- examples/MultiRobotExample_RASLAM.cpp | 3 +- examples/SingleRobotExample.cpp | 3 +- examples/SingleRobotExample_RASLAM.cpp | 3 +- 6 files changed, 51 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 54655667..f83f9138 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Ignore results directory +results/* + # Ignore C++ build directory build/* diff --git a/README.md b/README.md index 09967c2e..87f040da 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,69 @@ # Distributed Certifiably Correct Range-Aided SLAM (DCORA) -## Building +## Installation + +Install the required system dependencies: -Install dependencies ```bash -sudo apt-get install build-essential cmake-gui libsuitesparse-dev libboost-all-dev libeigen3-dev libgoogle-glog-dev -``` +sudo apt-get update +sudo apt-get install build-essential cmake-gui libsuitesparse-dev \ + libboost-all-dev libeigen3-dev libgoogle-glog-dev + +Clone the repository and build: -Inside the C++ directory, execute the following commands ```bash -mkdir build -cd build -cmake ../ -make +cd ~ && git clone https://github.com/adthoms/dcora.git +cd ~/dcora/ +mkdir build && cd build +cmake .. +make -j$(nproc) ``` +The compiled executables will be placed in `build/bin`. + ## Usage -The built executables are located in directory build/bin. For a minimal demo of DC2-PGO on one of the benchmark g2o datasets, inside the build directory run: +### Multi-Robot Demo (DC2-PGO) + +Run distributed certifiably correct pose-graph optimization on a benchmark `.g2o` dataset: + ```bash +cd build ./bin/multi-robot-example 5 ../data/smallGrid3D.g2o ``` -For a minimal demo of CORA on one of the benchmark pyfg datasets, inside the build directory run: + +Here, 5 specifies the number of robots. + +### Single-Robot Demo (CORA) + +Run certifiably correct range-aided SLAM on a benchmark `.pyfg` dataset: + ```bash +cd build ./bin/single-robot-example-ra-slam ../data/tiers.pyfg ``` +## Testing + +To run the unit tests: + +```bash +cd build +./bin/testDCORA +``` + +All tests must pass before submitting contributions. + ## Contributing Any contributions should pass all checks in our `.pre-commit-config.yaml` file. To install the pre-commit hooks, run `pre-commit install` in the root directory of this repository. You may need to install some dependencies to get the pre-commit hooks to work. ```bash pip install pre-commit sudo apt-get install cppcheck -cd /path/to/dcora +cd ~/dcora pre-commit install ``` -## Testing - -Run the unit tests via -```bash -./bin/testDCORA -``` - ## References If you use this code in your research, please cite the following paper: @@ -55,3 +76,7 @@ If you use this code in your research, please cite the following paper: year={2025} } ``` + +## License + +This project is licensed under the MIT License diff --git a/examples/MultiRobotExample.cpp b/examples/MultiRobotExample.cpp index 98bed7d2..00602e97 100644 --- a/examples/MultiRobotExample.cpp +++ b/examples/MultiRobotExample.cpp @@ -121,8 +121,7 @@ int main(int argc, char **argv) { bool acceleration = true; bool verbose = false; unsigned numIters = 1000; - std::string logDirectory = "/home/alex/data/dcora_dpgo_examples/" - "dcora_examples/multi_robot_example_pgo/"; + std::string logDirectory = std::string(getenv("HOME")) + "/dcora/results/multi_robot_example_pgo/"; std::string debug_filename; bool logData = true; unsigned int r_min = 5; diff --git a/examples/MultiRobotExample_RASLAM.cpp b/examples/MultiRobotExample_RASLAM.cpp index 3292199a..c7081a7a 100644 --- a/examples/MultiRobotExample_RASLAM.cpp +++ b/examples/MultiRobotExample_RASLAM.cpp @@ -76,8 +76,7 @@ int main(int argc, char **argv) { // Logging bool logData = true; - std::string logDirectory = "/home/alex/data/dcora_dpgo_examples/" - "dcora_examples/multi_robot_example_ra_slam/"; + std::string logDirectory = std::string(getenv("HOME")) + "/dcora/results/multi_robot_example_ra_slam/"; DCORA::Logger logger(logDirectory); bool rbcd_only = false; diff --git a/examples/SingleRobotExample.cpp b/examples/SingleRobotExample.cpp index e575589d..0cc82c53 100644 --- a/examples/SingleRobotExample.cpp +++ b/examples/SingleRobotExample.cpp @@ -52,8 +52,7 @@ int main(int argc, char **argv) { unsigned int r = d; DCORA::AgentParameters options(d, r); options.verbose = true; - options.logDirectory = "/home/alex/data/dcora_dpgo_examples/" - "dcora_examples/single_robot_example_pgo/"; + options.logDirectory = std::string(getenv("HOME")) + "/dcora/results/single_robot_example_pgo/"; options.logData = true; std::vector odometry; diff --git a/examples/SingleRobotExample_RASLAM.cpp b/examples/SingleRobotExample_RASLAM.cpp index 2906cadd..df8e85c5 100644 --- a/examples/SingleRobotExample_RASLAM.cpp +++ b/examples/SingleRobotExample_RASLAM.cpp @@ -65,8 +65,7 @@ int main(int argc, char **argv) { // Logging bool logData = true; - std::string logDirectory = "/home/alex/data/dcora_dpgo_examples/" - "dcora_examples/single_robot_example_ra_slam/"; + std::string logDirectory = std::string(getenv("HOME")) + "/dcora/results/single_robot_example_ra_slam/"; DCORA::Logger logger(logDirectory); // Initialization method