Skip to content

Commit

Permalink
use tinyxml2 instead of tinyxml
Browse files Browse the repository at this point in the history
  • Loading branch information
maltewi committed Dec 16, 2023
1 parent e905e33 commit 44309c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions bin/joint_limits_from_urdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <tools/URDFTools.hpp>
#include <base/JointLimits.hpp>
#include <boost/program_options.hpp>
#include <iostream>

using namespace wbc;
using namespace std;
Expand Down
5 changes: 3 additions & 2 deletions src/robot_models/rbdl/RobotModelRBDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <rbdl/rbdl_utils.h>
#include <rbdl/addons/urdfreader/urdfreader.h>
#include <base-logging/Logging.hpp>
#include <tinyxml2.h>

using namespace RigidBodyDynamics;

Expand Down Expand Up @@ -49,9 +50,9 @@ bool RobotModelRBDL::configure(const RobotModelConfig& cfg){
if(l.second->inertial)
l.second->inertial->origin.rotation.setFromRPY(0,0,0);
}
TiXmlDocument *doc = urdf::exportURDF(robot_urdf);
tinyxml2::XMLDocument *doc = urdf::exportURDF(robot_urdf);
std::string robot_urdf_file = "/tmp/robot.urdf";
doc->SaveFile(robot_urdf_file);
doc->SaveFile(robot_urdf_file.c_str());

if(!Addons::URDFReadFromFile(robot_urdf_file.c_str(), rbdl_model.get(), cfg.floating_base)){
LOG_ERROR_S << "Unable to parse urdf from file " << robot_urdf_file << std::endl;
Expand Down
6 changes: 4 additions & 2 deletions src/tools/URDFTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <base-logging/Logging.hpp>
#include <urdf_model/link.h>
#include <stack>
#include <iostream>
#include <tinyxml2.h>

namespace wbc {

Expand Down Expand Up @@ -123,8 +125,8 @@ std::vector<std::string> URDFTools::addFloatingBaseToURDF(urdf::ModelInterfaceSh

std::vector<std::string> floating_base_names = {"floating_base_trans_x", "floating_base_trans_y", "floating_base_trans_z",
"floating_base_rot_x", "floating_base_rot_y", "floating_base_rot_z"};
TiXmlDocument *doc = urdf::exportURDF(robot_urdf);
TiXmlPrinter printer;
tinyxml2::XMLDocument *doc = urdf::exportURDF(robot_urdf);
tinyxml2::XMLPrinter printer;
doc->Accept(&printer);
std::string robot_xml_string = printer.CStr();
robot_xml_string.erase(robot_xml_string.find("</robot>"), std::string("</robot>").length());
Expand Down

0 comments on commit 44309c9

Please sign in to comment.