Skip to content

Commit c6671b5

Browse files
author
Megane Millan
committed
[bindings/parser] reintroduce old signature to not break api
1 parent 921a902 commit c6671b5

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

bindings/python/parsers/mjcf/model.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ namespace pinocchio
2121
return model;
2222
}
2323

24+
Model buildModelFromMJCF(const std::string & filename, const JointModel & root_joint)
25+
{
26+
Model model;
27+
::pinocchio::mjcf::buildModel(filename, root_joint, "root_joint", model);
28+
return model;
29+
}
30+
2431
Model buildModelFromMJCF(
2532
const std::string & filename,
2633
const JointModel & root_joint,
@@ -39,6 +46,13 @@ namespace pinocchio
3946
bp::args("mjcf_filename"),
4047
"Parse the MJCF file given in input and return a pinocchio Model.");
4148

49+
bp::def(
50+
"buildModelFromMJCF",
51+
static_cast<Model (*)(const std::string &, const JointModel &)>(
52+
pinocchio::python::buildModelFromMJCF),
53+
bp::args("mjcf_filename", "root_joint"),
54+
"Parse the MJCF file and return a pinocchio Model with the given root Joint and its name.");
55+
4256
bp::def(
4357
"buildModelFromMJCF",
4458
static_cast<Model (*)(const std::string &, const JointModel &, const std::string &)>(

bindings/python/parsers/sdf/model.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ namespace pinocchio
3030
return bp::make_tuple(model, contact_models);
3131
}
3232

33+
bp::tuple buildModelFromSdf(
34+
const std::string & filename,
35+
const JointModel & root_joint,
36+
const std::string & root_link_name,
37+
const std::vector<std::string> & parent_guidance)
38+
{
39+
Model model;
40+
PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel) contact_models;
41+
pinocchio::sdf::buildModel(
42+
filename, root_joint, "root_joint", model, contact_models, root_link_name, parent_guidance);
43+
return bp::make_tuple(model, contact_models);
44+
}
45+
3346
bp::tuple buildModelFromSdf(
3447
const std::string & filename,
3548
const JointModel & root_joint,
@@ -58,6 +71,16 @@ namespace pinocchio
5871
bp::arg("parent_guidance") = bp::list()),
5972
"Parse the SDF file given in input and return a pinocchio Model and constraint models.");
6073

