joint_state_listener.h
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2008, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the Willow Garage nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Author: Wim Meeussen */
36 
37 #ifndef JOINT_STATE_LISTENER_H
38 #define JOINT_STATE_LISTENER_H
39 
40 #include <memory>
41 #include <map>
42 #include <string>
43 
44 #include <boost/scoped_ptr.hpp>
45 #include <urdf/model.h>
46 #include <kdl/tree.hpp>
47 #include <ros/ros.h>
48 #include <sensor_msgs/JointState.h>
49 
51 
53 
55 typedef std::map<std::string, urdf::JointMimicSharedPtr > MimicMap;
56 
57 class JointStateListener {
58 public:
62 
66  JointStateListener(const KDL::Tree& tree, const MimicMap& m, const urdf::Model& model = urdf::Model());
67 
68  JointStateListener(const std::shared_ptr<RobotStatePublisher>& rsp, const MimicMap& m);
69 
70 
73 
74 private:
75  std::string getTFPrefix();
76 
77 protected:
78  virtual void callbackJointState(const JointStateConstPtr& state);
79  virtual void callbackFixedJoint(const ros::TimerEvent& e);
80 
82  std::shared_ptr<RobotStatePublisher> state_publisher_;
86  std::map<std::string, ros::Time> last_publish_time_;
88  bool use_tf_static_;
90 
91 };
92 }
93 
94 #endif
robot_state_publisher::JointStateListener::joint_state_sub_
ros::Subscriber joint_state_sub_
Definition: joint_state_listener.h:115
boost::shared_ptr
ros.h
robot_state_publisher::JointStateConstPtr
boost::shared_ptr< sensor_msgs::JointState const > JointStateConstPtr
Definition: joint_state_listener.h:86
robot_state_publisher::JointStateListener::mimic_
MimicMap mimic_
Definition: joint_state_listener.h:119
robot_state_publisher::JointStateListener
Definition: joint_state_listener.h:89
urdf::Model
robot_state_publisher::JointStateListener::getTFPrefix
std::string getTFPrefix()
Definition: joint_state_listener.cpp:93
robot_state_publisher::JointStateListener::use_tf_static_
bool use_tf_static_
Definition: joint_state_listener.h:120
robot_state_publisher::JointStateListener::last_publish_time_
std::map< std::string, ros::Time > last_publish_time_
Definition: joint_state_listener.h:118
robot_state_publisher::JointStateListener::callbackJointState
virtual void callbackJointState(const JointStateConstPtr &state)
Definition: joint_state_listener.cpp:112
model.h
robot_state_publisher
Definition: joint_state_listener.h:52
ros::TimerEvent
robot_state_publisher.h
robot_state_publisher::JointStateListener::publish_interval_
ros::Duration publish_interval_
Definition: joint_state_listener.h:113
robot_state_publisher::JointStateListener::last_callback_time_
ros::Time last_callback_time_
Definition: joint_state_listener.h:117
robot_state_publisher::MimicMap
std::map< std::string, urdf::JointMimicSharedPtr > MimicMap
Definition: joint_state_listener.h:87
robot_state_publisher::JointStateListener::JointStateListener
JointStateListener()
Definition: joint_state_listener.cpp:51
ros::Time
robot_state_publisher::JointStateListener::state_publisher_
std::shared_ptr< RobotStatePublisher > state_publisher_
Definition: joint_state_listener.h:114
robot_state_publisher::JointStateListener::~JointStateListener
~JointStateListener()
Destructor.
Definition: joint_state_listener.cpp:90
robot_state_publisher::JointStateListener::timer_
ros::Timer timer_
Definition: joint_state_listener.h:116
ros::Duration
ros::Timer
robot_state_publisher::JointStateListener::ignore_timestamp_
bool ignore_timestamp_
Definition: joint_state_listener.h:121
robot_state_publisher::JointStateListener::callbackFixedJoint
virtual void callbackFixedJoint(const ros::TimerEvent &e)
Definition: joint_state_listener.cpp:106
ros::Subscriber


robot_state_publisher
Author(s): Ioan Sucan , Jackie Kay , Wim Meeussen
autogenerated on Fri Nov 3 2023 02:08:42