Skip to content

Commit

Permalink
Run clang-format for all C++ files
Browse files Browse the repository at this point in the history
  • Loading branch information
KolinGuo committed Jan 12, 2024
1 parent 3333cf2 commit 21bd3c4
Show file tree
Hide file tree
Showing 24 changed files with 3,301 additions and 3,036 deletions.
4 changes: 3 additions & 1 deletion python/pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
namespace py = pybind11;

PYBIND11_MODULE(pymp, m) {
m.doc() = "Motion planning python binding. To see its documentation, please see the stub files in your IDE.";
m.doc() =
"Motion planning python binding. To see its documentation, please see the stub "
"files in your IDE.";
build_pyfcl(m);
build_pypinocchio(m);
build_pykdl(m);
Expand Down
79 changes: 47 additions & 32 deletions python/pybind_articulation.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once

#include <vector>

#include <pybind11/eigen.h>
#include <pybind11/numpy.h>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/pybind11.h>

#include "../src/articulated_model.h"

namespace py = pybind11;
Expand Down Expand Up @@ -103,35 +104,49 @@ std::string get_base_pose_doc = R"(
base pose of the robot in [x, y, z, qw, qx, qy, qz] format)";

void build_pyarticulation(py::module &m_all) {
auto m = m_all.def_submodule("articulation", "articulated model submodule, i.e. models with moving parts");
auto PyArticulatedModel = py::class_<ArticulatedModel, std::shared_ptr<ArticulatedModel>>(m, "ArticulatedModel",
"Supports initialization from URDF and SRDF files, and provides access to underlying Pinocchio and FCL models.");

PyArticulatedModel
.def(py::init<std::string const &,
std::string const &, Eigen::Matrix<DATATYPE, 3, 1>,
std::vector<std::string> const &,
std::vector<std::string> const &,
bool const &, bool const&>(),
py::arg("urdf_filename"), py::arg("srdf_filename"), py::arg("gravity"), py::arg("joint_names"),
py::arg("link_names"), py::arg("verbose") = true, py::arg("convex") = false, constructor_doc.c_str())
.def("get_pinocchio_model", &ArticulatedModel::getPinocchioModel, get_pinnochio_model_doc.c_str())
.def("get_fcl_model", &ArticulatedModel::getFCLModel, get_fcl_model_doc.c_str())
.def("set_move_group", py::overload_cast<std::string const &>(&ArticulatedModel::setMoveGroup),
py::arg("end_effector"), set_move_group_doc1.c_str())
.def("set_move_group", py::overload_cast<std::vector<std::string> const &>(&ArticulatedModel::setMoveGroup),
py::arg("end_effectors"), set_move_group_doc2.c_str())
.def("set_base_pose", &ArticulatedModel::setBasePose, py::arg("pose"), set_base_pose_doc.c_str())
.def("get_base_pose", &ArticulatedModel::getBasePose, get_base_pose_doc.c_str())
.def("get_move_group_joint_indices", &ArticulatedModel::getMoveGroupJointIndices, get_move_group_joint_indices_doc.c_str())
.def("get_move_group_joint_names", &ArticulatedModel::getMoveGroupJointName, get_move_group_joint_names_doc.c_str())
.def("get_user_joint_names", &ArticulatedModel::getUserJointNames, get_user_joint_names_doc.c_str())
.def("get_user_link_names", &ArticulatedModel::getUserLinkNames, get_user_link_names_doc.c_str())
.def("get_move_group_end_effectors", &ArticulatedModel::getMoveGroupEndEffectors, get_move_group_end_effectors_doc.c_str())
.def("get_qpos", &ArticulatedModel::getQpos, get_qpos_doc.c_str())
.def("get_move_group_qpos_dim", &ArticulatedModel::getQposDim, get_move_group_qpos_dim_doc.c_str())
.def("set_qpos", &ArticulatedModel::setQpos,
py::arg("qpos"), py::arg("full")=false, set_qpos_doc.c_str())
.def("update_SRDF", &ArticulatedModel::updateSRDF,
py::arg("SRDF"), update_srdf_doc.c_str());
auto m = m_all.def_submodule(
"articulation", "articulated model submodule, i.e. models with moving parts");
auto PyArticulatedModel =
py::class_<ArticulatedModel, std::shared_ptr<ArticulatedModel>>(
m, "ArticulatedModel",
"Supports initialization from URDF and SRDF files, and provides access to "
"underlying Pinocchio and FCL models.");

PyArticulatedModel
.def(py::init<const std::string &, const std::string &,
Eigen::Matrix<DATATYPE, 3, 1>, const std::vector<std::string> &,
const std::vector<std::string> &, const bool &, const bool &>(),
py::arg("urdf_filename"), py::arg("srdf_filename"), py::arg("gravity"),
py::arg("joint_names"), py::arg("link_names"), py::arg("verbose") = true,
py::arg("convex") = false, constructor_doc.c_str())
.def("get_pinocchio_model", &ArticulatedModel::getPinocchioModel,
get_pinnochio_model_doc.c_str())
.def("get_fcl_model", &ArticulatedModel::getFCLModel, get_fcl_model_doc.c_str())
.def("set_move_group",
py::overload_cast<const std::string &>(&ArticulatedModel::setMoveGroup),
py::arg("end_effector"), set_move_group_doc1.c_str())
.def("set_move_group",
py::overload_cast<const std::vector<std::string> &>(
&ArticulatedModel::setMoveGroup),
py::arg("end_effectors"), set_move_group_doc2.c_str())
.def("set_base_pose", &ArticulatedModel::setBasePose, py::arg("pose"),
set_base_pose_doc.c_str())
.def("get_base_pose", &ArticulatedModel::getBasePose, get_base_pose_doc.c_str())
.def("get_move_group_joint_indices", &ArticulatedModel::getMoveGroupJointIndices,
get_move_group_joint_indices_doc.c_str())
.def("get_move_group_joint_names", &ArticulatedModel::getMoveGroupJointName,
get_move_group_joint_names_doc.c_str())
.def("get_user_joint_names", &ArticulatedModel::getUserJointNames,
get_user_joint_names_doc.c_str())
.def("get_user_link_names", &ArticulatedModel::getUserLinkNames,
get_user_link_names_doc.c_str())
.def("get_move_group_end_effectors", &ArticulatedModel::getMoveGroupEndEffectors,
get_move_group_end_effectors_doc.c_str())
.def("get_qpos", &ArticulatedModel::getQpos, get_qpos_doc.c_str())
.def("get_move_group_qpos_dim", &ArticulatedModel::getQposDim,
get_move_group_qpos_dim_doc.c_str())
.def("set_qpos", &ArticulatedModel::setQpos, py::arg("qpos"),
py::arg("full") = false, set_qpos_doc.c_str())
.def("update_SRDF", &ArticulatedModel::updateSRDF, py::arg("SRDF"),
update_srdf_doc.c_str());
}
Loading

0 comments on commit 21bd3c4

Please sign in to comment.