39#include <urdf_parser/urdf_parser.h>
40#include <srdfdom/model.h>
41#include <srdfdom/srdf_writer.h>
46namespace bind_robot_model
50 py::module robot_model = m.def_submodule(
"robot_model");
52 py::class_<moveit::core::RobotModel, std::shared_ptr<moveit::core::RobotModel>>(robot_model,
"RobotModel",
54 Representation of a kinematic model.
57 .def(py::init([](std::string& urdf_xml_path, std::string& srdf_xml_path) {
59 std::string xml_string;
60 std::fstream xml_file(urdf_xml_path.c_str(), std::fstream::in);
61 while (xml_file.good())
64 std::getline(xml_file, line);
65 xml_string += (line +
"\n");
69 urdf::ModelInterfaceSharedPtr urdf_model = urdf::parseURDF(xml_string);
72 srdf::Model srdf_model;
73 srdf_model.initFile(*urdf_model, srdf_xml_path);
76 return std::make_shared<moveit::core::RobotModel>(
77 urdf_model, std::make_shared<const srdf::Model>(std::move(srdf_model)));
79 py::arg(
"urdf_xml_path"), py::arg(
"srdf_xml_path"),
81 Initializes a kinematic model for a robot.
84 urdf_xml_path (str): The filepath to the urdf file describing the robot.
85 srdf_xml_path (str): The filepath to the srdf file describing the robot semantics.
87 moveit_py.core.RobotModel: The kinematic model for the robot.
92 str: The name of the robot model.
97 str: Get the frame in which the transforms for this model are computed (when using a :py:class:`moveit_py.core.RobotState`).
98 This frame depends on the root joint. As such, the frame is either extracted from SRDF, or it is assumed to be the name of the root link.
106 str: The name of the root joint.
111 [](std::shared_ptr<moveit::core::RobotModel>& s) {
112 std::stringstream ss;
113 s->printModelInfo(ss);
116 py::return_value_policy::move,
118 Gets a formatted string containing a summary of relevant information from the robot model.
120 str: Formatted string containing generic robot model information.
126 list of str: The names of the joint model groups in the robot model.
130 py::return_value_policy::reference_internal,
132 list of moveit_py.core.JointModelGroup: The joint model groups available in the robot model.
136 py::return_value_policy::reference_internal,
143 Checks if a joint model group with the given name exists in the robot model.
145 bool: true if joint model group exists.
148 .def("get_joint_model_group",
150 py::arg(
"joint_model_group_name"), py::return_value_policy::reference_internal,
152 Gets a joint model group instance by name.
154 joint_model_group_name (str): The name of the joint model group to return.
156 :py:class:`moveit_py.core.JointModelGroup`: joint model group instance that corresponds with joint_model_group_name parameter.
bool hasJointModelGroup(const std::string &group) const
Check if the JointModelGroup group exists.
const std::string & getName() const
Get the model name.
const std::vector< const JointModelGroup * > & getJointModelGroups() const
Get the available joint groups.
const std::string & getRootJointName() const
Return the name of the root joint. Throws an exception if there is no root joint.
const std::vector< std::string > & getJointModelGroupNames() const
Get the names of all groups that are defined for this model.
const JointModelGroup * getJointModelGroup(const std::string &name) const
Get a joint group from this model (by name)
const std::vector< const JointModelGroup * > & getEndEffectors() const
Get the map between end effector names and the groups they correspond to.
const std::string & getModelFrame() const
Get the frame in which the transforms for this model are computed (when using a RobotState)....
void initRobotModel(py::module &m)