28 #include <boost/algorithm/string.hpp> 
   30 #ifdef ENABLE_PROFILER 
   31 #include <ignition/common/Profiler.hh> 
   48     this->
world_ = _parent->GetWorld();
 
   51     if ( !_sdf->HasElement ( 
"robotNamespace" ) ) {
 
   52         ROS_INFO_NAMED(
"joint_state_publisher", 
"GazeboRosJointStatePublisher Plugin missing <robotNamespace>, defaults to \"%s\"",
 
   55         this->
robot_namespace_ = _sdf->GetElement ( 
"robotNamespace" )->Get<std::string>();
 
   61     if ( !_sdf->HasElement ( 
"jointName" ) ) {
 
   62         ROS_ASSERT ( 
"GazeboRosJointStatePublisher Plugin missing jointNames" );
 
   64         sdf::ElementPtr element = _sdf->GetElement ( 
"jointName" ) ;
 
   65         std::string joint_names = element->Get<std::string>();
 
   66         boost::erase_all ( joint_names, 
" " );
 
   67         boost::split ( 
joint_names_, joint_names, boost::is_any_of ( 
"," ) );
 
   71     if ( !_sdf->HasElement ( 
"updateRate" ) ) {
 
   72         ROS_WARN_NAMED(
"joint_state_publisher", 
"GazeboRosJointStatePublisher Plugin (ns = %s) missing <updateRate>, defaults to %f",
 
   75         this->
update_rate_ = _sdf->GetElement ( 
"updateRate" )->Get<
double>();
 
   84 #if GAZEBO_MAJOR_VERSION >= 8 
   90     for ( 
unsigned int i = 0; i< 
joint_names_.size(); i++ ) {
 
   96         ROS_INFO_NAMED(
"joint_state_publisher", 
"GazeboRosJointStatePublisher is going to publish joint: %s", 
joint_names_[i].c_str() );
 
  104 #if GAZEBO_MAJOR_VERSION >= 8 
  107     last_update_time_ = this->
world_->GetSimTime();
 
  117 #ifdef ENABLE_PROFILER 
  118   IGN_PROFILE(
"GazeboRosCamera::OnNewFrame");
 
  121 #if GAZEBO_MAJOR_VERSION >= 8 
  122     common::Time current_time = this->
world_->SimTime();
 
  124     common::Time current_time = this->
world_->GetSimTime();
 
  128         ROS_WARN_NAMED(
"joint_state_publisher", 
"Negative joint state update time difference detected.");
 
  132     double seconds_since_last_update = ( current_time - 
last_update_time_ ).Double();
 
  135 #ifdef ENABLE_PROFILER 
  136         IGN_PROFILE_BEGIN(
"publishJointStates");
 
  139 #ifdef ENABLE_PROFILER 
  155     for ( 
int i = 0; i < 
joints_.size(); i++ ) {
 
  156         physics::JointPtr joint = 
joints_[i];
 
  157         double velocity = joint->GetVelocity( 0 );
 
  158 #if GAZEBO_MAJOR_VERSION >= 8 
  159         double position = joint->Position ( 0 );
 
  161         double position = joint->GetAngle ( 0 ).Radian();