| 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 <pybind11/pybind11.h> |
| 35 |
|
| 36 |
#include "eigen_geometry_pybind.h" |
| 37 |
#include "eigen_pybind.h" |
| 38 |
|
| 39 |
namespace py = pybind11; |
| 40 |
|
| 41 |
namespace dart { |
| 42 |
namespace python { |
| 43 |
|
| 44 |
void SimpleFrame(py::module& m) |
| 45 |
{ |
| 46 |
::py::class_< |
| 47 |
dart::dynamics::SimpleFrame, |
| 48 |
dart::dynamics::ShapeFrame, |
| 49 |
dart::dynamics::Detachable, |
| 50 |
std::shared_ptr<dart::dynamics::SimpleFrame>>(m, "SimpleFrame") |
| 51 |
.def(::py::init<>()) |
| 52 |
.def(::py::init<dart::dynamics::Frame*>(), ::py::arg("refFrame")) |
| 53 |
.def( |
| 54 |
::py::init<dart::dynamics::Frame*, const std::string&>(), |
| 55 |
::py::arg("refFrame"), |
| 56 |
::py::arg("name")) |
| 57 |
.def( |
| 58 |
::py::init< |
| 59 |
dart::dynamics::Frame*, |
| 60 |
const std::string&, |
| 61 |
const Eigen::Isometry3d&>(), |
| 62 |
::py::arg("refFrame"), |
| 63 |
::py::arg("name"), |
| 64 |
::py::arg("relativeTransform")) |
| 65 |
.def( |
| 66 |
"setName", |
| 67 |
+[](dart::dynamics::SimpleFrame* self, const std::string& _name) |
| 68 |
-> const std::string& { return self->setName(_name); }, |
| 69 |
::py::return_value_policy::reference_internal, |
| 70 |
::py::arg("name")) |
| 71 |
.def( |
| 72 |
"getName", |
| 73 |
+[](const dart::dynamics::SimpleFrame* self) -> const std::string& { |
| 74 |
return self->getName(); |
| 75 |
}, |
| 76 |
::py::return_value_policy::reference_internal) |
| 77 |
.def( |
| 78 |
"clone", |
| 79 |
+[](const dart::dynamics::SimpleFrame* self) |
| 80 |
-> std::shared_ptr<dart::dynamics::SimpleFrame> { |
| 81 |
return self->clone(); |
| 82 |
}) |
| 83 |
.def( |
| 84 |
"clone", |
| 85 |
+[](const dart::dynamics::SimpleFrame* self, |
| 86 |
dart::dynamics::Frame* _refFrame) |
| 87 |
-> std::shared_ptr<dart::dynamics::SimpleFrame> { |
| 88 |
return self->clone(_refFrame); |
| 89 |
}, |
| 90 |
::py::arg("refFrame")) |
| 91 |
.def( |
| 92 |
"copy", |
| 93 |
+[](dart::dynamics::SimpleFrame* self, |
| 94 |
const dart::dynamics::Frame* _otherFrame) { |
| 95 |
self->copy(_otherFrame); |
| 96 |
}, |
| 97 |
::py::arg("otherFrame")) |
| 98 |
.def( |
| 99 |
"copy", |
| 100 |
+[](dart::dynamics::SimpleFrame* self, |
| 101 |
const dart::dynamics::Frame* _otherFrame, |
| 102 |
dart::dynamics::Frame* _refFrame) { |
| 103 |
self->copy(_otherFrame, _refFrame); |
| 104 |
}, |
| 105 |
::py::arg("otherFrame"), |
| 106 |
::py::arg("refFrame")) |
| 107 |
.def( |
| 108 |
"copy", |
| 109 |
+[](dart::dynamics::SimpleFrame* self, |
| 110 |
const dart::dynamics::Frame* _otherFrame, |
| 111 |
dart::dynamics::Frame* _refFrame, |
| 112 |
bool _copyProperties) { |
| 113 |
self->copy(_otherFrame, _refFrame, _copyProperties); |
| 114 |
}, |
| 115 |
::py::arg("otherFrame"), |
| 116 |
::py::arg("refFrame"), |
| 117 |
::py::arg("copyProperties")) |
| 118 |
.def( |
| 119 |
"spawnChildSimpleFrame", |
| 120 |
+[](dart::dynamics::SimpleFrame* self) |
| 121 |
-> std::shared_ptr<dart::dynamics::SimpleFrame> { |
| 122 |
return self->spawnChildSimpleFrame(); |
| 123 |
}) |
| 124 |
.def( |
| 125 |
"spawnChildSimpleFrame", |
| 126 |
+[](dart::dynamics::SimpleFrame* self, const std::string& name) |
| 127 |
-> std::shared_ptr<dart::dynamics::SimpleFrame> { |
| 128 |
return self->spawnChildSimpleFrame(name); |
| 129 |
}, |
| 130 |
::py::arg("name")) |
| 131 |
.def( |
| 132 |
"spawnChildSimpleFrame", |
| 133 |
+[](dart::dynamics::SimpleFrame* self, |
| 134 |
const std::string& name, |
| 135 |
const Eigen::Isometry3d& relativeTransform) |
| 136 |
-> std::shared_ptr<dart::dynamics::SimpleFrame> { |
| 137 |
return self->spawnChildSimpleFrame(name, relativeTransform); |
| 138 |
}, |
| 139 |
::py::arg("name"), |
| 140 |
::py::arg("relativeTransform")) |
| 141 |
.def( |
| 142 |
"setRelativeTransform", |
| 143 |
+[](dart::dynamics::SimpleFrame* self, |
| 144 |
const Eigen::Isometry3d& _newRelTransform) { |
| 145 |
self->setRelativeTransform(_newRelTransform); |
| 146 |
}, |
| 147 |
::py::arg("newRelTransform")) |
| 148 |
.def( |
| 149 |
"setRelativeTranslation", |
| 150 |
+[](dart::dynamics::SimpleFrame* self, |
| 151 |
const Eigen::Vector3d& _newTranslation) { |
| 152 |
self->setRelativeTranslation(_newTranslation); |
| 153 |
}, |
| 154 |
::py::arg("newTranslation")) |
| 155 |
.def( |
| 156 |
"setRelativeRotation", |
| 157 |
+[](dart::dynamics::SimpleFrame* self, |
| 158 |
const Eigen::Matrix3d& _newRotation) { |
| 159 |
self->setRelativeRotation(_newRotation); |
| 160 |
}, |
| 161 |
::py::arg("newRotation")) |
| 162 |
.def( |
| 163 |
"setTransform", |
| 164 |
+[](dart::dynamics::SimpleFrame* self, |
| 165 |
const Eigen::Isometry3d& _newTransform) { |
| 166 |
self->setTransform(_newTransform); |
| 167 |
}, |
| 168 |
::py::arg("newTransform")) |
| 169 |
.def( |
| 170 |
"setTransform", |
| 171 |
+[](dart::dynamics::SimpleFrame* self, |
| 172 |
const Eigen::Isometry3d& _newTransform, |
| 173 |
const dart::dynamics::Frame* _withRespectTo) { |
| 174 |
self->setTransform(_newTransform, _withRespectTo); |
| 175 |
}, |
| 176 |
::py::arg("newTransform"), |
| 177 |
::py::arg("withRespectTo")) |
| 178 |
.def( |
| 179 |
"setTranslation", |
| 180 |
+[](dart::dynamics::SimpleFrame* self, |
| 181 |
const Eigen::Vector3d& _newTranslation) { |
| 182 |
self->setTranslation(_newTranslation); |
| 183 |
}, |
| 184 |
::py::arg("newTranslation")) |
| 185 |
.def( |
| 186 |
"setTranslation", |
| 187 |
+[](dart::dynamics::SimpleFrame* self, |
| 188 |
const Eigen::Vector3d& _newTranslation, |
| 189 |
const dart::dynamics::Frame* _withRespectTo) { |
| 190 |
self->setTranslation(_newTranslation, _withRespectTo); |
| 191 |
}, |
| 192 |
::py::arg("newTranslation"), |
| 193 |
::py::arg("withRespectTo")) |
| 194 |
.def( |
| 195 |
"setRotation", |
| 196 |
+[](dart::dynamics::SimpleFrame* self, |
| 197 |
const Eigen::Matrix3d& _newRotation) { |
| 198 |
self->setRotation(_newRotation); |
| 199 |
}, |
| 200 |
::py::arg("newRotation")) |
| 201 |
.def( |
| 202 |
"setRotation", |
| 203 |
+[](dart::dynamics::SimpleFrame* self, |
| 204 |
const Eigen::Matrix3d& _newRotation, |
| 205 |
const dart::dynamics::Frame* _withRespectTo) { |
| 206 |
self->setRotation(_newRotation, _withRespectTo); |
| 207 |
}, |
| 208 |
::py::arg("newRotation"), |
| 209 |
::py::arg("withRespectTo")) |
| 210 |
.def( |
| 211 |
"setRelativeSpatialVelocity", |
| 212 |
+[](dart::dynamics::SimpleFrame* self, |
| 213 |
const Eigen::Vector6d& _newSpatialVelocity) { |
| 214 |
self->setRelativeSpatialVelocity(_newSpatialVelocity); |
| 215 |
}, |
| 216 |
::py::arg("newSpatialVelocity")) |
| 217 |
.def( |
| 218 |
"setRelativeSpatialVelocity", |
| 219 |
+[](dart::dynamics::SimpleFrame* self, |
| 220 |
const Eigen::Vector6d& _newSpatialVelocity, |
| 221 |
const dart::dynamics::Frame* _inCoordinatesOf) { |
| 222 |
self->setRelativeSpatialVelocity( |
| 223 |
_newSpatialVelocity, _inCoordinatesOf); |
| 224 |
}, |
| 225 |
::py::arg("newSpatialVelocity"), |
| 226 |
::py::arg("inCoordinatesOf")) |
| 227 |
.def( |
| 228 |
"setRelativeSpatialAcceleration", |
| 229 |
+[](dart::dynamics::SimpleFrame* self, |
| 230 |
const Eigen::Vector6d& _newSpatialAcceleration) { |
| 231 |
self->setRelativeSpatialAcceleration(_newSpatialAcceleration); |
| 232 |
}, |
| 233 |
::py::arg("newSpatialAcceleration")) |
| 234 |
.def( |
| 235 |
"setRelativeSpatialAcceleration", |
| 236 |
+[](dart::dynamics::SimpleFrame* self, |
| 237 |
const Eigen::Vector6d& _newSpatialAcceleration, |
| 238 |
const dart::dynamics::Frame* _inCoordinatesOf) { |
| 239 |
self->setRelativeSpatialAcceleration( |
| 240 |
_newSpatialAcceleration, _inCoordinatesOf); |
| 241 |
}, |
| 242 |
::py::arg("newSpatialAcceleration"), |
| 243 |
::py::arg("inCoordinatesOf")) |
| 244 |
.def( |
| 245 |
"setClassicDerivatives", |
| 246 |
+[](dart::dynamics::SimpleFrame* self) { |
| 247 |
self->setClassicDerivatives(); |
| 248 |
}) |
| 249 |
.def( |
| 250 |
"setClassicDerivatives", |
| 251 |
+[](dart::dynamics::SimpleFrame* self, |
| 252 |
const Eigen::Vector3d& _linearVelocity) { |
| 253 |
self->setClassicDerivatives(_linearVelocity); |
| 254 |
}, |
| 255 |
::py::arg("linearVelocity")) |
| 256 |
.def( |
| 257 |
"setClassicDerivatives", |
| 258 |
+[](dart::dynamics::SimpleFrame* self, |
| 259 |
const Eigen::Vector3d& _linearVelocity, |
| 260 |
const Eigen::Vector3d& _angularVelocity) { |
| 261 |
self->setClassicDerivatives(_linearVelocity, _angularVelocity); |
| 262 |
}, |
| 263 |
::py::arg("linearVelocity"), |
| 264 |
::py::arg("angularVelocity")) |
| 265 |
.def( |
| 266 |
"setClassicDerivatives", |
| 267 |
+[](dart::dynamics::SimpleFrame* self, |
| 268 |
const Eigen::Vector3d& _linearVelocity, |
| 269 |
const Eigen::Vector3d& _angularVelocity, |
| 270 |
const Eigen::Vector3d& _linearAcceleration) { |
| 271 |
self->setClassicDerivatives( |
| 272 |
_linearVelocity, _angularVelocity, _linearAcceleration); |
| 273 |
}, |
| 274 |
::py::arg("linearVelocity"), |
| 275 |
::py::arg("angularVelocity"), |
| 276 |
::py::arg("linearAcceleration")) |
| 277 |
.def( |
| 278 |
"setClassicDerivatives", |
| 279 |
+[](dart::dynamics::SimpleFrame* self, |
| 280 |
const Eigen::Vector3d& _linearVelocity, |
| 281 |
const Eigen::Vector3d& _angularVelocity, |
| 282 |
const Eigen::Vector3d& _linearAcceleration, |
| 283 |
const Eigen::Vector3d& _angularAcceleration) { |
| 284 |
self->setClassicDerivatives( |
| 285 |
_linearVelocity, |
| 286 |
_angularVelocity, |
| 287 |
_linearAcceleration, |
| 288 |
_angularAcceleration); |
| 289 |
}, |
| 290 |
::py::arg("linearVelocity"), |
| 291 |
::py::arg("angularVelocity"), |
| 292 |
::py::arg("linearAcceleration"), |
| 293 |
::py::arg("angularAcceleration")); |
| 294 |
} |
| 295 |
|
| 296 |
} // namespace python |
| 297 |
} // namespace dart |