Skip to content

Commit e5e27a8

Browse files
committed
additional bindings
1 parent b58c919 commit e5e27a8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

python/pyxbot2_interface.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ using rvp = py::return_value_policy;
1313

1414
PYBIND11_MODULE(pyxbot2_interface, m) {
1515

16+
py::class_<ConfigOptions>(m, "ConfigOptions")
17+
.def(py::init<>())
18+
.def("set_urdf", &ConfigOptions::set_urdf)
19+
.def("set_srdf", &ConfigOptions::set_srdf)
20+
.def("set_bool_parameter", &ConfigOptions::set_parameter<bool>)
21+
.def("set_string_parameter", &ConfigOptions::set_parameter<std::string>)
22+
;
23+
1624
py::class_<ControlMode> controlMode(m, "ControlMode");
1725

1826
controlMode
@@ -199,14 +207,21 @@ PYBIND11_MODULE(pyxbot2_interface, m) {
199207
;
200208

201209
py::class_<ModelInterface, XBotInterface, ModelInterface::Ptr>(m, "ModelInterface2")
210+
.def(py::init(py::overload_cast<ConfigOptions>(&ModelInterface::getModel)),
211+
py::arg("cfg"))
202212
.def(py::init(py::overload_cast<std::string, std::string>(&ModelInterface::getModel)),
203-
py::arg("urdf_string"), py::arg("model_type") = "pin")
213+
py::arg("urdf_string"), py::arg("model_type") = "pin")
204214
.def(py::init(py::overload_cast<std::string, std::string, std::string>(&ModelInterface::getModel)),
205215
py::arg("urdf_string"), py::arg("srdf_string"), py::arg("model_type") = "pin")
206216
.def("getType",
207217
&ModelInterface::getType)
208218
.def("update",
209219
&ModelInterface::update)
220+
.def("clone",
221+
[](ModelInterface& self)
222+
{
223+
return ModelInterface::Ptr(self.clone());
224+
})
210225
.def("getJoints",
211226
py::overload_cast<>(&ModelInterface::getJoints, py::const_), rvp::reference_internal)
212227
.def("getJoints",
@@ -279,6 +294,8 @@ PYBIND11_MODULE(pyxbot2_interface, m) {
279294
;
280295

281296
py::class_<RobotInterface, XBotInterface, RobotInterface::Ptr>(m, "RobotInterface2")
297+
.def(py::init(py::overload_cast<ConfigOptions>(&RobotInterface::getRobot)),
298+
py::arg("cfg"))
282299
.def(py::init(py::overload_cast<std::string, std::string, std::string, std::string>(
283300
&RobotInterface::getRobot)),
284301
py::arg("urdf_string"),

0 commit comments

Comments
 (0)