00001 /* 00002 * Copyright 2015 Aldebaran 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 00018 #ifndef JOINT_STATES_PUBLISHER_HPP 00019 #define JOINT_STATES_PUBLISHER_HPP 00020 00021 /* 00022 * ROS includes 00023 */ 00024 #include <ros/ros.h> 00025 #include <geometry_msgs/Transform.h> 00026 #include <sensor_msgs/JointState.h> 00027 #include <tf2_ros/transform_broadcaster.h> 00028 00029 namespace naoqi 00030 { 00031 namespace publisher 00032 { 00033 00034 class JointStatePublisher 00035 { 00036 00037 public: 00038 JointStatePublisher( const std::string& topic = "/joint_states" ); 00039 00040 inline std::string topic() const 00041 { 00042 return topic_; 00043 } 00044 00045 inline bool isInitialized() const 00046 { 00047 return is_initialized_; 00048 } 00049 00050 virtual void publish( const sensor_msgs::JointState& js_msg, 00051 const std::vector<geometry_msgs::TransformStamped>& tf_transforms ); 00052 00053 virtual void reset( ros::NodeHandle& nh ); 00054 00055 virtual bool isSubscribed() const; 00056 00057 private: 00058 boost::shared_ptr<tf2_ros::TransformBroadcaster> tf_broadcasterPtr_; 00059 00061 ros::Publisher pub_joint_states_; 00062 00063 std::string topic_; 00064 00065 bool is_initialized_; 00066 00067 }; // class 00068 00069 } //publisher 00070 } // naoqi 00071 00072 #endif