joint_state_controller.h
Go to the documentation of this file.
1 // Copyright (C) 2012, hiDOF INC.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright notice,
7 // this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of hiDOF, Inc. nor the names of its
12 // contributors may be used to endorse or promote products derived from
13 // this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 // POSSIBILITY OF SUCH DAMAGE.
27 
28 /*
29  * Author: Wim Meeussen
30  */
31 
32 #ifndef JOINT_STATE_CONTROLLER_JOINT_STATE_CONTROLLER_H
33 #define JOINT_STATE_CONTROLLER_JOINT_STATE_CONTROLLER_H
34 
38 #include <sensor_msgs/JointState.h>
40 #include <boost/shared_ptr.hpp>
41 
43 {
44 
79 class JointStateController: public controller_interface::Controller<hardware_interface::JointStateInterface>
80 {
81 public:
83 
85  ros::NodeHandle& root_nh,
86  ros::NodeHandle& controller_nh);
87  virtual void starting(const ros::Time& time);
88  virtual void update(const ros::Time& time, const ros::Duration& /*period*/);
89  virtual void stopping(const ros::Time& /*time*/);
90 
91 private:
92  std::vector<hardware_interface::JointStateHandle> joint_state_;
95  double publish_rate_;
96  unsigned int num_hw_joints_;
97 
98  void addExtraJoints(const ros::NodeHandle& nh, sensor_msgs::JointState& msg);
99 };
100 
101 }
102 
103 #endif
virtual void update(const ros::Time &time, const ros::Duration &)
virtual bool init(hardware_interface::JointStateInterface *hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh)
virtual void starting(const ros::Time &time)
unsigned int num_hw_joints_
Number of joints present in the JointStateInterface, excluding extra joints.
void addExtraJoints(const ros::NodeHandle &nh, sensor_msgs::JointState &msg)
boost::shared_ptr< realtime_tools::RealtimePublisher< sensor_msgs::JointState > > realtime_pub_
std::vector< hardware_interface::JointStateHandle > joint_state_
Controller that publishes the state of all joints in a robot.


joint_state_controller
Author(s): Wim Meeussen
autogenerated on Thu Apr 11 2019 03:08:35