Fix set_to_muscle() to accept tuple arguments.
Correct argument types for timeconst and range parameters in pybind11 python bindings from C arrays to std::array. Fixes #3282, #3282, #3318 Thanks to @Abzaek for original PRs PiperOrigin-RevId: 932423401 Change-Id: Ic30ba076913693f5c0e545789690e8b0fa444390
This commit is contained in:
committed by
Copybara-Service
parent
b1f4656d1a
commit
4e10f20be6
+11
-9
@@ -1577,20 +1577,22 @@ PYBIND11_MODULE(_specs, m) {
|
||||
py::arg("diameter") = -1);
|
||||
mjsActuator.def(
|
||||
"set_to_muscle",
|
||||
[](raw::MjsActuator* self, double timeconst[2], double tausmooth,
|
||||
double range[2], double force, double scale, double lmin, double lmax,
|
||||
double vmax, double fpmax, double fvmax) {
|
||||
[](raw::MjsActuator* self, std::array<double, 2> timeconst,
|
||||
double tausmooth, std::array<double, 2> range, double force,
|
||||
double scale, double lmin, double lmax, double vmax, double fpmax,
|
||||
double fvmax) {
|
||||
std::string err =
|
||||
mjs_setToMuscle(self, timeconst, tausmooth, range, force, scale,
|
||||
lmin, lmax, vmax, fpmax, fvmax);
|
||||
mjs_setToMuscle(self, timeconst.data(), tausmooth, range.data(),
|
||||
force, scale, lmin, lmax, vmax, fpmax, fvmax);
|
||||
if (!err.empty()) {
|
||||
throw pybind11::value_error(err);
|
||||
}
|
||||
},
|
||||
py::arg("timeconst") = -1, py::arg("tausmooth"),
|
||||
py::arg("range") = std::array<double, 2>{-1, -1}, py::arg("force") = -1,
|
||||
py::arg("scale") = -1, py::arg("lmin") = -1, py::arg("lmax") = -1,
|
||||
py::arg("vmax") = -1, py::arg("fpmax") = -1, py::arg("fvmax") = -1);
|
||||
py::arg("timeconst") = std::array<double, 2>{-1, -1},
|
||||
py::arg("tausmooth"), py::arg("range") = std::array<double, 2>{-1, -1},
|
||||
py::arg("force") = -1, py::arg("scale") = -1, py::arg("lmin") = -1,
|
||||
py::arg("lmax") = -1, py::arg("vmax") = -1, py::arg("fpmax") = -1,
|
||||
py::arg("fvmax") = -1);
|
||||
mjsActuator.def(
|
||||
"set_to_adhesion",
|
||||
[](raw::MjsActuator* self, double gain) {
|
||||
|
||||
Reference in New Issue
Block a user