tf_visual_tools.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2017, PickNik Consulting
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 Univ of CO, Boulder 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: Dave Coleman <dave@picknik.ai>
36  Desc: Helps debug and visualize transforms via the TF infrastructure
37  Note: We shouldn't have to publish the transforms at interval since they are static, but we do
38  because of https://github.com/ros/geometry_experimental/issues/108
39 */
40 
41 #pragma once
42 
43 // C++
44 #include <vector>
45 #include <string>
46 
47 // ROS
48 #include <ros/ros.h>
49 #include <geometry_msgs/TransformStamped.h>
50 
51 // Eigen
52 #include <Eigen/Geometry>
53 
55 
56 // namespace tf2_ros
57 // {
58 // class StaticTransformBroadcaster;
59 // };
60 
61 namespace rviz_visual_tools
62 {
63 class TFVisualTools
64 {
65 public:
70  explicit TFVisualTools(double loop_hz = 2);
71 
76  bool publishTransform(const Eigen::Isometry3d& transform, const std::string& from_frame, const std::string& to_frame);
77 
81  void clearAllTransforms();
82 
89 
90 private:
91  // A shared node handle
93 
94  // Send tf messages
96 
97  // Separate thread to publish transforms
99 
100  // Collect the transfroms
101  std::vector<geometry_msgs::TransformStamped> transforms_;
102 }; // end class
103 
104 // Create boost pointers for this class
107 
108 } // namespace rviz_visual_tools
rviz_visual_tools::TFVisualTools::nh_
ros::NodeHandle nh_
Definition: tf_visual_tools.h:156
rviz_visual_tools::TFVisualTools::publishTransform
bool publishTransform(const Eigen::Isometry3d &transform, const std::string &from_frame, const std::string &to_frame)
Visualize transforms in Rviz, etc.
Definition: tf_visual_tools.cpp:89
rviz_visual_tools::TFVisualTools::publishAllTransforms
void publishAllTransforms(const ros::TimerEvent &e)
At a certain frequency update the tf transforms that we are tracking This is called internally by a c...
Definition: tf_visual_tools.cpp:135
boost::shared_ptr
ros.h
rviz_visual_tools::TFVisualTools::non_realtime_loop_
ros::Timer non_realtime_loop_
Definition: tf_visual_tools.h:162
rviz_visual_tools
Definition: imarker_simple.h:55
rviz_visual_tools::TFVisualTools::transforms_
std::vector< geometry_msgs::TransformStamped > transforms_
Definition: tf_visual_tools.h:165
transform_broadcaster.h
rviz_visual_tools::TFVisualTools::tf_pub_
tf2_ros::TransformBroadcaster tf_pub_
Definition: tf_visual_tools.h:159
rviz_visual_tools::TFVisualTools::TFVisualTools
TFVisualTools(double loop_hz=2)
Constructor.
Definition: tf_visual_tools.cpp:81
rviz_visual_tools::TFVisualToolsConstPtr
boost::shared_ptr< const TFVisualTools > TFVisualToolsConstPtr
Definition: tf_visual_tools.h:138
ros::TimerEvent
rviz_visual_tools::TFVisualToolsPtr
boost::shared_ptr< TFVisualTools > TFVisualToolsPtr
Definition: tf_visual_tools.h:137
tf2_ros::TransformBroadcaster
rviz_visual_tools::TFVisualTools::clearAllTransforms
void clearAllTransforms()
Clear all transforms.
Definition: tf_visual_tools.cpp:130
ros::Timer
ros::NodeHandle


rviz_visual_tools
Author(s): Dave Coleman
autogenerated on Wed Mar 2 2022 01:03:26