|
1 | | -# C3 |
2 | | -Consensus Complementarity Control |
| 1 | +# C3: Consensus Complementarity Control |
3 | 2 |
|
4 | | -This is a standalone repository for the C3 algorithm. For more in-depth examples, see dairlib. |
5 | | -Currently we only officially support Ubuntu 22.04. |
| 3 | +[**Main Paper: Consensus Complementarity Control**](https://arxiv.org/abs/2304.11259) |
6 | 4 |
|
7 | | -## Build from source |
8 | | -1. Clone C3 (Don't change to the c3 directory yet) |
9 | | -```shell |
10 | | -git clone --filter=blob:none [email protected]:DAIRLab/c3.git |
11 | | -``` |
| 5 | +<p align="center"> |
| 6 | + <a href="https://cirrus-ci.com/github/DAIRLab/c3"> |
| 7 | + <strong style="vertical-align: middle;">Build (Noble)</strong> |
| 8 | + <img src="https://api.cirrus-ci.com/github/DAIRLab/c3.svg?task=noble&script=test&branch=main" alt="Noble Test Report" style="vertical-align: middle;"/> |
| 9 | + </a> |
| 10 | + |
| 11 | + <a href="https://cirrus-ci.com/github/DAIRLab/c3"> |
| 12 | + <strong style="vertical-align: middle;">Build (Jammy)</strong> |
| 13 | + <img src="https://api.cirrus-ci.com/github/DAIRLab/c3.svg?task=jammy&script=test&branch=main" alt="Jammy Test" style="vertical-align: middle;"/> |
| 14 | + </a> |
| 15 | + |
| 16 | + <a href="https://github.com/DAIRLab/c3/actions/workflows/coverage.yml"><strong style="vertical-align: middle;">Coverage</strong> |
| 17 | + <img src="https://github.com/DAIRLab/c3/actions/workflows/coverage.yml/badge.svg?branch=main&event=push" alt="C3 Coverage" style="vertical-align: middle;"/> |
| 18 | + </a> |
| 19 | +</p> |
12 | 20 |
|
13 | | -2. Install Drake's dependencies by running the commands below. This will download the specific Drake release used by C3, and install the corresponding dependencies. |
14 | | -```shell |
15 | | -git clone --depth 1 --branch v1.35.0 https://github.com/RobotLocomotion/drake.git |
16 | | -sudo drake/setup/ubuntu/install_prereqs.sh |
17 | | -``` |
18 | | -3. Follow the instructions at https://drake.mit.edu/bazel.html to install Gurobi 10.0 |
19 | | -4. Change to the C3 Directory, and build the repo: |
20 | | -```shell |
21 | | -cd c3 |
22 | | -bazel build ... |
| 21 | +This repository contains the reference implementation of the [Consensus Complementarity Control (C3)](https://arxiv.org/abs/2304.11259) algorithm. For more in-depth examples, see [dairlib](https://github.com/DAIRLab/dairlib). |
| 22 | +**Officially supported OS:** Ubuntu 22.04. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Table of Contents |
| 27 | + |
| 28 | +- [Setup](#setup) |
| 29 | +- [Build Instructions](#build-instructions) |
| 30 | +- [Testing & Coverage](#testing-and-coverage) |
| 31 | +- [Running Examples](#running-examples) |
| 32 | +- [Directory Structure](#directory-structure) |
| 33 | +- [Reference](#reference) |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Setup |
| 38 | + |
| 39 | +1. **Install Bazel or Bazelisk:** |
| 40 | + You can install Bazelisk (a user-friendly launcher for Bazel) or Bazel directly. Bazelisk is recommended as it automatically manages Bazel versions. |
| 41 | + |
| 42 | + **To install Bazelisk:** |
| 43 | + ```sh |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get install -y curl |
| 46 | + sudo curl -L https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 -o /usr/local/bin/bazel |
| 47 | + sudo chmod +x /usr/local/bin/bazel |
| 48 | + ``` |
| 49 | + For more details and to find a specific version, visit the [Bazelisk releases page](https://github.com/bazelbuild/bazelisk/releases). Choose a version compatible with your system and project requirements. |
| 50 | + |
| 51 | + **Or, to install Bazel directly:** |
| 52 | + Follow the instructions at [Bazel's official installation guide](https://bazel.build/install/ubuntu). |
| 53 | +2. **Clone C3 (do not `cd` into the directory yet):** |
| 54 | + ```sh |
| 55 | + git clone --filter=blob:none [email protected]:DAIRLab/c3.git |
| 56 | + ``` |
| 57 | +
|
| 58 | +2. **Install Drake and its dependencies:** |
| 59 | + ```sh |
| 60 | + git clone --depth 1 --branch v1.35.0 https://github.com/RobotLocomotion/drake.git |
| 61 | + sudo drake/setup/ubuntu/install_prereqs.sh |
| 62 | + ``` |
| 63 | +
|
| 64 | +3. **Install Gurobi 10.0:** |
| 65 | + Follow the instructions at [Drake's Gurobi setup page](https://drake.mit.edu/bazel.html) to install Gurobi 10.0. |
| 66 | + |
| 67 | +4. **(Optional) Remove Drake clone:** |
| 68 | + You may delete the Drake directory after installing dependencies. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## Build Instructions |
| 73 | + |
| 74 | +1. **Change to the C3 directory:** |
| 75 | + ```sh |
| 76 | + cd c3 |
| 77 | + ``` |
| 78 | + |
| 79 | +2. **Build the repository using Bazel:** |
| 80 | + ```sh |
| 81 | + bazel build ... |
| 82 | + ``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## Testing and Coverage |
| 87 | + |
| 88 | +- **Run all unit tests:** |
| 89 | + ```sh |
| 90 | + bazel test ... --test_output=all |
| 91 | + ``` |
| 92 | + |
| 93 | +- **Run a specific test:** |
| 94 | + ```sh |
| 95 | + bazel test //systems:systems_test |
| 96 | + ``` |
| 97 | + |
| 98 | +- **Run coverage:** |
| 99 | + ```sh |
| 100 | + bazel coverage --combined_report=lcov ... |
| 101 | + genhtml --branch-coverage --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" # Generates the HTML report to be viewed inside the genhtml folder |
| 102 | + ``` |
| 103 | + |
| 104 | +## Running Examples |
| 105 | + |
| 106 | +This repository provides several C++ and Python examples demonstrating how to use the C3 library for different systems and workflows. |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +### Quick Start |
| 111 | + |
| 112 | +- **C++ Examples:** |
| 113 | + See the [C3 Standalone Example](./examples/README.md#c3-standalone-example), [C3 Controller Example](./examples/README.md#c3-controller-example), and [LCS Factory System Example](./examples/README.md#lcs-factory-system-example) sections in the examples README for build and run instructions. |
| 114 | + |
| 115 | +- **Python Examples:** |
| 116 | + See the [Python Examples](./examples/README.md#python-examples) section in the examples README for how to build and run the Python scripts using Bazel. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +For more information, including how to select different problems, visualize results, and understand the system architectures, refer to the [`examples/README.md`](./examples/README.md) file. |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## Directory Structure |
| 125 | + |
| 126 | +```plaintext |
| 127 | +c3/ |
| 128 | +├── bindings/ # Python bindings and tests |
| 129 | +├── core/ # Core algorithm implementation |
| 130 | +├── examples/ # Example applications and simulations |
| 131 | +├── systems/ # Drake systems and tests |
| 132 | +├── multibody/ # algorithms for computation in multibody environments |
| 133 | +├── third_party/ # External dependencies |
| 134 | +└── MODULE.bazel # Bazel module file |
23 | 135 | ``` |
24 | | -5. Run an example program |
25 | | -```shell |
26 | | -bazel-bin/bindings/test/c3_py_test |
| 136 | +--- |
| 137 | + |
| 138 | +## Reference |
| 139 | + |
| 140 | +For a detailed explanation of the C3 algorithm, please refer to the [main paper](https://arxiv.org/abs/2304.11259). Additional resources and in-depth examples can be found in the [dairlib repository](https://github.com/DAIRLab/dairlib). |
| 141 | + |
| 142 | +## Citation |
| 143 | +If you use C3 in your research, please cite: |
| 144 | + |
| 145 | +```bibtex |
| 146 | +@article{Aydinoglu2024, |
| 147 | + title = {Consensus Complementarity Control for Multi-Contact MPC}, |
| 148 | + author = {Aydinoglu, Alp and Wei, Adam and Huang, Wei-Cheng and Posa, Michael}, |
| 149 | + year = {2024}, |
| 150 | + month = jul, |
| 151 | + journal = {IEEE Transactions on Robotics (TRO)}, |
| 152 | + youtube = {L57Jz3dPwO8}, |
| 153 | + arxiv = {2304.11259}, |
| 154 | + doi = {10.1109/TRO.2024.3435423}, |
| 155 | + url = {https://ieeexplore.ieee.org/document/10614849} |
| 156 | +} |
27 | 157 | ``` |
28 | | -6. You may delete the copy of Drake we cloned in step 3 |
|
0 commit comments