74+
bp::def(
75+
"buildModelFromSdf",
76+
static_cast<bp::tuple (*)(
77+
const std::string &, const JointModel &, const std::string &,
78+
const std::vector<std::string> &)>(pinocchio::python::buildModelFromSdf),
79+
(bp::arg("sdf_filename"), bp::arg("root_joint"), bp::arg("root_link_name"),
80+
bp::arg("parent_guidance") = bp::list()),
81+
"Parse the SDF file given in input and return a pinocchio Model and constraint "
82+
"models starting with the given root joint.");
83+
6184
bp::def(
6285
"buildModelFromSdf",
6386
static_cast<bp::tuple (*)(

bindings/python/parsers/urdf/model.cpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ namespace pinocchio
3131
return pinocchio::urdf::buildModel(filename, model);
3232
}
3333

34+
Model buildModelFromUrdf(const std::string & filename, const JointModel & root_joint)
35+
{
36+
Model model;
37+
pinocchio::urdf::buildModel(filename, root_joint, "root_joint", model);
38+
return model;
39+
}
40+
3441
Model buildModelFromUrdf(
3542
const std::string & filename,
3643
const JointModel & root_joint,
@@ -41,6 +48,12 @@ namespace pinocchio
4148
return model;
4249
}
4350

51+
Model &
52+
buildModelFromUrdf(const std::string & filename, const JointModel & root_joint, Model & model)
53+
{
54+
return pinocchio::urdf::buildModel(filename, root_joint, "root_joint", model);
55+
}
56+
4457
Model & buildModelFromUrdf(
4558
const std::string & filename,
4659
const JointModel & root_joint,
@@ -50,6 +63,13 @@ namespace pinocchio
5063
return pinocchio::urdf::buildModel(filename, root_joint, rootJointName, model);
5164
}
5265

66+
Model buildModelFromXML(const std::string & XMLstream, const JointModel & root_joint)
67+
{
68+
Model model;
69+
pinocchio::urdf::buildModelFromXML(XMLstream, root_joint, "root_joint", model);
70+
return model;
71+
}
72+
5373
Model buildModelFromXML(
5474
const std::string & XMLstream,
5575
const JointModel & root_joint,
@@ -60,6 +80,13 @@ namespace pinocchio
6080
return model;
6181
}
6282

83+
Model &
84+
buildModelFromXML(const std::string & XMLstream, const JointModel & root_joint, Model & model)
85+
{
86+
pinocchio::urdf::buildModelFromXML(XMLstream, root_joint, "root_joint", model);
87+
return model;
88+
}
89+
6390
Model & buildModelFromXML(
6491
const std::string & XMLstream,
6592
const JointModel & root_joint,
@@ -90,6 +117,14 @@ namespace pinocchio
90117

91118
#ifdef PINOCCHIO_WITH_URDFDOM
92119

120+
bp::def(
121+
"buildModelFromUrdf",
122+
static_cast<Model (*)(const std::string &, const JointModel &)>(
123+
pinocchio::python::buildModelFromUrdf),
124+
bp::args("urdf_filename", "root_joint"),
125+
"Parse the URDF file given in input and return a pinocchio Model starting with the "
126+
"given root joint.");
127+
93128
bp::def(
94129
"buildModelFromUrdf",
95130
static_cast<Model (*)(const std::string &, const JointModel &, const std::string &)>(
@@ -112,6 +147,16 @@ namespace pinocchio
112147
"Append to a given model a URDF structure given by its filename.",
113148
bp::return_internal_reference<2>());
114149

150+
bp::def(
151+
"buildModelFromUrdf",
152+
static_cast<Model & (*)(const std::string &, const JointModel &, Model &)>(
153+
pinocchio::python::buildModelFromUrdf),
154+
bp::args("urdf_filename", "root_joint", "model"),
155+
"Append to a given model a URDF structure given by its filename and the root joint.\n"
156+
"Remark: In the URDF format, a joint of type fixed can be defined. For efficiency reasons,"
157+
"it is treated as operational frame and not as a joint of the model.",
158+
bp::return_internal_reference<3>());
159+
115160
bp::def(
116161
"buildModelFromUrdf",
117162
static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,
@@ -122,6 +167,14 @@ namespace pinocchio
122167
"it is treated as operational frame and not as a joint of the model.",
123168
bp::return_internal_reference<3>());
124169

170+
bp::def(
171+
"buildModelFromXML",
172+
static_cast<Model (*)(const std::string &, const JointModel &)>(
173+
pinocchio::python::buildModelFromXML),
174+
bp::args("urdf_xml_stream", "root_joint"),
175+
"Parse the URDF XML stream given in input and return a pinocchio Model starting with "
176+
"the given root joint.");
177+
125178
bp::def(
126179
"buildModelFromXML",
127180
static_cast<Model (*)(const std::string &, const JointModel &, const std::string &)>(
@@ -130,6 +183,15 @@ namespace pinocchio
130183
"Parse the URDF XML stream given in input and return a pinocchio Model starting with "
131184
"the given root joint.");
132185

186+
bp::def(
187+
"buildModelFromXML",
188+
static_cast<Model & (*)(const std::string &, const JointModel &, Model &)>(
189+
pinocchio::python::buildModelFromXML),
190+
bp::args("urdf_xml_stream", "root_joint", "model"),
191+
"Parse the URDF XML stream given in input and append it to the input model with the "
192+
"given interfacing joint.",
193+
bp::return_internal_reference<3>());
194+
133195
bp::def(
134196
"buildModelFromXML",
135197
static_cast<Model & (*)(const std::string &, const JointModel &, const std::string &,

0 commit comments

Comments
 (0)