add deprecate warning at compile and at run time. Update regression tests to dom parser

This commit is contained in:
meeussen 2009-09-22 23:37:53 +00:00
parent f3e3ecec0b
commit 3105a9f386
5 changed files with 1768 additions and 2756 deletions

View File

@ -45,9 +45,16 @@ using namespace std;
namespace kdl_parser{ namespace kdl_parser{
/// Constructs a KDL tree from a file, given the file name
bool treeFromFile(const string& file, KDL::Tree& tree); bool treeFromFile(const string& file, KDL::Tree& tree);
/// Constructs a KDL tree from a string containing xml
bool treeFromString(const string& xml, KDL::Tree& tree); bool treeFromString(const string& xml, KDL::Tree& tree);
/// Constructs a KDL tree from a TiXmlDocument
bool treeFromXml(TiXmlDocument *xml_doc, KDL::Tree& tree); bool treeFromXml(TiXmlDocument *xml_doc, KDL::Tree& tree);
/// Constructs a KDL tree from a URDF robot model
bool treeFromRobotModel(urdf::Model& robot_model, KDL::Tree& tree); bool treeFromRobotModel(urdf::Model& robot_model, KDL::Tree& tree);
} }

View File

@ -37,6 +37,8 @@
#ifndef XML_PARSER_H #ifndef XML_PARSER_H
#define XML_PARSER_H #define XML_PARSER_H
#warning ____YOU ARE INCLUDING THE DEPRECATED KDL PARSER. PLEASE SWITCH TO THE NEW KDL PARSER. SEE www.ros.org/wiki/kdl_parser FOR DETAILS____
#include <kdl/tree.hpp> #include <kdl/tree.hpp>
#include <string> #include <string>
#include <tinyxml/tinyxml.h> #include <tinyxml/tinyxml.h>

View File

@ -36,7 +36,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include "kdl_parser/xml_parser.hpp" #include "kdl_parser/xml_parser.hpp"
#include <ros/ros.h>
using namespace std; using namespace std;
namespace KDL{ namespace KDL{
@ -265,6 +265,8 @@ void addChildrenToTree(const string& root, const map<string, Segment>& segments,
bool getTree(TiXmlElement *robot_xml, Tree& tree) bool getTree(TiXmlElement *robot_xml, Tree& tree)
{ {
ROS_ERROR("You are using the deprecated kdl parser. Please update to the new kdl parser. See www.ros.org/wiki/kdl_parser for more details");
cout << "Parsing robot xml" << endl; cout << "Parsing robot xml" << endl;
if (!robot_xml) return false; if (!robot_xml) return false;

File diff suppressed because it is too large Load Diff

View File

@ -37,9 +37,9 @@
#include <string> #include <string>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <ros/ros.h> #include <ros/ros.h>
#include "kdl_parser/xml_parser.hpp" #include "kdl_parser/dom_parser.hpp"
using namespace KDL; using namespace kdl_parser;
int g_argc; int g_argc;
char** g_argv; char** g_argv;
@ -47,7 +47,7 @@ char** g_argv;
class TestParser : public testing::Test class TestParser : public testing::Test
{ {
public: public:
Tree my_tree; KDL::Tree my_tree;
protected: protected:
/// constructor /// constructor
@ -72,10 +72,10 @@ TEST_F(TestParser, test)
} }
ASSERT_TRUE(treeFromFile(g_argv[g_argc-1], my_tree)); ASSERT_TRUE(treeFromFile(g_argv[g_argc-1], my_tree));
ASSERT_TRUE(my_tree.getNrOfJoints() == 38); ASSERT_EQ(my_tree.getNrOfJoints(), (unsigned int)39);
ASSERT_TRUE(my_tree.getNrOfSegments() == 51); ASSERT_EQ(my_tree.getNrOfSegments(), (unsigned int)51);
ASSERT_TRUE(my_tree.getSegment("world") == my_tree.getRootSegment()); ASSERT_TRUE(my_tree.getSegment("world") == my_tree.getRootSegment());
ASSERT_TRUE(my_tree.getRootSegment()->second.children.size() == 1); ASSERT_EQ(my_tree.getRootSegment()->second.children.size(), (unsigned int)1);
ASSERT_TRUE(my_tree.getSegment("base_link")->second.parent == my_tree.getRootSegment()); ASSERT_TRUE(my_tree.getSegment("base_link")->second.parent == my_tree.getRootSegment());
SUCCEED(); SUCCEED();
} }