Skip to content

Commit 77257a3

Browse files
authored
Merge pull request #70 from Simple-Robotics/install
Cleaned install procedure in readme (only use Pixi) and some cmake/pixi cleaning
2 parents a95d5c0 + 7a5781e commit 77257a3

21 files changed

+358
-362
lines changed

.github/workflows/macos-linux-pixi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
key: ccache-macos-linux-pixi-${{ matrix.os }}-${{ matrix.build_type }}-${{ github.sha }}
4646
restore-keys: ccache-macos-linux-pixi-${{ matrix.os }}-${{ matrix.build_type }}-
4747

48-
- uses: prefix-dev/setup-pixi@v0.8.1
48+
- uses: prefix-dev/setup-pixi@v0.9.1
4949
with:
50-
pixi-version: v0.39.2
50+
pixi-version: v0.56.0
5151
cache: true
5252
environments: ${{ matrix.environment }}
5353

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ repos:
3131
hooks:
3232
- id: gersemi
3333
args: ["--print-config=verbose"]
34+
- repo: https://github.com/astral-sh/ruff-pre-commit
35+
rev: v0.12.1
36+
hooks:
37+
- id: ruff-check # Run the linter.
38+
args: [ --fix ]
39+
- id: ruff-format # Run the formatter.

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ target_link_libraries(
110110
PUBLIC
111111
pinocchio::pinocchio
112112
aligator::aligator
113-
example-robot-data::example-robot-data
114113
ndcurves::ndcurves
115114
tsid::tsid
116115
)
@@ -123,7 +122,6 @@ set_target_properties(
123122

124123
# Unit tests
125124
if(BUILD_TESTING)
126-
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
127125
add_subdirectory(tests)
128126
endif()
129127

README.md

Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,28 @@ The **Simple-mpc** library provides:
1515
## Installation
1616

1717
### Build from source (devel)
18+
0. Install Pixi (from prefix.dev) : see https://pixi.sh/latest/installation/
1819

1920
1. Clone repo.
2021
```bash
21-
mkdir -p simple-mpc_ws/src
22-
cd simple-mpc_ws/src
2322
git clone [email protected]:Simple-Robotics/simple-mpc.git --recursive
23+
cd simple-mpc
2424
```
2525

26-
2. Create conda environment.
27-
(It is recommended to use `mamba` instead of `conda` for faster/better dependencies solving)
26+
2. Build
2827
```bash
29-
mamba env create -f simple-mpc/environment-devel.yaml
30-
mamba activate simple-mpc-devel
31-
```
32-
33-
3. Clone some dependencies
34-
(Some dependencies are not available on conda, or not with adequate versions)
35-
(vcs allow for cloning and managing multiple repo at once)
36-
```bash
37-
vcs import --recursive < simple-mpc/devel-git-deps.yaml
38-
```
39-
40-
4. Build all dependencies of simple-mpc:
41-
(Due to a renaming issue, you may need to rename hpp-fcl into coal in the package.xml file of the Pinocchio library)
42-
```bash
43-
export MAKEFLAGS="-j4" # It is recommended to reduce the number of jobs as you ram might get full easily with the default number.
44-
cd ..
45-
colcon build --event-handlers console_direct+ --packages-ignore simple-mpc --cmake-args \
46-
-DCMAKE_BUILD_TYPE=Release \
47-
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
48-
-DPYTHON_EXECUTABLE=$(which python) \
49-
-DCMAKE_CXX_COMPILER_LAUNCHER='ccache' \
50-
-DBUILD_TESTING=OFF \
51-
-DBUILD_DOCUMENTATION=OFF \
52-
-DBUILD_EXAMPLES=OFF \
53-
-DBUILD_BENCHMARK=OFF \
54-
-DBUILD_BENCHMARKS=OFF \
55-
-DBUILD_WITH_COLLISION_SUPPORT=ON \
56-
-DGENERATE_PYTHON_STUBS=OFF \
57-
-DCOAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL=ON
58-
```
59-
60-
5. Source the environment and install simple-mpc:
61-
```bash
62-
source install/setup.bash
63-
colcon build --packages-select simple-mpc
64-
```
65-
66-
6. Source the environment one more time
67-
(This step needs to be repeated every time a new shell is opened. It can be put in your ~/.bashrc)
68-
```bash
69-
mamba activate simple-mpc-devel # If not already done
70-
source install/setup.bash
28+
pixi run build
7129
```
7230

7331
#### Dependencies
7432

75-
* [proxsuite](https://github.com/Simple-Robotics/proxsuite.git)
76-
* [Eigen3](https://eigen.tuxfamily.org) >= 3.3.7
77-
* [Boost](https://www.boost.org) >= 1.71.0
78-
* OpenMP
79-
* [hpp-fcl](https://github.com/humanoid-path-planner/hpp-fcl)
33+
* [Aligator](https://github.com/edantec/aligator) | [conda](https://anaconda.org/conda-forge/aligator)
34+
* [proxsuite](https://github.com/Simple-Robotics/proxsuite.git) | [conda](https://anaconda.org/conda-forge/proxsuite)
8035
* [Pinocchio](https://github.com/stack-of-tasks/pinocchio) | [conda](https://anaconda.org/conda-forge/pinocchio)
81-
* [Aligator](https://github.com/edantec/aligator) temporary_fix branch
82-
* [example-robot-data](https://github.com/Gepetto/example-robot-data)
36+
* [hpp-fcl (renamed coal)](https://github.com/humanoid-path-planner/hpp-fcl) | [conda](https://anaconda.org/conda-forge/coal)
37+
* [tsid](https://github.com/stack-of-tasks/tsid) >= 1.9.0 | [conda](https://anaconda.org/conda-forge/tsid)
8338
* [ndcurves](https://github.com/loco-3d/ndcurves)
84-
* [tsid](https://github.com/stack-of-tasks/tsid)
85-
* (optional) [eigenpy](https://github.com/stack-of-tasks/eigenpy)>=3.9.0 (Python bindings)
86-
* (optional) [bullet](https://github.com/bulletphysics/bullet3) (Simulation examples)
39+
* [Eigen3](https://eigen.tuxfamily.org) >= 3.3.7
40+
* [eigenpy](https://github.com/stack-of-tasks/eigenpy) >=3.9.0 (Python bindings)
41+
* (optional) [example-robot-data](https://github.com/Gepetto/example-robot-data) (for tests, benchmarks and examples | [conda](https://anaconda.org/conda-forge/example-robot-data)
42+
* (optional) [pybullet](https://github.com/bulletphysics/bullet3) (Simulation examples) | [conda](https://anaconda.org/conda-forge/pybullet)

benchmark/CMakeLists.txt

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
11
find_package(benchmark REQUIRED)
2+
find_package(example-robot-data 4.0.9 REQUIRED)
23

34
# Add a benchmark.
4-
function(create_bench exfile)
5-
get_filename_component(exname ${exfile} NAME_WE)
6-
set(exname "bench-${exname}")
7-
add_executable(${exname} ${exfile})
8-
message(STATUS "Adding cpp example ${exname}")
9-
set_target_properties(${exname} PROPERTIES LINKER_LANGUAGE CXX)
10-
set_standard_output_directory(${exname})
11-
target_include_directories(${exname} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
5+
function(create_bench benchfile)
6+
get_filename_component(benchname ${benchfile} NAME_WE)
7+
set(benchname "bench-${benchname}")
8+
add_executable(${benchname} ${benchfile})
9+
message(STATUS "Adding cpp example ${benchname}")
10+
set_target_properties(${benchname} PROPERTIES LINKER_LANGUAGE CXX)
11+
target_include_directories(${benchname} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
1212

13-
target_link_libraries(${exname} PUBLIC ${PROJECT_NAME})
14-
target_link_libraries(${exname} PUBLIC example-robot-data::example-robot-data)
15-
target_link_libraries(${exname} PUBLIC benchmark::benchmark)
13+
target_link_libraries(${benchname} PUBLIC ${PROJECT_NAME})
14+
target_link_libraries(${benchname} PUBLIC example-robot-data::example-robot-data)
15+
target_link_libraries(${benchname} PUBLIC benchmark::benchmark)
16+
17+
# Add custom command to run this particular benchmark
18+
add_custom_target(run-${benchname}
19+
COMMAND ${benchname}
20+
DEPENDS ${benchname}
21+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
22+
)
23+
# Add this benchmark in the dependencies to run all benchmarks
24+
add_dependencies(run-benchmarks run-${benchname})
1625
endfunction()
1726

27+
# Create a custom target to run all benchmarks
28+
add_custom_target(run-benchmarks
29+
COMMAND ${CMAKE_COMMAND} -E echo "All benchmarks run."
30+
)
31+
32+
# Add benchmarks
1833
create_bench("talos.cpp")
1934
create_bench("go2.cpp")

bindings/expose-interpolate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace simple_mpc
5555

5656
void exposeInterpolator()
5757
{
58-
bp::class_<Interpolator>("Interpolator", bp::init<const Model &>(bp::args("self", "model")))
58+
bp::class_<Interpolator>("Interpolator", bp::init<const pinocchio::Model &>(bp::args("self", "model")))
5959
.def("interpolateConfiguration", &interpolateConfigurationProxy)
6060
.def("interpolateState", &interpolateStateProxy)
6161
.def("interpolateLinear", &interpolateLinearProxy)

dependencies.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
find_package(example-robot-data 4.0.9 REQUIRED)
21
ADD_PROJECT_DEPENDENCY(OpenMP REQUIRED)
32
ADD_PROJECT_DEPENDENCY(proxsuite REQUIRED)
43
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)

devel-git-deps.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

environment-devel.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/bullet_robot.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def __init__(
5252
3
5353
] # of the base link
5454

55-
self.localInertiaOrient = p.getDynamicsInfo(self.robotId, -1)[
56-
4
57-
]
55+
self.localInertiaOrient = p.getDynamicsInfo(self.robotId, -1)[4]
5856

5957
# leg_left (45-50), leg_right (52-57), torso (0-1), arm_left (11-17),
6058
# gripper_left (21), arm_right (28-34), gripper_right (38), head (3,4).
@@ -124,7 +122,12 @@ def getFrictionCoefficients(self, link_id):
124122
return lat_fric, spin_fric
125123

126124
def setFrictionCoefficients(self, link_id, lateral_friction, spin_friction):
127-
p.changeDynamics(self.robotId, link_id, lateralFriction=lateral_friction, spinningFriction=spin_friction)
125+
p.changeDynamics(
126+
self.robotId,
127+
link_id,
128+
lateralFriction=lateral_friction,
129+
spinningFriction=spin_friction,
130+
)
128131

129132
def resetState(self, q0Start):
130133
# Initialize position in pyBullet
@@ -451,7 +454,6 @@ def createStairs(self, pose_stairs, height_step):
451454
)
452455

453456
def moveMarkers(self, LF_trans, RF_trans):
454-
455457
p.resetBasePositionAndOrientation(
456458
self.sphereIdRight,
457459
posObj=[
@@ -472,7 +474,6 @@ def moveMarkers(self, LF_trans, RF_trans):
472474
)
473475

474476
def moveQuadrupedFeet(self, FL_pose, FR_pose, RL_pose, RR_pose):
475-
476477
p.resetBasePositionAndOrientation(
477478
self.sphereIdFL,
478479
posObj=[
@@ -515,5 +516,4 @@ def close(self):
515516

516517

517518
if __name__ == "__main__":
518-
519519
print("BulletRobot")

0 commit comments

Comments
 (0)