robot_state_publisher.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 ROBOT_STATE_PUBLISHER_H
38 #define ROBOT_STATE_PUBLISHER_H
39 
40 #include <map>
41 #include <string>
42 
43 #include <ros/ros.h>
44 #include <urdf/model.h>
47 #include <kdl/frames.hpp>
48 #include <kdl/segment.hpp>
49 #include <kdl/tree.hpp>
50 
51 namespace robot_state_publisher {
52 
53 class SegmentPair
54 {
55 public:
56  SegmentPair(const KDL::Segment& p_segment, const std::string& p_root, const std::string& p_tip):
57  segment(p_segment), root(p_root), tip(p_tip){}
58 
59  KDL::Segment segment;
60  std::string root, tip;
61 };
62 
63 
64 class RobotStatePublisher
65 {
66 public:
70 
74  RobotStatePublisher(const KDL::Tree& tree, const urdf::Model& model = urdf::Model());
75 
78 
83  virtual void publishTransforms(const std::map<std::string, double>& joint_positions, const ros::Time& time);
84  virtual void publishFixedTransforms(bool use_tf_static = false);
85 
88  void publishTransforms(const std::map<std::string, double>& joint_positions, const ros::Time& time, const std::string & tf_prefix);
89  void publishFixedTransforms(const std::string & tf_prefix, bool use_tf_static = false);
90 
91 protected:
92  virtual void addChildren(const KDL::SegmentMap::const_iterator segment);
93 
94  std::map<std::string, SegmentPair> segments_, segments_fixed_;
98 };
99 
100 }
101 
102 #endif
robot_state_publisher::SegmentPair::segment
KDL::Segment segment
Definition: robot_state_publisher.h:123
robot_state_publisher::RobotStatePublisher::tf_broadcaster_
tf2_ros::TransformBroadcaster tf_broadcaster_
Definition: robot_state_publisher.h:128
robot_state_publisher::RobotStatePublisher::~RobotStatePublisher
~RobotStatePublisher()
Destructor.
Definition: robot_state_publisher.h:109
robot_state_publisher::RobotStatePublisher::addChildren
virtual void addChildren(const KDL::SegmentMap::const_iterator segment)
Definition: robot_state_publisher.cpp:92
ros.h
robot_state_publisher::SegmentPair::tip
std::string tip
Definition: robot_state_publisher.h:124
robot_state_publisher::RobotStatePublisher::publishFixedTransforms
virtual void publishFixedTransforms(bool use_tf_static=false)
Definition: robot_state_publisher.cpp:207
urdf::Model
transform_broadcaster.h
tf2_ros::StaticTransformBroadcaster
robot_state_publisher::RobotStatePublisher::segments_
std::map< std::string, SegmentPair > segments_
Definition: robot_state_publisher.h:126
model.h
robot_state_publisher::RobotStatePublisher::static_tf_broadcaster_
tf2_ros::StaticTransformBroadcaster static_tf_broadcaster_
Definition: robot_state_publisher.h:129
robot_state_publisher
Definition: joint_state_listener.h:52
ros::Time
robot_state_publisher::RobotStatePublisher::publishTransforms
virtual void publishTransforms(const std::map< std::string, double > &joint_positions, const ros::Time &time)
Definition: robot_state_publisher.cpp:202
robot_state_publisher::RobotStatePublisher::segments_fixed_
std::map< std::string, SegmentPair > segments_fixed_
Definition: robot_state_publisher.h:126
tf2_ros::TransformBroadcaster
static_transform_broadcaster.h
robot_state_publisher::SegmentPair::SegmentPair
SegmentPair(const KDL::Segment &p_segment, const std::string &p_root, const std::string &p_tip)
Definition: robot_state_publisher.h:120
robot_state_publisher::SegmentPair::root
std::string root
Definition: robot_state_publisher.h:124
robot_state_publisher::RobotStatePublisher::RobotStatePublisher
RobotStatePublisher()
Definition: robot_state_publisher.cpp:80
robot_state_publisher::RobotStatePublisher::model_
urdf::Model model_
Definition: robot_state_publisher.h:127


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