-
Notifications
You must be signed in to change notification settings - Fork 2k
Add a new recipe: pinocchio #27734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
The-NUM
wants to merge
8
commits into
conan-io:master
Choose a base branch
from
The-NUM:pinocchio/3.7.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+148
−0
Open
Add a new recipe: pinocchio #27734
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b555ce2
add pinocchio recipe
The-NUM 445f65f
add Python interfaces comment
The-NUM 9f73adf
Merge branch 'conan-io:master' into pinocchio/3.7.0
The-NUM 65b5155
add tool_requires cmake
The-NUM db4375b
Update recipes/pinocchio/all/test_package/CMakeLists.txt
AbrilRBS 0c16424
Update recipes/pinocchio/all/test_package/conanfile.py
AbrilRBS e71de46
Add components
AbrilRBS c493af2
Simplify test_package, fix defines
AbrilRBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"3.7.0": | ||
url: "https://github.com/stack-of-tasks/pinocchio/releases/download/v3.7.0/pinocchio-3.7.0.tar.gz" | ||
sha256: "c14c2ac9e5943af9acca9730c31d66c59b57a9407960d5b66d200f50b39a70a1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps | ||
from conan.tools.files import get, rmdir, copy | ||
|
||
required_conan_version = ">=2" | ||
|
||
class PinocchioConan(ConanFile): | ||
name = "pinocchio" | ||
package_type = "library" | ||
license = ("BSD 2-Clause") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
description = ( | ||
"Pinocchio instantiates the state-of-the-art Rigid Body Algorithms for poly-articulated " | ||
"systems based on revisited Roy Featherstone's algorithms. Besides, Pinocchio provides " | ||
"the analytical derivatives of the main Rigid-Body Algorithms, such as the Recursive " | ||
"Newton-Euler Algorithm or the Articulated-Body Algorithm." | ||
) | ||
topics = ( | ||
"robotics", "kinematics", "dynamics", "automatic-differentiation", | ||
"motion-planning", "ros", "rigid-body-dynamics", "analytical-derivatives", | ||
) | ||
|
||
settings = "os", "compiler", "build_type", "arch" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True | ||
} | ||
|
||
implements = ["auto_shared_fpic"] | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("eigen/3.4.0", transitive_headers=True) | ||
self.requires("urdfdom_headers/1.1.1") | ||
self.requires("urdfdom/4.0.0") | ||
self.requires("boost/1.87.0", transitive_headers=True) | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/[>=3.22 <4]") | ||
|
||
def validate(self): | ||
if self.settings.compiler == "msvc": | ||
raise ConanInvalidConfiguration("MSVC is not supported") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
tc = CMakeToolchain(self) | ||
# To enable building Python interfaces, it is necessary to either ensure the installation | ||
# of dependencies using self.tool_requires("cpython/X.Y.Z") or implement support for working | ||
# with a virtual environment (e.g., https://github.com/conan-io/conan/pull/11601) | ||
tc.cache_variables["BUILD_PYTHON_INTERFACE"] = False | ||
tc.cache_variables["BUILD_TESTING"] = False | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["pinocchio_default", "pinocchio_parsers", "pinocchio_visualizers"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
project(test_package CXX) | ||
|
||
find_package(pinocchio REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} src/test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} pinocchio::pinocchio) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.build import can_run | ||
|
||
|
||
class PinocchioTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/[>=3.22 <4]") | ||
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def test(self): | ||
if can_run(self): | ||
cmd = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(cmd, env="conanrun") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
|
||
#include "pinocchio/multibody/sample-models.hpp" | ||
#include "pinocchio/algorithm/joint-configuration.hpp" | ||
#include "pinocchio/algorithm/rnea.hpp" | ||
|
||
int main() | ||
{ | ||
pinocchio::Model model; | ||
pinocchio::buildModels::manipulator(model); | ||
pinocchio::Data data(model); | ||
|
||
Eigen::VectorXd q = pinocchio::neutral(model); | ||
Eigen::VectorXd v = Eigen::VectorXd::Zero(model.nv); | ||
Eigen::VectorXd a = Eigen::VectorXd::Zero(model.nv); | ||
|
||
const Eigen::VectorXd & tau = pinocchio::rnea(model, data, q, v, a); | ||
std::cout << "tau = " << tau.transpose() << std::endl; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"3.7.0": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.