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 <tf/tf.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) : tf::TransformException(errorDescription) { ; }
88 };
89 
90 
91 }
92 
93 #endif /* MESSAGE_CONTEXT_H_ */
std::string target_frame
Definition: client_test.cpp:74
MessageContext(tf::Transformer &tf, const std::string &target_frame, const typename MsgT::ConstPtr &msg, bool enable_autocomplete_transparency=true)
MessageContext< MsgT > & operator=(const MessageContext< MsgT > &other)
bool getTransform(std_msgs::Header &header, geometry_msgs::Pose &pose_msg)
InitFailException(const std::string errorDescription)


interactive_markers
Author(s): David Gossow, William Woodall
autogenerated on Mon Feb 28 2022 22:33:22