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 
gazebo::GazeboRosJointStatePublisher::update_rate_
double update_rate_
Definition: gazebo_ros_joint_state_publisher.h:80
ros::Publisher
gazebo::GazeboRosJointStatePublisher::robot_namespace_
std::string robot_namespace_
Definition: gazebo_ros_joint_state_publisher.h:76
boost::shared_ptr< ros::NodeHandle >
gazebo
gazebo::GazeboRosJointStatePublisher::OnUpdate
void OnUpdate(const common::UpdateInfo &_info)
Definition: gazebo_ros_joint_state_publisher.cpp:115
ros.h
gazebo::GazeboRosJointStatePublisher::joint_names_
std::vector< std::string > joint_names_
Definition: gazebo_ros_joint_state_publisher.h:77
transform_broadcaster.h
gazebo::GazeboRosJointStatePublisher::updateConnection
event::ConnectionPtr updateConnection
Definition: gazebo_ros_joint_state_publisher.h:66
gazebo::GazeboRosJointStatePublisher::last_update_time_
common::Time last_update_time_
Definition: gazebo_ros_joint_state_publisher.h:82
gazebo::GazeboRosJointStatePublisher::publishJointStates
void publishJointStates()
Definition: gazebo_ros_joint_state_publisher.cpp:147
gazebo::GazeboRosJointStatePublisher::joint_state_publisher_
ros::Publisher joint_state_publisher_
Definition: gazebo_ros_joint_state_publisher.h:74
gazebo::GZ_REGISTER_MODEL_PLUGIN
GZ_REGISTER_MODEL_PLUGIN(GazeboRosF3D)
gazebo::GazeboRosJointStatePublisher::GazeboRosJointStatePublisher
GazeboRosJointStatePublisher()
Definition: gazebo_ros_joint_state_publisher.cpp:38
gazebo::GazeboRosJointStatePublisher::world_
physics::WorldPtr world_
Definition: gazebo_ros_joint_state_publisher.h:67
gazebo::GazeboRosJointStatePublisher::~GazeboRosJointStatePublisher
~GazeboRosJointStatePublisher()
Definition: gazebo_ros_joint_state_publisher.cpp:41
gazebo::GazeboRosJointStatePublisher::Load
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Definition: gazebo_ros_joint_state_publisher.cpp:45
gazebo::GazeboRosJointStatePublisher::parent_
physics::ModelPtr parent_
Definition: gazebo_ros_joint_state_publisher.h:68
gazebo::GazeboRosJointStatePublisher::update_period_
double update_period_
Definition: gazebo_ros_joint_state_publisher.h:81
gazebo::GazeboRosJointStatePublisher
Definition: gazebo_ros_joint_state_publisher.h:57
gazebo::GazeboRosJointStatePublisher::tf_prefix_
std::string tf_prefix_
Definition: gazebo_ros_joint_state_publisher.h:75
gazebo::GazeboRosJointStatePublisher::joint_state_
sensor_msgs::JointState joint_state_
Definition: gazebo_ros_joint_state_publisher.h:73
gazebo::GazeboRosJointStatePublisher::joints_
std::vector< physics::JointPtr > joints_
Definition: gazebo_ros_joint_state_publisher.h:69
gazebo::GazeboRosJointStatePublisher::rosnode_
boost::shared_ptr< ros::NodeHandle > rosnode_
Definition: gazebo_ros_joint_state_publisher.h:72


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55