| 1 |
/* |
| 2 |
* Copyright (c) 2011-2022, The DART development contributors |
| 3 |
* All rights reserved. |
| 4 |
* |
| 5 |
* The list of contributors can be found at: |
| 6 |
* https://github.com/dartsim/dart/blob/master/LICENSE |
| 7 |
* |
| 8 |
* This file is provided under the following "BSD-style" License: |
| 9 |
* Redistribution and use in source and binary forms, with or |
| 10 |
* without modification, are permitted provided that the following |
| 11 |
* conditions are met: |
| 12 |
* * Redistributions of source code must retain the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer. |
| 14 |
* * Redistributions in binary form must reproduce the above |
| 15 |
* copyright notice, this list of conditions and the following |
| 16 |
* disclaimer in the documentation and/or other materials provided |
| 17 |
* with the distribution. |
| 18 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 19 |
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 20 |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 21 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 23 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 26 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 27 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 29 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 |
* POSSIBILITY OF SUCH DAMAGE. |
| 31 |
*/ |
| 32 |
|
| 33 |
#include <dart/dart.hpp> |
| 34 |
#include <eigen_geometry_pybind.h> |
| 35 |
#include <pybind11/eigen.h> |
| 36 |
#include <pybind11/pybind11.h> |
| 37 |
|
| 38 |
namespace py = pybind11; |
| 39 |
|
| 40 |
namespace dart { |
| 41 |
namespace python { |
| 42 |
|
| 43 |
void Joint(py::module& m) |
| 44 |
{ |
| 45 |
::py::class_<dart::dynamics::detail::JointProperties>(m, "JointProperties") |
| 46 |
.def(::py::init<>()) |
| 47 |
.def(::py::init<const std::string&>(), ::py::arg("name")) |
| 48 |
.def_readwrite("mName", &dart::dynamics::detail::JointProperties::mName) |
| 49 |
.def_readwrite( |
| 50 |
"mT_ParentBodyToJoint", |
| 51 |
&dart::dynamics::detail::JointProperties::mT_ParentBodyToJoint) |
| 52 |
.def_readwrite( |
| 53 |
"mT_ChildBodyToJoint", |
| 54 |
&dart::dynamics::detail::JointProperties::mT_ChildBodyToJoint) |
| 55 |
.def_readwrite( |
| 56 |
"mIsPositionLimitEnforced", |
| 57 |
&dart::dynamics::detail::JointProperties::mIsPositionLimitEnforced) |
| 58 |
.def_readwrite( |
| 59 |
"mActuatorType", |
| 60 |
&dart::dynamics::detail::JointProperties::mActuatorType) |
| 61 |
.def_readwrite( |
| 62 |
"mMimicJoint", &dart::dynamics::detail::JointProperties::mMimicJoint) |
| 63 |
.def_readwrite( |
| 64 |
"mMimicMultiplier", |
| 65 |
&dart::dynamics::detail::JointProperties::mMimicMultiplier) |
| 66 |
.def_readwrite( |
| 67 |
"mMimicOffset", |
| 68 |
&dart::dynamics::detail::JointProperties::mMimicOffset); |
| 69 |
|
| 70 |
::py::class_< |
| 71 |
dart::common::SpecializedForAspect<dart::common::EmbeddedPropertiesAspect< |
| 72 |
dart::dynamics::Joint, |
| 73 |
dart::dynamics::detail::JointProperties>>, |
| 74 |
dart::common::Composite, |
| 75 |
std::shared_ptr<dart::common::SpecializedForAspect< |
| 76 |
dart::common::EmbeddedPropertiesAspect< |
| 77 |
dart::dynamics::Joint, |
| 78 |
dart::dynamics::detail::JointProperties>>>>( |
| 79 |
m, "SpecializedForAspect_EmbeddedPropertiesAspect_Joint_JointProperties") |
| 80 |
.def(::py::init<>()); |
| 81 |
|
| 82 |
::py::class_< |
| 83 |
dart::common::RequiresAspect<dart::common::EmbeddedPropertiesAspect< |
| 84 |
dart::dynamics::Joint, |
| 85 |
dart::dynamics::detail::JointProperties>>, |
| 86 |
dart::common::SpecializedForAspect<dart::common::EmbeddedPropertiesAspect< |
| 87 |
dart::dynamics::Joint, |
| 88 |
dart::dynamics::detail::JointProperties>>, |
| 89 |
std::shared_ptr< |
| 90 |
dart::common::RequiresAspect<dart::common::EmbeddedPropertiesAspect< |
| 91 |
dart::dynamics::Joint, |
| 92 |
dart::dynamics::detail::JointProperties>>>>( |
| 93 |
m, "RequiresAspect_EmbeddedPropertiesAspect_Joint_JointProperties") |
| 94 |
.def(::py::init<>()); |
| 95 |
|
| 96 |
::py::class_< |
| 97 |
dart::common::EmbedProperties< |
| 98 |
dart::dynamics::Joint, |
| 99 |
dart::dynamics::detail::JointProperties>, |
| 100 |
dart::common::RequiresAspect<dart::common::EmbeddedPropertiesAspect< |
| 101 |
dart::dynamics::Joint, |
| 102 |
dart::dynamics::detail::JointProperties>>, |
| 103 |
std::shared_ptr<dart::common::EmbedProperties< |
| 104 |
dart::dynamics::Joint, |
| 105 |
dart::dynamics::detail::JointProperties>>>( |
| 106 |
m, "EmbedProperties_Joint_JointProperties"); |
| 107 |
|
| 108 |
::py::class_< |
| 109 |
dart::dynamics::Joint, |
| 110 |
dart::common::Subject, |
| 111 |
dart::common::EmbedProperties< |
| 112 |
dart::dynamics::Joint, |
| 113 |
dart::dynamics::detail::JointProperties>, |
| 114 |
std::shared_ptr<dart::dynamics::Joint>>(m, "Joint") |
| 115 |
.def( |
| 116 |
"hasJointAspect", |
| 117 |
+[](const dart::dynamics::Joint* self) -> bool { |
| 118 |
return self->hasJointAspect(); |
| 119 |
}) |
| 120 |
.def( |
| 121 |
"setJointAspect", |
| 122 |
+[](dart::dynamics::Joint* self, |
| 123 |
const dart::common::EmbedProperties< |
| 124 |
dart::dynamics::Joint, |
| 125 |
dart::dynamics::detail::JointProperties>::Aspect* aspect) |
| 126 |
-> void { return self->setJointAspect(aspect); }, |
| 127 |
::py::arg("aspect")) |
| 128 |
.def( |
| 129 |
"removeJointAspect", |
| 130 |
+[](dart::dynamics::Joint* self) -> void { |
| 131 |
return self->removeJointAspect(); |
| 132 |
}) |
| 133 |
.def( |
| 134 |
"releaseJointAspect", |
| 135 |
+[](dart::dynamics::Joint* self) |
| 136 |
-> std::unique_ptr<dart::common::EmbedProperties< |
| 137 |
dart::dynamics::Joint, |
| 138 |
dart::dynamics::detail::JointProperties>::Aspect> { |
| 139 |
return self->releaseJointAspect(); |
| 140 |
}) |
| 141 |
.def( |
| 142 |
"setProperties", |
| 143 |
+[](dart::dynamics::Joint* self, |
| 144 |
const dart::dynamics::Joint::Properties& properties) -> void { |
| 145 |
return self->setProperties(properties); |
| 146 |
}, |
| 147 |
::py::arg("properties")) |
| 148 |
.def( |
| 149 |
"setAspectProperties", |
| 150 |
+[](dart::dynamics::Joint* self, |
| 151 |
const dart::common::EmbedProperties< |
| 152 |
dart::dynamics::Joint, |
| 153 |
dart::dynamics::detail::JointProperties>::AspectProperties& |
| 154 |
properties) -> void { |
| 155 |
return self->setAspectProperties(properties); |
| 156 |
}, |
| 157 |
::py::arg("properties")) |
| 158 |
.def( |
| 159 |
"copy", |
| 160 |
+[](dart::dynamics::Joint* self, |
| 161 |
const dart::dynamics::Joint& otherJoint) -> void { |
| 162 |
return self->copy(otherJoint); |
| 163 |
}, |
| 164 |
::py::arg("otherJoint")) |
| 165 |
.def( |
| 166 |
"copy", |
| 167 |
+[](dart::dynamics::Joint* self, |
| 168 |
const dart::dynamics::Joint* otherJoint) -> void { |
| 169 |
return self->copy(otherJoint); |
| 170 |
}, |
| 171 |
::py::arg("otherJoint")) |
| 172 |
.def( |
| 173 |
"setName", |
| 174 |
+[](dart::dynamics::Joint* self, const std::string& name) |
| 175 |
-> const std::string& { return self->setName(name); }, |
| 176 |
::py::return_value_policy::reference_internal, |
| 177 |
::py::arg("name")) |
| 178 |
.def( |
| 179 |
"setName", |
| 180 |
+[](dart::dynamics::Joint* self, |
| 181 |
const std::string& name, |
| 182 |
bool renameDofs) -> const std::string& { |
| 183 |
return self->setName(name, renameDofs); |
| 184 |
}, |
| 185 |
::py::return_value_policy::reference_internal, |
| 186 |
::py::arg("name"), |
| 187 |
::py::arg("renameDofs")) |
| 188 |
.def( |
| 189 |
"getName", |
| 190 |
+[](const dart::dynamics::Joint* self) -> const std::string& { |
| 191 |
return self->getName(); |
| 192 |
}, |
| 193 |
::py::return_value_policy::reference_internal) |
| 194 |
.def( |
| 195 |
"getType", |
| 196 |
+[](const dart::dynamics::Joint* self) -> const std::string& { |
| 197 |
return self->getType(); |
| 198 |
}, |
| 199 |
::py::return_value_policy::reference_internal) |
| 200 |
.def( |
| 201 |
"setActuatorType", |
| 202 |
+[](dart::dynamics::Joint* self, |
| 203 |
dart::dynamics::Joint::ActuatorType actuatorType) -> void { |
| 204 |
return self->setActuatorType(actuatorType); |
| 205 |
}, |
| 206 |
::py::arg("actuatorType")) |
| 207 |
.def( |
| 208 |
"getActuatorType", |
| 209 |
+[](const dart::dynamics::Joint* self) |
| 210 |
-> dart::dynamics::Joint::ActuatorType { |
| 211 |
return self->getActuatorType(); |
| 212 |
}) |
| 213 |
.def( |
| 214 |
"isKinematic", |
| 215 |
+[](const dart::dynamics::Joint* self) -> bool { |
| 216 |
return self->isKinematic(); |
| 217 |
}) |
| 218 |
.def( |
| 219 |
"isDynamic", |
| 220 |
+[](const dart::dynamics::Joint* self) -> bool { |
| 221 |
return self->isDynamic(); |
| 222 |
}) |
| 223 |
.def( |
| 224 |
"getChildBodyNode", |
| 225 |
+[](dart::dynamics::Joint* self) -> dart::dynamics::BodyNode* { |
| 226 |
return self->getChildBodyNode(); |
| 227 |
}, |
| 228 |
::py::return_value_policy::reference_internal) |
| 229 |
.def( |
| 230 |
"getParentBodyNode", |
| 231 |
+[](dart::dynamics::Joint* self) -> dart::dynamics::BodyNode* { |
| 232 |
return self->getParentBodyNode(); |
| 233 |
}, |
| 234 |
::py::return_value_policy::reference_internal) |
| 235 |
.def( |
| 236 |
"getSkeleton", |
| 237 |
+[](dart::dynamics::Joint* self) -> dart::dynamics::SkeletonPtr { |
| 238 |
return self->getSkeleton(); |
| 239 |
}) |
| 240 |
.def( |
| 241 |
"getSkeleton", |
| 242 |
+[](const dart::dynamics::Joint* self) |
| 243 |
-> std::shared_ptr<const dart::dynamics::Skeleton> { |
| 244 |
return self->getSkeleton(); |
| 245 |
}) |
| 246 |
.def( |
| 247 |
"setTransformFromParentBodyNode", |
| 248 |
+[](dart::dynamics::Joint* self, const Eigen::Isometry3d& T) -> void { |
| 249 |
return self->setTransformFromParentBodyNode(T); |
| 250 |
}, |
| 251 |
::py::arg("T")) |
| 252 |
.def( |
| 253 |
"setTransformFromChildBodyNode", |
| 254 |
+[](dart::dynamics::Joint* self, const Eigen::Isometry3d& T) -> void { |
| 255 |
return self->setTransformFromChildBodyNode(T); |
| 256 |
}, |
| 257 |
::py::arg("T")) |
| 258 |
.def( |
| 259 |
"getTransformFromParentBodyNode", |
| 260 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Isometry3d& { |
| 261 |
return self->getTransformFromParentBodyNode(); |
| 262 |
}) |
| 263 |
.def( |
| 264 |
"getTransformFromChildBodyNode", |
| 265 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Isometry3d& { |
| 266 |
return self->getTransformFromChildBodyNode(); |
| 267 |
}) |
| 268 |
.def( |
| 269 |
"setLimitEnforcement", |
| 270 |
+[](dart::dynamics::Joint* self, bool enforce) -> void { |
| 271 |
return self->setLimitEnforcement(enforce); |
| 272 |
}, |
| 273 |
::py::arg("enforced")) |
| 274 |
.def( |
| 275 |
"areLimitsEnforced", |
| 276 |
+[](const dart::dynamics::Joint* self) -> bool { |
| 277 |
return self->areLimitsEnforced(); |
| 278 |
}) |
| 279 |
.def( |
| 280 |
"getIndexInSkeleton", |
| 281 |
+[](const dart::dynamics::Joint* self, std::size_t index) |
| 282 |
-> std::size_t { return self->getIndexInSkeleton(index); }, |
| 283 |
::py::arg("index")) |
| 284 |
.def( |
| 285 |
"getIndexInTree", |
| 286 |
+[](const dart::dynamics::Joint* self, std::size_t index) |
| 287 |
-> std::size_t { return self->getIndexInTree(index); }, |
| 288 |
::py::arg("index")) |
| 289 |
.def( |
| 290 |
"getJointIndexInSkeleton", |
| 291 |
+[](const dart::dynamics::Joint* self) -> std::size_t { |
| 292 |
return self->getJointIndexInSkeleton(); |
| 293 |
}) |
| 294 |
.def( |
| 295 |
"getJointIndexInTree", |
| 296 |
+[](const dart::dynamics::Joint* self) -> std::size_t { |
| 297 |
return self->getJointIndexInTree(); |
| 298 |
}) |
| 299 |
.def( |
| 300 |
"getTreeIndex", |
| 301 |
+[](const dart::dynamics::Joint* self) -> std::size_t { |
| 302 |
return self->getTreeIndex(); |
| 303 |
}) |
| 304 |
.def( |
| 305 |
"setDofName", |
| 306 |
+[](dart::dynamics::Joint* self, |
| 307 |
std::size_t index, |
| 308 |
const std::string& name) -> const std::string& { |
| 309 |
return self->setDofName(index, name); |
| 310 |
}, |
| 311 |
::py::return_value_policy::reference_internal, |
| 312 |
::py::arg("index"), |
| 313 |
::py::arg("name")) |
| 314 |
.def( |
| 315 |
"setDofName", |
| 316 |
+[](dart::dynamics::Joint* self, |
| 317 |
std::size_t index, |
| 318 |
const std::string& name, |
| 319 |
bool preserveName) -> const std::string& { |
| 320 |
return self->setDofName(index, name, preserveName); |
| 321 |
}, |
| 322 |
::py::return_value_policy::reference_internal, |
| 323 |
::py::arg("index"), |
| 324 |
::py::arg("name"), |
| 325 |
::py::arg("preserveName")) |
| 326 |
.def( |
| 327 |
"preserveDofName", |
| 328 |
+[](dart::dynamics::Joint* self, std::size_t index, bool preserve) |
| 329 |
-> void { return self->preserveDofName(index, preserve); }, |
| 330 |
::py::arg("index"), |
| 331 |
::py::arg("preserve")) |
| 332 |
.def( |
| 333 |
"isDofNamePreserved", |
| 334 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> bool { |
| 335 |
return self->isDofNamePreserved(index); |
| 336 |
}, |
| 337 |
::py::arg("index")) |
| 338 |
.def( |
| 339 |
"getDofName", |
| 340 |
+[](const dart::dynamics::Joint* self, std::size_t index) |
| 341 |
-> const std::string& { return self->getDofName(index); }, |
| 342 |
::py::return_value_policy::reference_internal, |
| 343 |
::py::arg("index")) |
| 344 |
.def( |
| 345 |
"getNumDofs", |
| 346 |
+[](const dart::dynamics::Joint* self) |
| 347 |
-> std::size_t { return self->getNumDofs(); }) |
| 348 |
.def( |
| 349 |
"setCommand", |
| 350 |
+[](dart::dynamics::Joint* self, std::size_t index, double command) |
| 351 |
-> void { return self->setCommand(index, command); }, |
| 352 |
::py::arg("index"), |
| 353 |
::py::arg("command")) |
| 354 |
.def( |
| 355 |
"getCommand", |
| 356 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 357 |
return self->getCommand(index); |
| 358 |
}, |
| 359 |
::py::arg("index")) |
| 360 |
.def( |
| 361 |
"setCommands", |
| 362 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& commands) |
| 363 |
-> void { return self->setCommands(commands); }, |
| 364 |
::py::arg("commands")) |
| 365 |
.def( |
| 366 |
"getCommands", |
| 367 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 368 |
return self->getCommands(); |
| 369 |
}) |
| 370 |
.def( |
| 371 |
"resetCommands", |
| 372 |
+[](dart::dynamics::Joint* self) |
| 373 |
-> void { return self->resetCommands(); }) |
| 374 |
.def( |
| 375 |
"setPosition", |
| 376 |
+[](dart::dynamics::Joint* self, std::size_t index, double position) |
| 377 |
-> void { return self->setPosition(index, position); }, |
| 378 |
::py::arg("index"), |
| 379 |
::py::arg("position")) |
| 380 |
.def( |
| 381 |
"getPosition", |
| 382 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 383 |
return self->getPosition(index); |
| 384 |
}, |
| 385 |
::py::arg("index")) |
| 386 |
.def( |
| 387 |
"setPositions", |
| 388 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& positions) |
| 389 |
-> void { return self->setPositions(positions); }, |
| 390 |
::py::arg("positions")) |
| 391 |
.def( |
| 392 |
"getPositions", |
| 393 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 394 |
return self->getPositions(); |
| 395 |
}) |
| 396 |
.def( |
| 397 |
"setPositionLowerLimit", |
| 398 |
+[](dart::dynamics::Joint* self, std::size_t index, double position) |
| 399 |
-> void { return self->setPositionLowerLimit(index, position); }, |
| 400 |
::py::arg("index"), |
| 401 |
::py::arg("position")) |
| 402 |
.def( |
| 403 |
"getPositionLowerLimit", |
| 404 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 405 |
return self->getPositionLowerLimit(index); |
| 406 |
}, |
| 407 |
::py::arg("index")) |
| 408 |
.def( |
| 409 |
"setPositionLowerLimits", |
| 410 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& lowerLimits) |
| 411 |
-> void { return self->setPositionLowerLimits(lowerLimits); }, |
| 412 |
::py::arg("lowerLimits")) |
| 413 |
.def( |
| 414 |
"getPositionLowerLimits", |
| 415 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 416 |
return self->getPositionLowerLimits(); |
| 417 |
}) |
| 418 |
.def( |
| 419 |
"setPositionUpperLimit", |
| 420 |
+[](dart::dynamics::Joint* self, std::size_t index, double position) |
| 421 |
-> void { return self->setPositionUpperLimit(index, position); }, |
| 422 |
::py::arg("index"), |
| 423 |
::py::arg("position")) |
| 424 |
.def( |
| 425 |
"getPositionUpperLimit", |
| 426 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 427 |
return self->getPositionUpperLimit(index); |
| 428 |
}, |
| 429 |
::py::arg("index")) |
| 430 |
.def( |
| 431 |
"setPositionUpperLimits", |
| 432 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& upperLimits) |
| 433 |
-> void { return self->setPositionUpperLimits(upperLimits); }, |
| 434 |
::py::arg("upperLimits")) |
| 435 |
.def( |
| 436 |
"getPositionUpperLimits", |
| 437 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 438 |
return self->getPositionUpperLimits(); |
| 439 |
}) |
| 440 |
.def( |
| 441 |
"isCyclic", |
| 442 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> bool { |
| 443 |
return self->isCyclic(index); |
| 444 |
}, |
| 445 |
::py::arg("index")) |
| 446 |
.def( |
| 447 |
"hasPositionLimit", |
| 448 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> bool { |
| 449 |
return self->hasPositionLimit(index); |
| 450 |
}, |
| 451 |
::py::arg("index")) |
| 452 |
.def( |
| 453 |
"resetPosition", |
| 454 |
+[](dart::dynamics::Joint* self, std::size_t index) -> void { |
| 455 |
return self->resetPosition(index); |
| 456 |
}, |
| 457 |
::py::arg("index")) |
| 458 |
.def( |
| 459 |
"resetPositions", |
| 460 |
+[](dart::dynamics::Joint* self) |
| 461 |
-> void { return self->resetPositions(); }) |
| 462 |
.def( |
| 463 |
"setInitialPosition", |
| 464 |
+[](dart::dynamics::Joint* self, std::size_t index, double initial) |
| 465 |
-> void { return self->setInitialPosition(index, initial); }, |
| 466 |
::py::arg("index"), |
| 467 |
::py::arg("initial")) |
| 468 |
.def( |
| 469 |
"getInitialPosition", |
| 470 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 471 |
return self->getInitialPosition(index); |
| 472 |
}, |
| 473 |
::py::arg("index")) |
| 474 |
.def( |
| 475 |
"setInitialPositions", |
| 476 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& initial) |
| 477 |
-> void { return self->setInitialPositions(initial); }, |
| 478 |
::py::arg("initial")) |
| 479 |
.def( |
| 480 |
"getInitialPositions", |
| 481 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 482 |
return self->getInitialPositions(); |
| 483 |
}) |
| 484 |
.def( |
| 485 |
"setVelocity", |
| 486 |
+[](dart::dynamics::Joint* self, std::size_t index, double velocity) |
| 487 |
-> void { return self->setVelocity(index, velocity); }, |
| 488 |
::py::arg("index"), |
| 489 |
::py::arg("velocity")) |
| 490 |
.def( |
| 491 |
"getVelocity", |
| 492 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 493 |
return self->getVelocity(index); |
| 494 |
}, |
| 495 |
::py::arg("index")) |
| 496 |
.def( |
| 497 |
"setVelocities", |
| 498 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& velocities) |
| 499 |
-> void { return self->setVelocities(velocities); }, |
| 500 |
::py::arg("velocities")) |
| 501 |
.def( |
| 502 |
"getVelocities", |
| 503 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 504 |
return self->getVelocities(); |
| 505 |
}) |
| 506 |
.def( |
| 507 |
"setVelocityLowerLimit", |
| 508 |
+[](dart::dynamics::Joint* self, std::size_t index, double velocity) |
| 509 |
-> void { return self->setVelocityLowerLimit(index, velocity); }, |
| 510 |
::py::arg("index"), |
| 511 |
::py::arg("velocity")) |
| 512 |
.def( |
| 513 |
"getVelocityLowerLimit", |
| 514 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 515 |
return self->getVelocityLowerLimit(index); |
| 516 |
}, |
| 517 |
::py::arg("index")) |
| 518 |
.def( |
| 519 |
"setVelocityLowerLimits", |
| 520 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& lowerLimits) |
| 521 |
-> void { return self->setVelocityLowerLimits(lowerLimits); }, |
| 522 |
::py::arg("lowerLimits")) |
| 523 |
.def( |
| 524 |
"getVelocityLowerLimits", |
| 525 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 526 |
return self->getVelocityLowerLimits(); |
| 527 |
}) |
| 528 |
.def( |
| 529 |
"setVelocityUpperLimit", |
| 530 |
+[](dart::dynamics::Joint* self, std::size_t index, double velocity) |
| 531 |
-> void { return self->setVelocityUpperLimit(index, velocity); }, |
| 532 |
::py::arg("index"), |
| 533 |
::py::arg("velocity")) |
| 534 |
.def( |
| 535 |
"getVelocityUpperLimit", |
| 536 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 537 |
return self->getVelocityUpperLimit(index); |
| 538 |
}, |
| 539 |
::py::arg("index")) |
| 540 |
.def( |
| 541 |
"setVelocityUpperLimits", |
| 542 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& upperLimits) |
| 543 |
-> void { return self->setVelocityUpperLimits(upperLimits); }, |
| 544 |
::py::arg("upperLimits")) |
| 545 |
.def( |
| 546 |
"getVelocityUpperLimits", |
| 547 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 548 |
return self->getVelocityUpperLimits(); |
| 549 |
}) |
| 550 |
.def( |
| 551 |
"resetVelocity", |
| 552 |
+[](dart::dynamics::Joint* self, std::size_t index) -> void { |
| 553 |
return self->resetVelocity(index); |
| 554 |
}, |
| 555 |
::py::arg("index")) |
| 556 |
.def( |
| 557 |
"resetVelocities", |
| 558 |
+[](dart::dynamics::Joint* self) |
| 559 |
-> void { return self->resetVelocities(); }) |
| 560 |
.def( |
| 561 |
"setInitialVelocity", |
| 562 |
+[](dart::dynamics::Joint* self, std::size_t index, double initial) |
| 563 |
-> void { return self->setInitialVelocity(index, initial); }, |
| 564 |
::py::arg("index"), |
| 565 |
::py::arg("initial")) |
| 566 |
.def( |
| 567 |
"getInitialVelocity", |
| 568 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 569 |
return self->getInitialVelocity(index); |
| 570 |
}, |
| 571 |
::py::arg("index")) |
| 572 |
.def( |
| 573 |
"setInitialVelocities", |
| 574 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& initial) |
| 575 |
-> void { return self->setInitialVelocities(initial); }, |
| 576 |
::py::arg("initial")) |
| 577 |
.def( |
| 578 |
"getInitialVelocities", |
| 579 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 580 |
return self->getInitialVelocities(); |
| 581 |
}) |
| 582 |
.def( |
| 583 |
"setAcceleration", |
| 584 |
+[](dart::dynamics::Joint* self, |
| 585 |
std::size_t index, |
| 586 |
double acceleration) -> void { |
| 587 |
return self->setAcceleration(index, acceleration); |
| 588 |
}, |
| 589 |
::py::arg("index"), |
| 590 |
::py::arg("acceleration")) |
| 591 |
.def( |
| 592 |
"getAcceleration", |
| 593 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 594 |
return self->getAcceleration(index); |
| 595 |
}, |
| 596 |
::py::arg("index")) |
| 597 |
.def( |
| 598 |
"setAccelerations", |
| 599 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& accelerations) |
| 600 |
-> void { return self->setAccelerations(accelerations); }, |
| 601 |
::py::arg("accelerations")) |
| 602 |
.def( |
| 603 |
"getAccelerations", |
| 604 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 605 |
return self->getAccelerations(); |
| 606 |
}) |
| 607 |
.def( |
| 608 |
"resetAccelerations", |
| 609 |
+[](dart::dynamics::Joint* self) |
| 610 |
-> void { return self->resetAccelerations(); }) |
| 611 |
.def( |
| 612 |
"setAccelerationLowerLimit", |
| 613 |
+[](dart::dynamics::Joint* self, |
| 614 |
std::size_t index, |
| 615 |
double acceleration) -> void { |
| 616 |
return self->setAccelerationLowerLimit(index, acceleration); |
| 617 |
}, |
| 618 |
::py::arg("index"), |
| 619 |
::py::arg("acceleration")) |
| 620 |
.def( |
| 621 |
"getAccelerationLowerLimit", |
| 622 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 623 |
return self->getAccelerationLowerLimit(index); |
| 624 |
}, |
| 625 |
::py::arg("index")) |
| 626 |
.def( |
| 627 |
"setAccelerationLowerLimits", |
| 628 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& lowerLimits) |
| 629 |
-> void { return self->setAccelerationLowerLimits(lowerLimits); }, |
| 630 |
::py::arg("lowerLimits")) |
| 631 |
.def( |
| 632 |
"getAccelerationLowerLimits", |
| 633 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 634 |
return self->getAccelerationLowerLimits(); |
| 635 |
}) |
| 636 |
.def( |
| 637 |
"setAccelerationUpperLimit", |
| 638 |
+[](dart::dynamics::Joint* self, |
| 639 |
std::size_t index, |
| 640 |
double acceleration) -> void { |
| 641 |
return self->setAccelerationUpperLimit(index, acceleration); |
| 642 |
}, |
| 643 |
::py::arg("index"), |
| 644 |
::py::arg("acceleration")) |
| 645 |
.def( |
| 646 |
"getAccelerationUpperLimit", |
| 647 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 648 |
return self->getAccelerationUpperLimit(index); |
| 649 |
}, |
| 650 |
::py::arg("index")) |
| 651 |
.def( |
| 652 |
"setAccelerationUpperLimits", |
| 653 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& upperLimits) |
| 654 |
-> void { return self->setAccelerationUpperLimits(upperLimits); }, |
| 655 |
::py::arg("upperLimits")) |
| 656 |
.def( |
| 657 |
"getAccelerationUpperLimits", |
| 658 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 659 |
return self->getAccelerationUpperLimits(); |
| 660 |
}) |
| 661 |
.def( |
| 662 |
"setForce", |
| 663 |
+[](dart::dynamics::Joint* self, |
| 664 |
std::size_t index, |
| 665 |
double force) -> void { return self->setForce(index, force); }, |
| 666 |
::py::arg("index"), |
| 667 |
::py::arg("force")) |
| 668 |
.def( |
| 669 |
"getForce", |
| 670 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 671 |
return self->getForce(index); |
| 672 |
}, |
| 673 |
::py::arg("index")) |
| 674 |
.def( |
| 675 |
"setForces", |
| 676 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& forces) |
| 677 |
-> void { return self->setForces(forces); }, |
| 678 |
::py::arg("forces")) |
| 679 |
.def( |
| 680 |
"getForces", |
| 681 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 682 |
return self->getForces(); |
| 683 |
}) |
| 684 |
.def( |
| 685 |
"resetForces", |
| 686 |
+[](dart::dynamics::Joint* self) |
| 687 |
-> void { return self->resetForces(); }) |
| 688 |
.def( |
| 689 |
"setForceLowerLimit", |
| 690 |
+[](dart::dynamics::Joint* self, std::size_t index, double force) |
| 691 |
-> void { return self->setForceLowerLimit(index, force); }, |
| 692 |
::py::arg("index"), |
| 693 |
::py::arg("force")) |
| 694 |
.def( |
| 695 |
"getForceLowerLimit", |
| 696 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 697 |
return self->getForceLowerLimit(index); |
| 698 |
}, |
| 699 |
::py::arg("index")) |
| 700 |
.def( |
| 701 |
"setForceLowerLimits", |
| 702 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& lowerLimits) |
| 703 |
-> void { return self->setForceLowerLimits(lowerLimits); }, |
| 704 |
::py::arg("lowerLimits")) |
| 705 |
.def( |
| 706 |
"getForceLowerLimits", |
| 707 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 708 |
return self->getForceLowerLimits(); |
| 709 |
}) |
| 710 |
.def( |
| 711 |
"setForceUpperLimit", |
| 712 |
+[](dart::dynamics::Joint* self, std::size_t index, double force) |
| 713 |
-> void { return self->setForceUpperLimit(index, force); }, |
| 714 |
::py::arg("index"), |
| 715 |
::py::arg("force")) |
| 716 |
.def( |
| 717 |
"getForceUpperLimit", |
| 718 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 719 |
return self->getForceUpperLimit(index); |
| 720 |
}, |
| 721 |
::py::arg("index")) |
| 722 |
.def( |
| 723 |
"setForceUpperLimits", |
| 724 |
+[](dart::dynamics::Joint* self, const Eigen::VectorXd& upperLimits) |
| 725 |
-> void { return self->setForceUpperLimits(upperLimits); }, |
| 726 |
::py::arg("upperLimits")) |
| 727 |
.def( |
| 728 |
"getForceUpperLimits", |
| 729 |
+[](const dart::dynamics::Joint* self) -> Eigen::VectorXd { |
| 730 |
return self->getForceUpperLimits(); |
| 731 |
}) |
| 732 |
.def( |
| 733 |
"checkSanity", |
| 734 |
+[](const dart::dynamics::Joint* self) |
| 735 |
-> bool { return self->checkSanity(); }) |
| 736 |
.def( |
| 737 |
"checkSanity", |
| 738 |
+[](const dart::dynamics::Joint* self, bool printWarnings) -> bool { |
| 739 |
return self->checkSanity(printWarnings); |
| 740 |
}, |
| 741 |
::py::arg("printWarnings")) |
| 742 |
.def( |
| 743 |
"setVelocityChange", |
| 744 |
+[](dart::dynamics::Joint* self, |
| 745 |
std::size_t index, |
| 746 |
double velocityChange) -> void { |
| 747 |
return self->setVelocityChange(index, velocityChange); |
| 748 |
}, |
| 749 |
::py::arg("index"), |
| 750 |
::py::arg("velocityChange")) |
| 751 |
.def( |
| 752 |
"getVelocityChange", |
| 753 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 754 |
return self->getVelocityChange(index); |
| 755 |
}, |
| 756 |
::py::arg("index")) |
| 757 |
.def( |
| 758 |
"resetVelocityChanges", |
| 759 |
+[](dart::dynamics::Joint* self) |
| 760 |
-> void { return self->resetVelocityChanges(); }) |
| 761 |
.def( |
| 762 |
"setConstraintImpulse", |
| 763 |
+[](dart::dynamics::Joint* self, std::size_t index, double impulse) |
| 764 |
-> void { return self->setConstraintImpulse(index, impulse); }, |
| 765 |
::py::arg("index"), |
| 766 |
::py::arg("impulse")) |
| 767 |
.def( |
| 768 |
"getConstraintImpulse", |
| 769 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 770 |
return self->getConstraintImpulse(index); |
| 771 |
}, |
| 772 |
::py::arg("index")) |
| 773 |
.def( |
| 774 |
"resetConstraintImpulses", |
| 775 |
+[](dart::dynamics::Joint* self) |
| 776 |
-> void { return self->resetConstraintImpulses(); }) |
| 777 |
.def( |
| 778 |
"integratePositions", |
| 779 |
+[](dart::dynamics::Joint* self, double dt) -> void { |
| 780 |
return self->integratePositions(dt); |
| 781 |
}, |
| 782 |
::py::arg("dt")) |
| 783 |
.def( |
| 784 |
"integrateVelocities", |
| 785 |
+[](dart::dynamics::Joint* self, double dt) -> void { |
| 786 |
return self->integrateVelocities(dt); |
| 787 |
}, |
| 788 |
::py::arg("dt")) |
| 789 |
.def( |
| 790 |
"getPositionDifferences", |
| 791 |
+[](const dart::dynamics::Joint* self, |
| 792 |
const Eigen::VectorXd& q2, |
| 793 |
const Eigen::VectorXd& q1) -> Eigen::VectorXd { |
| 794 |
return self->getPositionDifferences(q2, q1); |
| 795 |
}, |
| 796 |
::py::arg("q2"), |
| 797 |
::py::arg("q1")) |
| 798 |
.def( |
| 799 |
"setSpringStiffness", |
| 800 |
+[](dart::dynamics::Joint* self, |
| 801 |
std::size_t index, |
| 802 |
double k) -> void { return self->setSpringStiffness(index, k); }, |
| 803 |
::py::arg("index"), |
| 804 |
::py::arg("k")) |
| 805 |
.def( |
| 806 |
"getSpringStiffness", |
| 807 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 808 |
return self->getSpringStiffness(index); |
| 809 |
}, |
| 810 |
::py::arg("index")) |
| 811 |
.def( |
| 812 |
"setRestPosition", |
| 813 |
+[](dart::dynamics::Joint* self, |
| 814 |
std::size_t index, |
| 815 |
double q0) -> void { return self->setRestPosition(index, q0); }, |
| 816 |
::py::arg("index"), |
| 817 |
::py::arg("q0")) |
| 818 |
.def( |
| 819 |
"getRestPosition", |
| 820 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 821 |
return self->getRestPosition(index); |
| 822 |
}, |
| 823 |
::py::arg("index")) |
| 824 |
.def( |
| 825 |
"setDampingCoefficient", |
| 826 |
+[](dart::dynamics::Joint* self, std::size_t index, double coeff) |
| 827 |
-> void { return self->setDampingCoefficient(index, coeff); }, |
| 828 |
::py::arg("index"), |
| 829 |
::py::arg("coeff")) |
| 830 |
.def( |
| 831 |
"getDampingCoefficient", |
| 832 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 833 |
return self->getDampingCoefficient(index); |
| 834 |
}, |
| 835 |
::py::arg("index")) |
| 836 |
.def( |
| 837 |
"setCoulombFriction", |
| 838 |
+[](dart::dynamics::Joint* self, std::size_t index, double friction) |
| 839 |
-> void { return self->setCoulombFriction(index, friction); }, |
| 840 |
::py::arg("index"), |
| 841 |
::py::arg("friction")) |
| 842 |
.def( |
| 843 |
"getCoulombFriction", |
| 844 |
+[](const dart::dynamics::Joint* self, std::size_t index) -> double { |
| 845 |
return self->getCoulombFriction(index); |
| 846 |
}, |
| 847 |
::py::arg("index")) |
| 848 |
.def( |
| 849 |
"computePotentialEnergy", |
| 850 |
+[](const dart::dynamics::Joint* self) -> double { |
| 851 |
return self->computePotentialEnergy(); |
| 852 |
}) |
| 853 |
.def( |
| 854 |
"getRelativeTransform", |
| 855 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Isometry3d& { |
| 856 |
return self->getRelativeTransform(); |
| 857 |
}) |
| 858 |
.def( |
| 859 |
"getRelativeSpatialVelocity", |
| 860 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Vector6d& { |
| 861 |
return self->getRelativeSpatialVelocity(); |
| 862 |
}) |
| 863 |
.def( |
| 864 |
"getRelativeSpatialAcceleration", |
| 865 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Vector6d& { |
| 866 |
return self->getRelativeSpatialAcceleration(); |
| 867 |
}) |
| 868 |
.def( |
| 869 |
"getRelativePrimaryAcceleration", |
| 870 |
+[](const dart::dynamics::Joint* self) -> const Eigen::Vector6d& { |
| 871 |
return self->getRelativePrimaryAcceleration(); |
| 872 |
}) |
| 873 |
.def( |
| 874 |
"getRelativeJacobian", |
| 875 |
+[](const dart::dynamics::Joint* self) -> const dart::math::Jacobian { |
| 876 |
return self->getRelativeJacobian(); |
| 877 |
}) |
| 878 |
.def( |
| 879 |
"getRelativeJacobian", |
| 880 |
+[](const dart::dynamics::Joint* self, |
| 881 |
const Eigen::VectorXd& positions) -> dart::math::Jacobian { |
| 882 |
return self->getRelativeJacobian(positions); |
| 883 |
}, |
| 884 |
::py::arg("positions")) |
| 885 |
.def( |
| 886 |
"getRelativeJacobianTimeDeriv", |
| 887 |
+[](const dart::dynamics::Joint* self) -> const dart::math::Jacobian { |
| 888 |
return self->getRelativeJacobianTimeDeriv(); |
| 889 |
}) |
| 890 |
.def( |
| 891 |
"getBodyConstraintWrench", |
| 892 |
+[](const dart::dynamics::Joint* self) -> Eigen::Vector6d { |
| 893 |
return self->getBodyConstraintWrench(); |
| 894 |
}) |
| 895 |
.def( |
| 896 |
"getWrenchToChildBodyNode", |
| 897 |
&dart::dynamics::Joint::getWrenchToChildBodyNode, |
| 898 |
::py::arg("withRespectTo") = nullptr) |
| 899 |
.def( |
| 900 |
"getWrenchToParentBodyNode", |
| 901 |
&dart::dynamics::Joint::getWrenchToParentBodyNode, |
| 902 |
::py::arg("withRespectTo") = nullptr) |
| 903 |
.def( |
| 904 |
"notifyPositionUpdated", |
| 905 |
+[](dart::dynamics::Joint* self) |
| 906 |
-> void { return self->notifyPositionUpdated(); }) |
| 907 |
.def( |
| 908 |
"notifyVelocityUpdated", |
| 909 |
+[](dart::dynamics::Joint* self) |
| 910 |
-> void { return self->notifyVelocityUpdated(); }) |
| 911 |
.def( |
| 912 |
"notifyAccelerationUpdated", |
| 913 |
+[](dart::dynamics::Joint* self) -> void { |
| 914 |
return self->notifyAccelerationUpdated(); |
| 915 |
}) |
| 916 |
.def_readonly_static("FORCE", &dart::dynamics::Joint::FORCE) |
| 917 |
.def_readonly_static("PASSIVE", &dart::dynamics::Joint::PASSIVE) |
| 918 |
.def_readonly_static("SERVO", &dart::dynamics::Joint::SERVO) |
| 919 |
.def_readonly_static("ACCELERATION", &dart::dynamics::Joint::ACCELERATION) |
| 920 |
.def_readonly_static("VELOCITY", &dart::dynamics::Joint::VELOCITY) |
| 921 |
.def_readonly_static("LOCKED", &dart::dynamics::Joint::LOCKED) |
| 922 |
.def_readonly_static( |
| 923 |
"DefaultActuatorType", &dart::dynamics::Joint::DefaultActuatorType); |
| 924 |
|
| 925 |
auto attr = m.attr("Joint"); |
| 926 |
|
| 927 |
::py::enum_<dart::dynamics::detail::ActuatorType>(attr, "ActuatorType") |
| 928 |
.value("FORCE", dart::dynamics::detail::ActuatorType::FORCE) |
| 929 |
.value("PASSIVE", dart::dynamics::detail::ActuatorType::PASSIVE) |
| 930 |
.value("SERVO", dart::dynamics::detail::ActuatorType::SERVO) |
| 931 |
.value("MIMIC", dart::dynamics::detail::ActuatorType::MIMIC) |
| 932 |
.value("ACCELERATION", dart::dynamics::detail::ActuatorType::ACCELERATION) |
| 933 |
.value("VELOCITY", dart::dynamics::detail::ActuatorType::VELOCITY) |
| 934 |
.value("LOCKED", dart::dynamics::detail::ActuatorType::LOCKED); |
| 935 |
} |
| 936 |
|
| 937 |
} // namespace python |
| 938 |
} // namespace dart |