Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Functions | Variables
tesseract_urdf_urdf_unit.cpp File Reference
#include <tesseract_common/macros.h>
#include <gtest/gtest.h>
#include <Eigen/Geometry>
#include <tesseract_common/utils.h>
#include <tesseract_urdf/urdf_parser.h>
#include <tesseract_support/tesseract_support_resource_locator.h>
#include "tesseract_urdf_common_unit.h"
Include dependency graph for tesseract_urdf_urdf_unit.cpp:

Functions

 EXPECT_TRUE (sg !=nullptr)
 
 EXPECT_TRUE (sg->getName()=="test")
 
 EXPECT_TRUE (sg->getJoints().size()==1)
 
 EXPECT_ANY_THROW (tesseract_urdf::parseURDFString(str, resource_locator))
 
 EXPECT_EQ (sg->getLink("l1") ->visual[0]->material->getName(), "test_material")
 
 EXPECT_TRUE (g->getJoints().size()==9)
 
 EXPECT_TRUE (g->isTree())
 
g saveDOT (tesseract_common::getTempPath()+"tesseract_urdf_import.dot")
 
 std::cout<< path<< std::endl;EXPECT_TRUE(path.links.size()==4);EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_1") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_2") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_3") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_4") !=path.links.end());EXPECT_TRUE(path.joints.size()==3);EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a2") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a3") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a4") !=path.joints.end());} { { tesseract_scene_graph::SceneGraph::Ptr sg=nullptr;bool success=true;try { tesseract_urdf::writeURDFFile(sg, "/tmp/", "urdf0.urdf");} catch(...) { success=false;} EXPECT_FALSE(success);} { tesseract_scene_graph::SceneGraph::Ptr sg=std::make_shared< tesseract_scene_graph::SceneGraph > ()
 
 catch (...)
 
 EXPECT_TRUE (success)
 

Variables

TESSERACT_COMMON_IGNORE_WARNINGS_PUSH TESSERACT_COMMON_IGNORE_WARNINGS_POP
 
tesseract_scene_graph::SceneGraph::Ptr sg = tesseract_urdf::parseURDFString(str, resource_locator)
 
std::string urdf_file = std::string(TESSERACT_SUPPORT_DIR) + "/urdf/lbr_iiwa_14_r820.urdf"
 
tesseract_common::TesseractSupportResourceLocator locator
 
auto g = tesseract_urdf::parseURDFFile(urdf_file, locator)
 
auto path = g->getShortestPath("link_1", "link_4")
 
tesseract_scene_graph::Link::Ptr link_0 = std::make_shared<tesseract_scene_graph::Link>("link_0")
 
tesseract_scene_graph::Link::Ptr link_1 = std::make_shared<tesseract_scene_graph::Link>("link_1")
 
tesseract_scene_graph::Joint::Ptr joint_0 = std::make_shared<tesseract_scene_graph::Joint>("joint_0")
 
joint_0 type = tesseract_scene_graph::JointType::FIXED
 
joint_0 parent_link_name = link_0->getName()
 
joint_0 child_link_name = link_1->getName()
 
bool success = true
 
 try
 

Function Documentation

◆ catch()

catch (   ...)

◆ EXPECT_ANY_THROW()

EXPECT_ANY_THROW ( tesseract_urdf::parseURDFString(str, resource_locator)  )
Initial value:
{
std::string str =
R"(<robot name="test">
<joint name="j1" type="fixed">
<parent link="l1"/>
<child link="l2"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<dynamics damping="87.098" friction="3.1290"/>
<limit lower="12.34" upper="22.999" effort="99.0" velocity="23.0"/>
<safety_controller soft_lower_limit="8.765" soft_upper_limit="9.003" k_position="7.0034" k_velocity="9.998"/>
<calibration rising="8.654" falling="0.0445"/>
<mimic joint="j2" multiplier="9.87" offset="0.098"/>
</joint>
<joint name="j2" type="fixed">
<parent link="l1"/>
<child link="l2"/>
</joint>
<link name="l1"/>
<link name="l2"/>
</robot>)"
std::string str
Definition: tesseract_srdf_unit.cpp:925

◆ EXPECT_EQ()

EXPECT_EQ ( sg->  getLink("l1") ->visual->material->getName()[0],
"test_material"   
)

◆ EXPECT_TRUE() [1/6]

EXPECT_TRUE ( g->  getJoints).size( = =9)

◆ EXPECT_TRUE() [2/6]

