load_urdf_example.cpp
Go to the documentation of this file.
3 #include <console_bridge/console.h>
7 
10 
11 using namespace tesseract_scene_graph;
12 using namespace tesseract_urdf;
13 
14 std::string toString(const ShortestPath& path)
15 {
16  std::stringstream ss;
17  ss << path;
18  return ss.str();
19 }
20 
21 std::string toString(bool b) { return b ? "true" : "false"; }
22 
23 int main(int /*argc*/, char** /*argv*/)
24 {
25  // documentation:start:2: Get the urdf file path
27  std::string urdf_file =
28  locator.locateResource("package://tesseract_support/urdf/lbr_iiwa_14_r820.urdf")->getFilePath();
29  // documentation:end:2: Get the urdf file path
30 
31  // documentation:start:3: Create scene graph
32  SceneGraph::Ptr g = parseURDFFile(urdf_file, locator);
33  // documentation:end:3: Create scene graph
34 
35  // documentation:start:4: Print information
36  CONSOLE_BRIDGE_logInform(std::to_string(g->getJoints().size()).c_str());
37  CONSOLE_BRIDGE_logInform(std::to_string(g->getLinks().size()).c_str());
38  CONSOLE_BRIDGE_logInform(toString(g->isTree()).c_str());
39  CONSOLE_BRIDGE_logInform(toString(g->isAcyclic()).c_str());
40  // documentation:end:4: Print information
41 
42  // documentation:start:5: Save graph
43  g->saveDOT(tesseract_common::getTempPath() + "tesseract_urdf_import.dot");
44  // documentation:end:5: Save graph
45 }
graph.h
tesseract_common::getTempPath
std::string getTempPath()
utils.h
resource_locator.h
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_urdf::parseURDFFile
std::unique_ptr< tesseract_scene_graph::SceneGraph > parseURDFFile(const std::string &path, const tesseract_common::ResourceLocator &locator)
Parse a URDF file into a Tesseract Scene Graph.
Definition: urdf_parser.cpp:197
urdf_parser.h
A urdf parser for tesseract.
main
int main(int, char **)
Definition: load_urdf_example.cpp:23
TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_scene_graph::ShortestPath
tesseract_common::GeneralResourceLocator::locateResource
std::shared_ptr< Resource > locateResource(const std::string &url) const override
toString
std::string toString(const ShortestPath &path)
Definition: load_urdf_example.cpp:14
tesseract_common::GeneralResourceLocator
macros.h
tesseract_scene_graph::SceneGraph::Ptr
std::shared_ptr< SceneGraph > Ptr
tesseract_urdf
Definition: box.h:43
tesseract_scene_graph


tesseract_urdf
Author(s): Levi Armstrong
autogenerated on Thu Apr 24 2025 03:10:44