.. _program_listing_file__tmp_ws_src_rviz_visual_tools_include_rviz_visual_tools_tf_visual_tools.hpp: Program Listing for File tf_visual_tools.hpp ============================================ |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/rviz_visual_tools/include/rviz_visual_tools/tf_visual_tools.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2021 PickNik Inc. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of the PickNik Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. /* Author: Dave Coleman Desc: Helps debug and visualize transforms via the TF infrastructure Note: We shouldn't have to publish the transforms at interval since they are static, but we do because of https://github.com/ros/geometry_experimental/issues/108 */ #pragma once // C++ #include #include // ROS #include #include // Eigen #include #include // namespace tf2_ros // { // class StaticTransformBroadcaster; // }; namespace rviz_visual_tools { class TFVisualTools { public: TFVisualTools(const rclcpp::Node::SharedPtr& node, double loop_hz = 2); bool publishTransform(const Eigen::Isometry3d& transform, const std::string& from_frame, const std::string& to_frame); void clearAllTransforms(); private: void publishAllTransforms(); // Node Interfaces // rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface_; // rclcpp::node_interfaces::NodeGraphInterface::SharedPtr graph_interface_; // rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logging_interface_; rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface_; rclcpp::node_interfaces::NodeTimersInterface::SharedPtr timers_interface_; rclcpp::node_interfaces::NodeClockInterface::SharedPtr clock_interface_; rclcpp::Logger logger_; // Send tf messages std::shared_ptr tf_broadcaster_; // Separate thread to publish transforms rclcpp::TimerBase::SharedPtr non_realtime_loop_; // Collect the transfroms std::vector transforms_; }; // end class // Create boost pointers for this class typedef std::shared_ptr TFVisualToolsPtr; typedef std::shared_ptr TFVisualToolsConstPtr; } // namespace rviz_visual_tools