Skip to content
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

Extend Support for Mimic Joint #2441

Open
wants to merge 166 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
0e05b80
Add Urdf support for mimic joint (revolute and prismatic)
Sep 29, 2024
f682cb4
Sample Model : Now support a mimic joint at the end if wanted
Sep 29, 2024
03d464e
[Joints] Added support for nj and idx_j
Sep 29, 2024
a83452f
[Joint] Mimic joint is now based on the variant and not templated
Sep 29, 2024
f34e6c4
[Model] Support for nj and idx_j
Sep 29, 2024
ceba5b4
[Data] Jacobian is now indexed on nj
Sep 29, 2024
2375b41
[LieGroup] Neutral Specialization for mimic joints
Sep 29, 2024
6794730
[Serialization] Fix serialization
Sep 29, 2024
dd613b2
[Unittest] Fix unittest
Sep 29, 2024
4e8672c
[unittest] Fix for mimic
Sep 29, 2024
7253f79
[Python] Add bindings
Sep 29, 2024
796d799
[Urdf] Add possibility to use mimic or not
Sep 29, 2024
c56aa4a
[Serialization] Fix Test and serialization
Sep 29, 2024
4d9a6bd
[Mimic] Joint Tpl instead of JointBase
Sep 29, 2024
0e6542f
[Broken test] copy visitor from variant to variant
Sep 29, 2024
b8ca12f
Add mimic to shortcuts
Sep 29, 2024
2e55e98
wip
Sep 29, 2024
5ed6be7
Copy constructor instead of =
Sep 29, 2024
faa8447
[EtienneAr feedback] Add mimic constructor for different primay/secon…
Sep 29, 2024
de7a75a
[EtienneAr feedback] Move transferVariant to joint-basic-visitors and…
Sep 29, 2024
d26d7f9
[EtienneAr feedback] PoC: fix appendModel
Sep 29, 2024
ad01bd4
[EtienneAr feedback] Fix sample model for mimic in manipulator
Sep 29, 2024
8bd4bb7
[EtienneAr feedback] Joint Mimic jointConfigSelector_impl follows con…
Sep 29, 2024
2c14b0c
[EtienneAr feedback] Fix appendToModel when mimic joint in model
Sep 29, 2024
6d07cce
[EtienneAr feedback] Apply pre-commit
Sep 29, 2024
2593331
[EtienneAr feedback] Turn on mimic joint in model, reachable-workspac…
Sep 29, 2024
efb857d
[EtienneAr feedback] Split jointCols jointRows and jointBLock for ful…
Sep 29, 2024
cf9bf86
[URDF] Modified the way mimic joint are added (still broken for romeo…
Sep 29, 2024
ee81474
[urdf] Fix parsing of mimic joints
Sep 29, 2024
3f62527
[Example] Fix to include mimic
Sep 29, 2024
ca7ef20
[robot_wrapper] Fix to include mimic
Sep 29, 2024
e8953b3
Merge branch
Sep 29, 2024
2b0a3d1
[RNEA] Modify to take mimic into account
Sep 29, 2024
9be40f0
[Mimic] Modify to be able to mimic from base to Tpl
Sep 29, 2024
981239e
[SampleModel] Test to compare a mimic and non mimic model
Sep 29, 2024
b028ac3
[Data] Check on mimic is disable for now
Sep 29, 2024
3eaf48f
Working test
Sep 29, 2024
ba2780e
[EtienneAr feedback] Fix RNEA: initialize tau to zero before summing
Sep 29, 2024
319c609
[EtienneAr feedback] Fix crba for mimic joints
Sep 29, 2024
c248ef5
[EtienneAr feedback] Test crba before rnea for mimic joints
Sep 29, 2024
7ce5202
[EtienneAr feedback] Port crba fix to algorithm with other convention
Sep 29, 2024
cc00113
[EtienneAr feedback] Port crba fix to rnea, compute-all-terms and con…
Sep 29, 2024
f684d60
[EtienneAr feedback] Revert useless change on Fcrb in crna.hxx
Sep 29, 2024
4266e17
[EtienneAr feedback] Make M matrix symetric in test
Sep 29, 2024
2d18a55
[EtienneAr feedback] Properly use data.nle instead of rnea
Sep 29, 2024
292688f
[EtienneAr feedback] Fix crba for mimic joints
Sep 29, 2024
192c263
[EtienneAr feedback] Fix RNEA after chage for mimic joints
Sep 29, 2024
88076e4
[example] Change buildModelUrdf - added mimic bool
Sep 29, 2024
0595bf1
[mimic-joint] Added support for FreeFlyer
Sep 29, 2024
4a04b39
[unittest] Added bool mimic to build urdf
Sep 29, 2024
b6349fc
[Joint] Split Joint ConfigSelector in two functions
Sep 29, 2024
1f02588
Apply pre-commit
Sep 29, 2024
a766bc0
Split JointVelocitySelector in two functions
Sep 29, 2024
59e2927
Apply pre-commit
Sep 29, 2024
867aa71
[EtienneAr feedback] Add more test for joint mimic in non trivial cases
Sep 29, 2024
7dd647e
[EtienneAr feedback] Fix scaling and offset in mimic joint calc
Sep 29, 2024
9264968
[EtienneAr feedback] WiP: Fix ConfigVectorAffineTransform template sp…
Sep 29, 2024
e6e4bff
[EtienneAr feedback] Make visitor for config vector affine transform
Sep 29, 2024
a03462e
[EtienneAr feedback] Move configVectorAffineTransform code to joint-b…
Sep 29, 2024
247fca6
[EtienneAr feedback] Add more test cases for config vector affine tra…
Sep 29, 2024
15e68dd
[EtienneAr feedback] Test affine transform for identity and non ident…
Sep 29, 2024
ac4dab2
[EtienneAr feedback] Cleaner floating point comparison for NoAffineTr…
Sep 29, 2024
2db609a
[EtienneAr feedback] keep original q and v in JointDataMimic
Sep 29, 2024
8f4dae8
[EtienneAr feedback] [Mimic] Set indexes of ref joint to 0
Sep 29, 2024
e92c18e
[EtienneAr feedback] Fix mimic test for slightly new convention of re…
Sep 29, 2024
ae12f5a
[EtienneAr feedback] Fix serialization for mimic joint with setIndexes
Sep 29, 2024
3038327
[bindings] Added mimic to context
Sep 29, 2024
d5c705a
[parser] remove std::cout
Sep 29, 2024
3ebb771
[bindings] BROKEN - Added specialization for mimic joint in bindings
Sep 29, 2024
975eeab
[python] Added jointModelMimicable to context
Sep 29, 2024
cd1b6e5
[bindings] Fix mimic specialization for constructor
Sep 29, 2024
873c705
[context] Added mimicable joint
Sep 29, 2024
57cad9e
[bindings] Finished specialization for mimic
Sep 29, 2024
c62c321
{Joints@ Added mimicable trait
Sep 29, 2024
96bb9b5
[Visitor] Change TransferVariant visitor into checkMimic visitor
Sep 29, 2024
d026343
[Joint] Remove mimicable joint collection
Sep 29, 2024
f019991
[Joint] Use check mimic for jointMimic constructor
Sep 29, 2024
472b1e4
[bindings] Make bindings conform to new jointMimic
Sep 29, 2024
ef49535
[EtienneAr feedback] Make random humanoid with mimic joint
Sep 29, 2024
15c72a3
[EtienneAr feedback] Fix size in jointBlock
Sep 29, 2024
19fbc53
[EtienneAr feedback] Fix mimic serialization for joint_q joint_v
Sep 29, 2024
39453a0
[EtienneAr feedback] Remove problematic testcase for mimic in python
Sep 29, 2024
c226414
[EtienneAr feedback] Add slightly more test on sample models for mimic
Sep 29, 2024
0dbe795
[EtienneAr feedback] Fix rebase conflict
Sep 29, 2024
cbaac3d
[EtienneAr feedback] Activate mimic for joint-jacobian test
Sep 29, 2024
0503b2b
[EtienneAr feedback] Fix some size for mimic col/row selection
Sep 29, 2024
eade4a9
[EtienneAr feedback] Fix joint jacobians computation for mimic
Sep 29, 2024
a6e9ece
[EtienneAr feedback] WiP fix crba malloc
Sep 29, 2024
bc54269
[EtienneAr feedback] Remove temporary variables before return for joi…
Sep 29, 2024
60f8afa
[EtienneAr feedback] Add stack allocation feature for JointMotionSubs…
Sep 29, 2024
224bb98
[CRBA] Update computation of Ag
Sep 29, 2024
ec4cd8a
[EtienneAr feedback] Small serialization fix after changes in JoitMot…
Sep 29, 2024
da56a08
[EtienneAr feedback] Fix on Jcom for mimic
Sep 29, 2024
6026ff7
[EtienneAr feedback] Fix corriolis computation for mimic leading
Sep 29, 2024
da348b9
[EtienneAr feedback] Enable mimic in rnea tests
Sep 29, 2024
2a89bd8
[EtienneAr feedback] Define MaxDim in ScaledJointMotionSubspace and f…
Sep 29, 2024
1a79287
[EtienneAr feedback] Add dedicated mimic test for crba
Sep 29, 2024
5b84fec
[EtienneAr feedback] Template ScaledMotionSubspace on MaxDim
Sep 29, 2024
eab1560
[EtienneAr feedback] Add getRelativePlacement method for kinematics
Sep 29, 2024
792a44d
[EtienneAr feedback] add patch to crba for mimic joints
Sep 29, 2024
91eefa7
[EtienneAr feedback] Update comment and remove hardcoded max size for…
Sep 29, 2024
89aaba9
[EtienneAr feedback] Make random humanoid with mimic joint
Sep 29, 2024
d2cc133
[algorithm/model] Added a function to transform a joint into a mimic
Sep 29, 2024
f7cba6c
[unittest/model] Added test for transformIntoJointMimic
Sep 29, 2024
09fd3b2
Apply pre-commit
Sep 29, 2024
7fcd053
Fix rebase
Sep 29, 2024
3a9d1e9
[Algorithm/model] Remove useless if
Sep 29, 2024
8ae30b2
[EtienneAr feedback] Fix crba in local convention to prevent heap all…
Sep 29, 2024
dc3c69e
[EtienneAr feedback] Add assert for crba in world convention with mim…
Sep 29, 2024
bab0101
[EtienneAr feedback] More exhaustive testing of crba for mimic
Sep 29, 2024
24fcfd8
[EtienneAr feedback] Remove useless override of joint{Config,Velocity…
Sep 29, 2024
aff762f
[EtienneAr feedback] Fix selectConfigFromDof for JointModelTpl in the…
Sep 29, 2024
c04db1a
[EtienneAr feedback] Fix ConfigSelectorFromDof visitor
Sep 29, 2024
d0f6f0c
[EtienneAr feedback] Fix CRBA test for mimic, and remove mimic in wor…
Sep 29, 2024
931859e
[EtienneAr feedback] Fix G matric for mimic crba test
Sep 29, 2024
4431ea0
[EtienneAr feedback] Patch warnings in mimic crba test
Sep 29, 2024
7a72b7a
[Algorithm/crba] Fix world convention for mimic joints
Sep 29, 2024
f0d93ba
fix not working for all cases (spaced and parallel)
Sep 29, 2024
ac410f3
[algo/crba] Fix for crba world (works for spaced and parallel)
Sep 29, 2024
ae14f53
Fix crba world (small issue with parallel joint at the root where the…
Sep 29, 2024
d0e5449
Fix for world convention
Sep 29, 2024
77a63b5
Make centroidal algorithm compatible with mimic and add tests
Sep 29, 2024
c35079d
Add mimic tests to rnea
Sep 29, 2024
1738c46
Add security
Sep 29, 2024
b2b2950
[EtienneAr feedback] Fix getRelativePlacement and add unit test
Sep 29, 2024
6bbf735
Add security
Sep 29, 2024
ae6fca0
[EtienneAr feedback] Fix ForceOperator for generic motion subspace an…
Sep 29, 2024
0290555
[EtienneAr feedback] Patch previous fix on ForceOperator for motion s…
Sep 29, 2024
581c18f
Fix some errrors for com computation
Sep 29, 2024
dca9df9
[Rnea] Patch Algorithms for mimic
Sep 29, 2024
56f37f6
remove mimic joints from test
Sep 29, 2024
b7fd6aa
[unittest/rnea] Add more test
Sep 29, 2024
7ab8e59
Fix tests and remove modification for Coriolis Matrix
Sep 29, 2024
e4ec205
[rnea] Remove useless setZero
Sep 29, 2024
47d525b
[Urdf] Rebase on new pinocchio release
Sep 29, 2024
4e3c44a
Add assert to non supported algorithms
Sep 29, 2024
6a2240b
[algo/crba] Fix local convention for crba
Sep 29, 2024
3123de8
[EtienneAr feedback] Comment local fix for crba and don't use getRela…
Sep 29, 2024
3ee0ab1
[EtienneAr feedback] Add comments to world fix for crba and factorize…
Sep 29, 2024
d51e9c8
Update examples
Sep 30, 2024
171f408
[EtienneAr Feedback] Fix LOCAL enum ambiguity in getRelativePlacement
Oct 1, 2024
9f9705f
[EtienneAr Feedback]Fix Scalar / int confusion for model index
Oct 1, 2024
de56420
[EtienneAr Feedback] Fix explicit ConfigVectorAffineTransformVisitor …
Oct 1, 2024
d61b45b
[EtienneAr Feedback] Fix Scalar / int confusion for joint mimic index
Oct 1, 2024
6141a17
[bindings/urdf] Rebasing
Oct 3, 2024
a7e1aa0
Make code compile with CppAd
Oct 3, 2024
95418a4
[algo/crba] remove double function
Oct 4, 2024
341d290
[unittest/kinematics] Cast to avoid errors
Oct 4, 2024
d04f096
[multibody/geometry] Force scalar to be double
Oct 4, 2024
83bfadf
[multibody/op] Only do comparison when scalar=double
Oct 4, 2024
c069982
Remove compilation warnings
Oct 4, 2024
545d928
Fix crba and some tests for casadi
Oct 4, 2024
c1229d5
[EtienneAr Feedback] Fix Scalar forced to double for GeometryObjects
Oct 6, 2024
4879d7c
[EtienneAr Feedback] Fix casadi test for joint mimic
Oct 7, 2024
614092c
[serialization] Fix template errors
Oct 7, 2024
834438e
Fix examples
Oct 7, 2024
bace865
Fix Serialization
Oct 7, 2024
e68f86f
Fix examples
Oct 7, 2024
bb6d449
[test/rnea] Try fix for windows
Oct 8, 2024
33a135b
[EtienneAr Feedback] Swap import order
Oct 11, 2024
4f9c29a
[EtienneAr Feedback] Fix PINOCCHIO_EXPLICIT_INSTANTIATION DECLARATION…
Oct 11, 2024
637b5a6
[EtienneAr Feedback] Update changelog
Oct 11, 2024
0708f54
[EtienneAr Feedback] Add explicit to single argument constructors
Oct 11, 2024
3acec7b
Applied pre-commit
Oct 11, 2024
ff22808
Fix init problem
Oct 11, 2024
e867702
[algo/jacobian] Fix rebasing
Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Allow use of `pathlib.Path | str` for paths in python bindings ([#2431](https://github.com/stack-of-tasks/pinocchio/pull/2431))
- Add Pseudo inertia and Log-cholesky parametrization ([#2296](https://github.com/stack-of-tasks/pinocchio/pull/2296))
- Add Pixi support ([#2459](https://github.com/stack-of-tasks/pinocchio/pull/2459))
- Extend support for mimic joint: rnea, crba, forward kinematics, centroidal, jacobians and frames ([#2441](https://github.com/stack-of-tasks/pinocchio/pull/2441))
- Add idx_j, nj members in joint models, with their respective column/row/block selectors. ([#2441](https://github.com/stack-of-tasks/pinocchio/pull/2441))

### Fixed
- Fix linkage of Boost.Serialization on Windows ([#2400](https://github.com/stack-of-tasks/pinocchio/pull/2400))
Expand Down
26 changes: 26 additions & 0 deletions bindings/python/multibody/sample-models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,27 @@ namespace pinocchio
return model;
}

Model buildSampleModelHumanoidRandom(bool usingFF, bool mimic)
{
Model model;
buildModels::humanoidRandom(model, usingFF, mimic);
return model;
}

Model buildSampleModelManipulator()
{
Model model;
buildModels::manipulator(model);
return model;
}

Model buildSampleModelManipulator(bool mimic)
{
Model model;
buildModels::manipulator(model, mimic);
return model;
}

#ifdef PINOCCHIO_WITH_HPP_FCL
GeometryModel buildSampleGeometryModelManipulator(const Model & model)
{
Expand Down Expand Up @@ -80,11 +94,23 @@ namespace pinocchio
"Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint "
"placements.\nOnly meant for unit tests.");

bp::def(
"buildSampleModelHumanoidRandom",
static_cast<Model (*)(bool, bool)>(pinocchio::python::buildSampleModelHumanoidRandom),
bp::args("using_free_flyer", "mimic"),
"Generate a (hard-coded) model of a humanoid robot with 6-DOF limbs and random joint "
"placements.\nOnly meant for unit tests.");

bp::def(
"buildSampleModelManipulator",
static_cast<Model (*)()>(pinocchio::python::buildSampleModelManipulator),
"Generate a (hard-coded) model of a simple manipulator.");

bp::def(
"buildSampleModelManipulator",
static_cast<Model (*)(bool)>(pinocchio::python::buildSampleModelManipulator),
bp::args("mimic"), "Generate a (hard-coded) model of a simple manipulator.");

#ifdef PINOCCHIO_WITH_HPP_FCL
bp::def(
"buildSampleGeometryModelManipulator",
Expand Down
138 changes: 88 additions & 50 deletions bindings/python/parsers/urdf/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,94 +20,107 @@ namespace pinocchio

#ifdef PINOCCHIO_WITH_URDFDOM

Model buildModelFromUrdf(const bp::object & filename)
Model buildModelFromUrdf(const bp::object & filename, const bool mimic = false)
{
Model model;
pinocchio::urdf::buildModel(path(filename), model);
pinocchio::urdf::buildModel(path(filename), model, mimic);
return model;
}

Model & buildModelFromUrdf(const bp::object & filename, Model & model)
Model & buildModelFromUrdf(const bp::object & filename, Model & model, const bool mimic = false)
{
return pinocchio::urdf::buildModel(path(filename), model);
return pinocchio::urdf::buildModel(path(filename), model, mimic);
}

Model buildModelFromUrdf(const bp::object & filename, const JointModel & root_joint)
Model buildModelFromUrdf(
const bp::object & filename, const JointModel & root_joint, const bool mimic = false)
{
Model model;
pinocchio::urdf::buildModel(path(filename), root_joint, model);
pinocchio::urdf::buildModel(path(filename), root_joint, model, mimic);
return model;
}

Model buildModelFromUrdf(
const bp::object & filename,
const JointModel & root_joint,
const std::string & root_joint_name)
const std::string & root_joint_name,
const bool mimic = false)
{
Model model;
pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model);
pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model, mimic);
return model;
}

Model &
buildModelFromUrdf(const bp::object & filename, const JointModel & root_joint, Model & model)
Model & buildModelFromUrdf(
const bp::object & filename,
const JointModel & root_joint,
Model & model,
const bool mimic = false)
{
return pinocchio::urdf::buildModel(path(filename), root_joint, model);
return pinocchio::urdf::buildModel(path(filename), root_joint, model, mimic);
}

Model & buildModelFromUrdf(
const bp::object & filename,
const JointModel & root_joint,
const std::string & root_joint_name,
Model & model)
Model & model,
const bool mimic = false)
{
return pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model);
return pinocchio::urdf::buildModel(path(filename), root_joint, root_joint_name, model, mimic);
}

Model buildModelFromXML(const std::string & xml_stream, const JointModel & root_joint)
Model buildModelFromXML(
const std::string & xml_stream, const JointModel & root_joint, const bool mimic = false)
{
Model model;
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model);
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model, mimic);
return model;
}

Model buildModelFromXML(
const std::string & xml_stream,
const JointModel & root_joint,
const std::string & root_joint_name)
const std::string & root_joint_name,
const bool mimic = false)
{
Model model;
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model);
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model, mimic);
return model;
}

Model &
buildModelFromXML(const std::string & xml_stream, const JointModel & root_joint, Model & model)
Model & buildModelFromXML(
const std::string & xml_stream,
const JointModel & root_joint,
Model & model,
const bool mimic = false)
{
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model);
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, model, mimic);
return model;
}

Model & buildModelFromXML(
const std::string & xml_stream,
const JointModel & root_joint,
const std::string & root_joint_name,
Model & model)
Model & model,
const bool mimic = false)
{
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model);
pinocchio::urdf::buildModelFromXML(xml_stream, root_joint, root_joint_name, model, mimic);
return model;
}

Model buildModelFromXML(const std::string & xml_stream)
Model buildModelFromXML(const std::string & xml_stream, const bool mimic = true)
{
Model model;
pinocchio::urdf::buildModelFromXML(xml_stream, model);
pinocchio::urdf::buildModelFromXML(xml_stream, model, mimic);
return model;
}

Model & buildModelFromXML(const std::string & xml_stream, Model & model)
Model &
buildModelFromXML(const std::string & xml_stream, Model & model, const bool mimic = true)
{
pinocchio::urdf::buildModelFromXML(xml_stream, model);
pinocchio::urdf::buildModelFromXML(xml_stream, model, mimic);
return model;
}

Expand All @@ -120,39 +133,41 @@ namespace pinocchio

bp::def(
"buildModelFromUrdf",
static_cast<Model (*)(const bp::object &, const JointModel &)>(
static_cast<Model (*)(const bp::object &, const JointModel &, const bool)>(
pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "root_joint"),
bp::args("urdf_filename", "root_joint", "mimic"),
"Parse the URDF file given in input and return a pinocchio Model starting with the "
"given root joint.");

bp::def(
"buildModelFromUrdf",
static_cast<Model (*)(const bp::object &, const JointModel &, const std::string &)>(
static_cast<Model (*)(
const bp::object &, const JointModel &, const std::string &, const bool)>(
pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "root_joint", "root_joint_name"),
bp::args("urdf_filename", "root_joint", "root_joint_name", "mimic"),
"Parse the URDF file given in input and return a pinocchio Model starting with the "
"given root joint with its specified name.");

bp::def(
"buildModelFromUrdf",
static_cast<Model (*)(const bp::object &)>(pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename"),
static_cast<Model (*)(const bp::object &, const bool)>(
pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "mimic"),
"Parse the URDF file given in input and return a pinocchio Model.");

bp::def(
"buildModelFromUrdf",
static_cast<Model & (*)(const bp::object &, Model &)>(
static_cast<Model & (*)(const bp::object &, Model &, const bool)>(
pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "model"),
bp::args("urdf_filename", "model", "mimic"),
"Append to a given model a URDF structure given by its filename.",
bp::return_internal_reference<2>());

bp::def(
"buildModelFromUrdf",
static_cast<Model & (*)(const bp::object &, const JointModel &, Model &)>(
static_cast<Model & (*)(const bp::object &, const JointModel &, Model &, const bool)>(
pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "root_joint", "model"),
bp::args("urdf_filename", "root_joint", "model", "mimic"),
"Append to a given model a URDF structure given by its filename and the root joint.\n"
"Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
"it is treated as operational frame and not as a joint of the model.",
Expand All @@ -161,8 +176,8 @@ namespace pinocchio
bp::def(
"buildModelFromUrdf",
static_cast<Model & (*)(const bp::object &, const JointModel &, const std::string &,
Model &)>(pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "root_joint", "root_joint_name", "model"),
Model &, const bool)>(pinocchio::python::buildModelFromUrdf),
bp::args("urdf_filename", "root_joint", "root_joint_name", "model", "mimic"),
"Append to a given model a URDF structure given by its filename and the root joint with "
"its specified name.\n"
"Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
Expand All @@ -171,49 +186,72 @@ namespace pinocchio

bp::def(
"buildModelFromXML",
static_cast<Model (*)(const std::string &, const JointModel &)>(
static_cast<Model (*)(const std::string &, const JointModel &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint"),
bp::args("urdf_xml_stream", "root_joint", "mimic"),
"Parse the URDF XML stream given in input and return a pinocchio Model starting with "
"the given root joint.");

bp::def(
"buildModelFromXML",
static_cast<Model (*)(const std::string &, const JointModel &, const std::string &)>(
static_cast<Model (*)(
const std::string &, const JointModel &, const std::string &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "root_joint_name"),
bp::args(
"urdf_xml_stream", "root_joint",
"root_joint_name"
"mimic"),
"Parse the URDF XML stream given in input and return a pinocchio Model starting with "
"the given root joint with its specified name.");

bp::def(
"buildModelFromXML",
static_cast<Model & (*)(const std::string &, const JointModel &, Model &)>(
static_cast<Model (*)(
const std::string &, const JointModel &, const std::string &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "model"),
bp::args("urdf_xml_stream", "root_joint", "root_joint_name", "mimic"),
"Parse the URDF XML stream given in input and return a pinocchio Model starting with "
"the given root joint with its specified name.");

bp::def(
"buildModelFromXML",
static_cast<Model & (*)(const std::string &, const JointModel &, Model &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "model", "mimic"),
"Parse the URDF XML stream given in input and append it to the input model with the "
"given interfacing joint.",
bp::return_internal_reference<3>());

bp::def(
"buildModelFromXML",
static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,
Model &)>(pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "root_joint_name", "model"),
Model &, const bool)>(pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "root_joint_name", "model", "mimic"),
"Parse the URDF XML stream given in input and append it to the input model with the "
"given interfacing joint with its specified name.",
bp::return_internal_reference<3>());

bp::def(
"buildModelFromXML",
static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,
Model &, const bool)>(pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "root_joint", "root_joint_name", "model", "mimic"),
"Parse the URDF XML stream given in input and append it to the input model with the "
"given interfacing joint with its specified name.",
bp::return_internal_reference<3>());

bp::def(
"buildModelFromXML",
static_cast<Model (*)(const std::string &)>(pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream"),
static_cast<Model (*)(const std::string &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "mimic"),
"Parse the URDF XML stream given in input and return a pinocchio Model.");

bp::def(
"buildModelFromXML",
static_cast<Model & (*)(const std::string &, Model &)>(
static_cast<Model & (*)(const std::string &, Model &, const bool)>(
pinocchio::python::buildModelFromXML),
bp::args("urdf_xml_stream", "model"),
bp::args("urdf_xml_stream", "model", "mimic"),
"Parse the URDF XML stream given in input and append it to the input model.",
bp::return_internal_reference<2>());
#endif
Expand Down
18 changes: 14 additions & 4 deletions bindings/python/pinocchio/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def buildModelsFromUrdf(
- verbose - print information of parsing (default - False)
- meshLoader - object used to load meshes (default - hpp::fcl::MeshLoader)
- geometry_types - Which geometry model to load. Can be pin.GeometryType.COLLISION, pin.GeometryType.VISUAL or both. (default - [pin.GeometryType.COLLISION, pin.GeometryType.VISUAL])
- mimic - If urdf mimic joints should be parsed or not (default - False)
Return:
Tuple of the models, in this order : model, collision model, and visual model.

Expand All @@ -34,7 +35,14 @@ def buildModelsFromUrdf(
Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons, it is treated as operational frame and not as a joint of the model.
"""
# Handle the switch from old to new api
arg_keys = ["package_dirs", "root_joint", "verbose", "meshLoader", "geometry_types"]
arg_keys = [
"package_dirs",
"root_joint",
"verbose",
"meshLoader",
"geometry_types",
"mimic",
]
if len(args) >= 3:
if isinstance(args[2], str):
arg_keys = [
Expand All @@ -44,6 +52,7 @@ def buildModelsFromUrdf(
"verbose",
"meshLoader",
"geometry_types",
"mimic",
]

for key, arg in zip(arg_keys, args):
Expand All @@ -63,16 +72,17 @@ def _buildModelsFromUrdf(
verbose=False,
meshLoader=None,
geometry_types=None,
mimic=False,
) -> Tuple[pin.Model, pin.GeometryModel, pin.GeometryModel]:
if geometry_types is None:
geometry_types = [pin.GeometryType.COLLISION, pin.GeometryType.VISUAL]

if root_joint is None:
model = pin.buildModelFromUrdf(filename)
model = pin.buildModelFromUrdf(filename, mimic)
elif root_joint is not None and root_joint_name is None:
model = pin.buildModelFromUrdf(filename, root_joint)
model = pin.buildModelFromUrdf(filename, root_joint, mimic)
else:
model = pin.buildModelFromUrdf(filename, root_joint, root_joint_name)
model = pin.buildModelFromUrdf(filename, root_joint, root_joint_name, mimic)

if verbose and not WITH_HPP_FCL and meshLoader is not None:
print(
Expand Down
Loading
Loading