Add spec find_sensor, find_actuator functions.

PiperOrigin-RevId: 703054696
Change-Id: Ie384f1a31de3ecd9b22b7f4be43234d452e7bb88
This commit is contained in:
Alessio Quaglino
2024-12-05 03:41:30 -08:00
committed by Copybara-Service
parent f882f4b065
commit a729acb4fa
2 changed files with 30 additions and 0 deletions
+14
View File
@@ -350,6 +350,20 @@ PYBIND11_MODULE(_specs, m) {
return mjs_asSite(mjs_findElement(self.ptr, mjOBJ_SITE, name.c_str()));
},
py::return_value_policy::reference_internal);
mjSpec.def(
"find_actuator",
[](MjSpec& self, std::string& name) -> raw::MjsActuator* {
return mjs_asActuator(
mjs_findElement(self.ptr, mjOBJ_ACTUATOR, name.c_str()));
},
py::return_value_policy::reference_internal);
mjSpec.def(
"find_sensor",
[](MjSpec& self, std::string& name) -> raw::MjsSensor* {
return mjs_asSensor(
mjs_findElement(self.ptr, mjOBJ_SENSOR, name.c_str()));
},
py::return_value_policy::reference_internal);
mjSpec.def(
"find_default",
[](MjSpec& self, std::string& classname) -> const raw::MjsDefault* {