Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydrake doc: Use constexpr auto& for nesting aliases #9606

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

EricCousineau-TRI
Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI commented Oct 6, 2018

Resolves #9600

\cc @m-chaturvedi


This change is Reviewable

@EricCousineau-TRI
Copy link
Contributor Author

@drake-jenkins-bot mac-highsierra-clang-bazel-experimental please.

Copy link
Contributor Author

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@jamiesnape for review, please.

Reviewable status: all discussions resolved, platform LGTM missing

@jamiesnape
Copy link
Contributor

Can you unwind the workarounds here?

auto add_rigid_body_tree_typed_methods = [m, &tree_cls](auto dummy) {
// N.B. The header files use `Scalar` as the scalar-type template
// parameter, but `T` is used here for brevity.
using T = decltype(dummy);
// Type (a) methods:
tree_cls
.def("massMatrix", &RigidBodyTree<double>::massMatrix<T>,
pydrake_doc.RigidBodyTree.massMatrix.doc)
.def("centerOfMass", &RigidBodyTree<double>::centerOfMass<T>,
py::arg("cache"),
py::arg("model_instance_id_set") =
RigidBodyTreeConstants::default_model_instance_id_set,
pydrake_doc.RigidBodyTree.centerOfMass.doc)
.def("transformVelocityToQDot", [](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache,
const VectorX<T>& v) {
return tree.transformVelocityToQDot(cache, v);
},
pydrake_doc.RigidBodyTree.transformVelocityToQDot.doc)
.def("transformQDotToVelocity", [](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache,
const VectorX<T>& qdot) {
return tree.transformQDotToVelocity(cache, qdot);
},
pydrake_doc.RigidBodyTree.transformQDotToVelocity.doc)
.def("GetVelocityToQDotMapping", [](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache) {
return tree.GetVelocityToQDotMapping(cache);
},
pydrake_doc.RigidBodyTree.GetVelocityToQDotMapping.doc)
.def("GetQDotToVelocityMapping", [](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache) {
return tree.GetQDotToVelocityMapping(cache);
},
pydrake_doc.RigidBodyTree.GetQDotToVelocityMapping.doc)
.def("dynamicsBiasTerm", &RigidBodyTree<double>::dynamicsBiasTerm<T>,
py::arg("cache"), py::arg("external_wrenches"),
py::arg("include_velocity_terms") = true,
pydrake_doc.RigidBodyTree.dynamicsBiasTerm.doc)
.def("geometricJacobian",
[](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache, int base_body_or_frame_ind,
int end_effector_body_or_frame_ind,
int expressed_in_body_or_frame_ind, bool in_terms_of_qdot) {
std::vector<int> v_indices;
auto J = tree.geometricJacobian(
cache, base_body_or_frame_ind, end_effector_body_or_frame_ind,
expressed_in_body_or_frame_ind, in_terms_of_qdot, &v_indices);
return py::make_tuple(J, v_indices);
},
py::arg("cache"), py::arg("base_body_or_frame_ind"),
py::arg("end_effector_body_or_frame_ind"),
py::arg("expressed_in_body_or_frame_ind"),
py::arg("in_terms_of_qdot") = false,
pydrake_doc.RigidBodyTree.geometricJacobian.doc)
.def("relativeTransform", [](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache,
int base_or_frame_ind,
int body_or_frame_ind) {
return tree.relativeTransform(cache, base_or_frame_ind,
body_or_frame_ind).matrix();
},
py::arg("cache"),
py::arg("base_or_frame_ind"), py::arg("body_or_frame_ind"),
pydrake_doc.RigidBodyTree.relativeTransform.doc)
.def("centerOfMassJacobian",
&RigidBodyTree<double>::centerOfMassJacobian<T>,
py::arg("cache"),
py::arg("model_instance_id_set") =
RigidBodyTreeConstants::default_model_instance_id_set,
py::arg("in_terms_of_qdot") = false,
pydrake_doc.RigidBodyTree.centerOfMassJacobian.doc)
// centroidalMomentumMatrix
// forwardKinPositionGradient
.def("geometricJacobianDotTimesV",
&RigidBodyTree<double>::geometricJacobianDotTimesV<T>,
py::arg("cache"),
py::arg("base_body_or_frame_ind"),
py::arg("end_effector_body_or_frame_ind"),
py::arg("expressed_in_body_or_frame_ind"),
pydrake_doc.RigidBodyTree.geometricJacobianDotTimesV.doc)
.def("centerOfMassJacobianDotTimesV",
&RigidBodyTree<double>::centerOfMassJacobianDotTimesV<T>,
py::arg("cache"),
py::arg("model_instance_id_set") =
RigidBodyTreeConstants::default_model_instance_id_set,
pydrake_doc.RigidBodyTree.centerOfMassJacobianDotTimesV.doc)
// centroidalMomentumMatrixDotTimesV
.def("positionConstraints",
&RigidBodyTree<double>::positionConstraints<T>,
py::arg("cache"),
pydrake_doc.RigidBodyTree.positionConstraints.doc)
.def("positionConstraintsJacobian",
&RigidBodyTree<double>::positionConstraintsJacobian<T>,
py::arg("cache"),
py::arg("in_terms_of_qdot") = true,
pydrake_doc.RigidBodyTree.positionConstraintsJacobian.doc)
.def("positionConstraintsJacDotTimesV",
&RigidBodyTree<double>::positionConstraintsJacDotTimesV<T>,
py::arg("cache"),
pydrake_doc.RigidBodyTree.positionConstraintsJacDotTimesV.doc)
// jointLimitConstriants
.def("relativeTwist",
&RigidBodyTree<double>::relativeTwist<T>,
py::arg("cache"),
py::arg("base_or_frame_ind"),
py::arg("body_or_frame_ind"),
py::arg("expressed_in_body_or_frame_ind"),
pydrake_doc.RigidBodyTree.relativeTwist.doc)
// worldMomentumMatrix
// worldMomentumMatrixDotTimesV
// transformSpatialAcceleration
.def("frictionTorques",
[](const RigidBodyTree<double>* self, const VectorX<T>& v) {
return self->frictionTorques(v);
},
pydrake_doc.RigidBodyTree.frictionTorques.doc)
.def("inverseDynamics", &RigidBodyTree<double>::inverseDynamics<T>,
py::arg("cache"),
py::arg("external_wrenches"),
py::arg("vd"),
py::arg("include_velocity_terms") = true,
pydrake_doc.RigidBodyTree.inverseDynamics.doc)
// resolveCenterOfPressure
.def("transformVelocityMappingToQDotMapping",
[](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache,
const MatrixX<T>& Av) {
return tree.transformVelocityMappingToQDotMapping(cache, Av);
},
pydrake_doc.RigidBodyTree.transformVelocityMappingToQDotMapping.doc)
.def("transformQDotMappingToVelocityMapping",
[](const RigidBodyTree<double>& tree,
const KinematicsCache<T>& cache,
const MatrixX<T>& Ap) {
return tree.transformQDotMappingToVelocityMapping(cache, Ap);
},
pydrake_doc.RigidBodyTree.transformQDotMappingToVelocityMapping.doc)
// relativeQuaternionJacobian
// relativeRollPitchYawJacobian
// relativeRollPitchYawJacobianDotTimesV
// relativeQuaternionJacobianDotTimesV
// CheckCacheValidity
.def("doKinematics", [](const RigidBodyTree<double>& tree,
const VectorX<T>& q) {
return tree.doKinematics(q);
},
pydrake_doc.RigidBodyTree.doKinematics.doc)
.def("doKinematics", [](const RigidBodyTree<double>& tree,
const VectorX<T>& q,
const VectorX<T>& v) {
return tree.doKinematics(q, v);
},
pydrake_doc.RigidBodyTree.doKinematics.doc_2);

@EricCousineau-TRI
Copy link
Contributor Author

Done.

Copy link
Contributor

@jamiesnape jamiesnape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 36 of 36 files at r1.
Reviewable status: all discussions resolved, platform LGTM missing

@jamiesnape
Copy link
Contributor

+@jwnimmer-tri for platform review.

Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: platform.

Reviewed 36 of 36 files at r1.
Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [jwnimmer-tri]

@jamiesnape jamiesnape merged commit be65f29 into RobotLocomotion:master Oct 8, 2018
@jamiesnape jamiesnape removed their assignment Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pydrake doc: gcc and clang disagree on need for lambda capture for constexpr vars
3 participants