message_context.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Author: David Gossow
30  *//*
31  * message_context.h
32  *
33  * Created on: Jul 17, 2012
34  * Author: gossow
35  */
36 
37 #ifndef MESSAGE_CONTEXT_H_
38 #define MESSAGE_CONTEXT_H_
39 
40 #include <tf2_ros/buffer.h>
41 
42 #include <visualization_msgs/InteractiveMarkerInit.h>
43 #include <visualization_msgs/InteractiveMarkerUpdate.h>
44 
46 {
47 
48 template<class MsgT>
50 {
51 public:
53  const std::string& target_frame,
54  const typename MsgT::ConstPtr& msg,
55  bool enable_autocomplete_transparency = true);
56 
58 
59  // transform all messages with timestamp into target frame
60  void getTfTransforms();
61 
62  typename MsgT::Ptr msg;
63 
64  // return true if tf info is complete
65  bool isReady();
66 
67 private:
68 
69  void init();
70 
71  bool getTransform( std_msgs::Header& header, geometry_msgs::Pose& pose_msg );
72 
73  void getTfTransforms( std::vector<visualization_msgs::InteractiveMarker>& msg_vec, std::list<size_t>& indices );
74  void getTfTransforms( std::vector<visualization_msgs::InteractiveMarkerPose>& msg_vec, std::list<size_t>& indices );
75 
76  // array indices of marker/pose updates with missing tf info
77  std::list<size_t> open_marker_idx_;
78  std::list<size_t> open_pose_idx_;
80  std::string target_frame_;
82 };
83 
85 {
86 public:
87  InitFailException(const std::string errorDescription) : tf2::TransformException(errorDescription) { ; }
88 };
89 
90 
91 }
92 
93 #endif /* MESSAGE_CONTEXT_H_ */
interactive_markers::MessageContext::getTfTransforms
void getTfTransforms()
interactive_markers::InitFailException
Definition: message_context.h:84
interactive_markers::MessageContext::msg
MsgT::Ptr msg
Definition: message_context.h:62
interactive_markers::MessageContext::tf_
tf2_ros::Buffer & tf_
Definition: message_context.h:79
interactive_markers::MessageContext::enable_autocomplete_transparency_
bool enable_autocomplete_transparency_
Definition: message_context.h:81
buffer.h
interactive_markers::MessageContext::target_frame_
std::string target_frame_
Definition: message_context.h:80
interactive_markers::MessageContext::open_pose_idx_
std::list< size_t > open_pose_idx_
Definition: message_context.h:78
interactive_markers::MessageContext::isReady
bool isReady()
Definition: message_context.cpp:170
interactive_markers::MessageContext::open_marker_idx_
std::list< size_t > open_marker_idx_
Definition: message_context.h:77
interactive_markers::InitFailException::InitFailException
InitFailException(const std::string errorDescription)
Definition: message_context.h:87
interactive_markers::MessageContext::getTransform
bool getTransform(std_msgs::Header &header, geometry_msgs::Pose &pose_msg)
Definition: message_context.cpp:71
tf2_ros::Buffer
interactive_markers::MessageContext::MessageContext
MessageContext(tf2_ros::Buffer &tf, const std::string &target_frame, const typename MsgT::ConstPtr &msg, bool enable_autocomplete_transparency=true)
Definition: message_context.cpp:45
interactive_markers::MessageContext
Definition: message_context.h:49
interactive_markers::MessageContext::operator=
MessageContext< MsgT > & operator=(const MessageContext< MsgT > &other)
Definition: message_context.cpp:61
tf2
interactive_markers::MessageContext::init
void init()
target_frame
std::string target_frame
Definition: client_test.cpp:72
interactive_markers
Definition: message_context.h:45
tf2::TransformException
tf2::TransformException::TransformException
TransformException(const std::string errorDescription)


interactive_markers
Author(s): David Gossow, William Woodall
autogenerated on Fri Oct 27 2023 02:31:54