pose_display.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, 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 "rviz/display.h"
00035 #include "rviz/helpers/color.h"
00036 #include "rviz/properties/forwards.h"
00037 #include "rviz/selection/forwards.h"
00038 
00039 #include <geometry_msgs/PoseStamped.h>
00040 
00041 #include <boost/shared_ptr.hpp>
00042 #include <boost/thread/mutex.hpp>
00043 
00044 #include <message_filters/subscriber.h>
00045 #include <tf/message_filter.h>
00046 
00047 namespace ogre_tools
00048 {
00049 class Arrow;
00050 class Axes;
00051 class Shape;
00052 }
00053 
00054 namespace Ogre
00055 {
00056 class SceneNode;
00057 }
00058 
00059 namespace rviz
00060 {
00061 
00062 class PoseDisplaySelectionHandler;
00063 typedef boost::shared_ptr<PoseDisplaySelectionHandler> PoseDisplaySelectionHandlerPtr;
00064 
00069 class PoseDisplay : public Display
00070 {
00071 public:
00072   enum Shape
00073   {
00074     Arrow,
00075     Axes,
00076   };
00077 
00078   PoseDisplay();
00079   virtual ~PoseDisplay();
00080 
00081   virtual void onInitialize();
00082 
00083   void setTopic( const std::string& topic );
00084   const std::string& getTopic() { return topic_; }
00085 
00086   void setColor( const Color& color );
00087   const Color& getColor() { return color_; }
00088 
00089   void setShape(int shape);
00090   int getShape() { return current_shape_; }
00091 
00092   void setAlpha(float a);
00093   float getAlpha() { return alpha_; }
00094 
00095   // arrow-specific setters/getters
00096   void setHeadRadius(float r);
00097   float getHeadRadius() { return head_radius_; }
00098   void setHeadLength(float l);
00099   float getHeadLength() { return head_length_; }
00100   void setShaftRadius(float r);
00101   float getShaftRadius() { return shaft_radius_; }
00102   void setShaftLength(float l);
00103   float getShaftLength() { return shaft_length_; }
00104 
00105   // axes-specific setters/getters
00106   void setAxesRadius(float r);
00107   float getAxesRadius() { return axes_radius_; }
00108   void setAxesLength(float l);
00109   float getAxesLength() { return axes_length_; }
00110 
00111   // Overrides from Display
00112   virtual void targetFrameChanged();
00113   virtual void fixedFrameChanged();
00114   virtual void createProperties();
00115   virtual void update(float wall_dt, float ros_dt);
00116   virtual void reset();
00117 
00118 protected:
00119   void subscribe();
00120   void unsubscribe();
00121   void clear();
00122 
00123   void createShapeProperties();
00124   void setVisibility();
00125 
00126   void incomingMessage( const geometry_msgs::PoseStamped::ConstPtr& message );
00127 
00128   // overrides from Display
00129   virtual void onEnable();
00130   virtual void onDisable();
00131 
00132   std::string topic_;
00133   Color color_;
00134   float alpha_;
00135   Shape current_shape_;
00136 
00137   // arrow-specific values
00138   float head_radius_;
00139   float head_length_;
00140   float shaft_radius_;
00141   float shaft_length_;
00142 
00143   // axes-specific values
00144   float axes_length_;
00145   float axes_radius_;
00146 
00147   ogre_tools::Arrow* arrow_;
00148   ogre_tools::Axes* axes_;
00149   CollObjectHandle coll_;
00150   PoseDisplaySelectionHandlerPtr coll_handler_;
00151 
00152   uint32_t messages_received_;
00153 
00154   Ogre::SceneNode* scene_node_;
00155 
00156   message_filters::Subscriber<geometry_msgs::PoseStamped> sub_;
00157   tf::MessageFilter<geometry_msgs::PoseStamped>* tf_filter_;
00158   geometry_msgs::PoseStampedConstPtr latest_message_;
00159 
00160   ROSTopicStringPropertyWPtr topic_property_;
00161   EnumPropertyWPtr shape_property_;
00162   CategoryPropertyWPtr shape_category_;
00163 
00164   ColorPropertyWPtr color_property_;
00165   FloatPropertyWPtr alpha_property_;
00166 
00167   FloatPropertyWPtr head_radius_property_;
00168   FloatPropertyWPtr head_length_property_;
00169   FloatPropertyWPtr shaft_radius_property_;
00170   FloatPropertyWPtr shaft_length_property_;
00171 
00172   FloatPropertyWPtr axes_length_property_;
00173   FloatPropertyWPtr axes_radius_property_;
00174 };
00175 
00176 } // namespace rviz
00177 
00178 #endif /* RVIZ_POSE_DISPLAY_H_ */


rviz_qt
Author(s): Dave Hershberger
autogenerated on Fri Dec 6 2013 20:56:53