00001 /* 00002 * Copyright (c) 2012, Willow Garage, Inc. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the Willow Garage, Inc. nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 00031 #ifndef RVIZ_POSE_DISPLAY_H_ 00032 #define RVIZ_POSE_DISPLAY_H_ 00033 00034 #include <boost/shared_ptr.hpp> 00035 00036 #include <geometry_msgs/PoseStamped.h> 00037 00038 #include "rviz/message_filter_display.h" 00039 #include "rviz/selection/forwards.h" 00040 00041 namespace rviz 00042 { 00043 class Arrow; 00044 class Axes; 00045 class ColorProperty; 00046 class EnumProperty; 00047 class FloatProperty; 00048 class Shape; 00049 00050 class PoseDisplaySelectionHandler; 00051 typedef boost::shared_ptr<PoseDisplaySelectionHandler> PoseDisplaySelectionHandlerPtr; 00052 00054 class PoseDisplay: public MessageFilterDisplay<geometry_msgs::PoseStamped> 00055 { 00056 Q_OBJECT 00057 public: 00058 enum Shape 00059 { 00060 Arrow, 00061 Axes, 00062 }; 00063 00064 PoseDisplay(); 00065 virtual ~PoseDisplay(); 00066 00067 virtual void onInitialize(); 00068 virtual void reset(); 00069 00070 protected: 00072 virtual void onEnable(); 00073 00074 private Q_SLOTS: 00075 void updateShapeVisibility(); 00076 void updateColorAndAlpha(); 00077 void updateShapeChoice(); 00078 void updateAxisGeometry(); 00079 void updateArrowGeometry(); 00080 00081 private: 00082 void clear(); 00083 00084 virtual void processMessage( const geometry_msgs::PoseStamped::ConstPtr& message ); 00085 00086 rviz::Arrow* arrow_; 00087 rviz::Axes* axes_; 00088 bool pose_valid_; 00089 PoseDisplaySelectionHandlerPtr coll_handler_; 00090 00091 EnumProperty* shape_property_; 00092 00093 ColorProperty* color_property_; 00094 FloatProperty* alpha_property_; 00095 00096 FloatProperty* head_radius_property_; 00097 FloatProperty* head_length_property_; 00098 FloatProperty* shaft_radius_property_; 00099 FloatProperty* shaft_length_property_; 00100 00101 FloatProperty* axes_length_property_; 00102 FloatProperty* axes_radius_property_; 00103 00104 friend class PoseDisplaySelectionHandler; 00105 }; 00106 00107 } // namespace rviz 00108 00109 #endif /* RVIZ_POSE_DISPLAY_H_ */