Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with new master of urdfdom (after they switched to tinyxml2) #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/hyrodyn/RobotModelHyrodyn.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "RobotModelHyrodyn.hpp"
#include <base-logging/Logging.hpp>
#include <urdf_parser/urdf_parser.h>
#include <tinyxml2.h>
#include <tools/URDFTools.hpp>

namespace wbc{
Expand Down Expand Up @@ -46,9 +47,9 @@ bool RobotModelHyrodyn::configure(const RobotModelConfig& cfg){
// Read Joint Limits
URDFTools::jointLimitsFromURDF(robot_urdf, joint_limits);

TiXmlDocument *doc = urdf::exportURDF(robot_urdf);
auto *doc = urdf::exportURDF(robot_urdf);
std::string robot_urdf_file = "/tmp/floating_base_model.urdf";
doc->SaveFile(robot_urdf_file);
doc->SaveFile(robot_urdf_file.c_str());
try{
hyrodyn.load_robotmodel(robot_urdf_file, cfg.submechanism_file);
}
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);
auto *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
2 changes: 1 addition & 1 deletion src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ file(GLOB SOURCES RELATIVE ${PROJECT_SOURCE_DIR}/src/types "*.cpp")
pkg_search_module(base-types REQUIRED IMPORTED_TARGET base-types)
pkg_search_module(base-logging REQUIRED IMPORTED_TARGET base-logging)
pkg_search_module(urdfdom REQUIRED IMPORTED_TARGET urdfdom)
pkg_search_module(tinyxml REQUIRED IMPORTED_TARGET tinyxml)
pkg_search_module(tinyxml REQUIRED IMPORTED_TARGET tinyxml2)
pkg_search_module(eigen3 REQUIRED IMPORTED_TARGET eigen3)

list(APPEND PKGCONFIG_REQUIRES base-types)
Expand Down
6 changes: 4 additions & 2 deletions src/tools/URDFTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <base/JointLimits.hpp>
#include <base-logging/Logging.hpp>
#include <urdf_model/link.h>
#include <tinyxml2.h>
#include <stack>
#include <iostream>

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;
auto *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