EXPECT_TRUE ( g->  isTree())

◆ EXPECT_TRUE() [3/6]

EXPECT_TRUE ( sg = nullptr)
Initial value:
{
tesseract_scene_graph::SceneGraph::Ptr sg = tesseract_urdf::parseURDFFile(std::string(TESSERACT_SUPPORT_DIR) + "/ur"
"df/"
"lbr"
"_ii"
"wa_"
"14_"
"r82"
"0."
"urd"
"f",
resource_locator)
std::shared_ptr< SceneGraph > Ptr
Definition: graph.h:130
tesseract_scene_graph::SceneGraph::UPtr parseURDFFile(const std::string &path, const tesseract_common::ResourceLocator &locator)
Parse a URDF file into a Tesseract Scene Graph.
Definition: urdf_parser.cpp:160
tesseract_scene_graph::SceneGraph::Ptr sg
Definition: tesseract_urdf_urdf_unit.cpp:31

◆ EXPECT_TRUE() [4/6]

EXPECT_TRUE ( sg->  getJoints).size( = =1)

◆ EXPECT_TRUE() [5/6]

EXPECT_TRUE ( sg->  getName() = ="test")

◆ EXPECT_TRUE() [6/6]

EXPECT_TRUE ( success  )

◆ saveDOT()

g saveDOT ( tesseract_common::getTempPath()+"tesseract_urdf_import.dot"  )

◆ std::cout<< path<< std::endl;EXPECT_TRUE(path.links.size()==4);EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_1") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_2") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_3") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_4") !=path.links.end());EXPECT_TRUE(path.joints.size()==3);EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a2") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a3") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a4") !=path.joints.end());} { { tesseract_scene_graph::SceneGraph::Ptr sg=nullptr;bool success=true;try { tesseract_urdf::writeURDFFile(sg, "/tmp/", "urdf0.urdf");} catch(...) { success=false;} EXPECT_FALSE(success);} { tesseract_scene_graph::SceneGraph::Ptr sg=std::make_shared< tesseract_scene_graph::SceneGraph >()

std::cout<< path<< std::endl;EXPECT_TRUE(path.links.size()==4);EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_1") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_2") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_3") !=path.links.end());EXPECT_TRUE(std::find(path.links.begin(), path.links.end(), "link_4") !=path.links.end());EXPECT_TRUE(path.joints.size()==3);EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a2") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a3") !=path.joints.end());EXPECT_TRUE(std::find(path.joints.begin(), path.joints.end(), "joint_a4") !=path.joints.end());} { { tesseract_scene_graph::SceneGraph::Ptr sg=nullptr;bool success=true;try { tesseract_urdf::writeURDFFile(sg, "/tmp/", "urdf0.urdf");} catch(...) { success=false;} EXPECT_FALSE(success);} { tesseract_scene_graph::SceneGraph::Ptr sg=std::make_shared< tesseract_scene_graph::SceneGraph > ( )

Variable Documentation

◆ child_link_name

joint_0 child_link_name = link_1->getName()

◆ g

◆ joint_0

sg addJoint * joint_0 = std::make_shared<tesseract_scene_graph::Joint>("joint_0")

◆ link_0

sg addLink * link_0 = std::make_shared<tesseract_scene_graph::Link>("link_0")

◆ link_1

sg addLink * link_1 = std::make_shared<tesseract_scene_graph::Link>("link_1")

◆ locator

◆ parent_link_name

joint_0 parent_link_name = link_0->getName()

◆ path

auto path = g->getShortestPath("link_1", "link_4")

◆ sg

◆ success

bool success = true

◆ TESSERACT_COMMON_IGNORE_WARNINGS_POP

TESSERACT_COMMON_IGNORE_WARNINGS_PUSH TESSERACT_COMMON_IGNORE_WARNINGS_POP
Initial value:
{
Abstract class for resource loaders.
Definition: tesseract_support_resource_locator.h:42

◆ try

try
Initial value:
{
tesseract_urdf::writeURDFFile(sg, "/tmp/", "urdf1.urdf")
void writeURDFFile(const tesseract_scene_graph::SceneGraph::ConstPtr &sg, const std::string &package_path, const std::string &urdf_name="")
Definition: urdf_parser.cpp:181

◆ type

◆ urdf_file

std::string urdf_file = std::string(TESSERACT_SUPPORT_DIR) + "/urdf/lbr_iiwa_14_r820.urdf"