gazebo_ros_joint_state_publisher.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, Markus Bader <markus.bader@tuwien.ac.at>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY Antons Rebguns <email> ''AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL Antons Rebguns <email> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **/
28 
29 
30 #ifndef JOINT_STATE_PUBLISHER_PLUGIN_HH
31 #define JOINT_STATE_PUBLISHER_PLUGIN_HH
32 
33 #include <boost/bind.hpp>
34 #include <gazebo/gazebo.hh>
35 #include <gazebo/physics/physics.hh>
36 #include <gazebo/common/common.hh>
37 #include <stdio.h>
38 
39 // ROS
40 #include <ros/ros.h>
42 #include <sensor_msgs/JointState.h>
43 
44 // Usage in URDF:
45 // <gazebo>
46 // <plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
47 // <robotNamespace>/pioneer2dx</robotNamespace>
48 // <jointName>chassis_swivel_joint, swivel_wheel_joint, left_hub_joint, right_hub_joint</jointName>
49 // <updateRate>100.0</updateRate>
50 // <alwaysOn>true</alwaysOn>
51 // </plugin>
52 // </gazebo>
53 
54 
55 
56 namespace gazebo {
57 class GazeboRosJointStatePublisher : public ModelPlugin {
58 public:
61  void Load ( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
62  void OnUpdate ( const common::UpdateInfo & _info );
63  void publishJointStates();
64  // Pointer to the model
65 private:
66  event::ConnectionPtr updateConnection;
67  physics::WorldPtr world_;
68  physics::ModelPtr parent_;
69  std::vector<physics::JointPtr> joints_;
70 
71  // ROS STUFF
73  sensor_msgs::JointState joint_state_;
75  std::string tf_prefix_;
76  std::string robot_namespace_;
77  std::vector<std::string> joint_names_;
78 
79  // Update Rate
80  double update_rate_;
82  common::Time last_update_time_;
83 
84 };
85 
86 // Register this plugin with the simulator
88 }
89 
90 #endif //JOINT_STATE_PUBLISHER_PLUGIN_HH
91 
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
boost::shared_ptr< ros::NodeHandle > rosnode_
GZ_REGISTER_MODEL_PLUGIN(GazeboRosF3D)
void OnUpdate(const common::UpdateInfo &_info)


gazebo_plugins
Author(s): John Hsu
autogenerated on Tue Mar 26 2019 02:31:27