Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Commit

Permalink
Allow supplying NodeHandle for initParam using new function.
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushk committed Jan 30, 2017
1 parent 7563f00 commit ab7c9d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions urdf/include/urdf/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <tinyxml.h>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <ros/ros.h>

namespace urdf{

Expand All @@ -58,6 +59,8 @@ class Model: public ModelInterface
bool initFile(const std::string& filename);
/// \brief Load Model given the name of a parameter on the parameter server
bool initParam(const std::string& param);
/// \brief Load Model given the name of a parameter on the parameter server using provided nodehandle
bool initParamWithNodeHandle(const std::string& param, const ros::NodeHandle& nh = ros::NodeHandle());
/// \brief Load Model from a XML-string
bool initString(const std::string& xmlstring);
};
Expand Down
8 changes: 5 additions & 3 deletions urdf/src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

#include "urdf/model.h"

#include <ros/ros.h>

/* we include the default parser for plain URDF files;
other parsers are loaded via plugins (if available) */
#include <urdf_parser/urdf_parser.h>
Expand Down Expand Up @@ -88,7 +86,11 @@ bool Model::initFile(const std::string& filename)

bool Model::initParam(const std::string& param)
{
ros::NodeHandle nh;
initParamWithNodeHandle(param, ros::NodeHandle());
}

bool Model::initParamWithNodeHandle(const std::string& param, const ros::NodeHandle& nh)
{
std::string xml_string;

// gets the location of the robot description on the parameter server
Expand Down

0 comments on commit ab7c9d7

Please sign in to comment.