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 rviz
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 fixedFrameChanged();
00113   virtual void createProperties();
00114   virtual void update(float wall_dt, float ros_dt);
00115   virtual void reset();
00116 
00117 protected:
00118   void subscribe();
00119   void unsubscribe();
00120   void clear();
00121 
00122   void createShapeProperties();
00123   void setVisibility();
00124 
00125   void incomingMessage( const geometry_msgs::PoseStamped::ConstPtr& message );
00126 
00127   // overrides from Display
00128   virtual void onEnable();
00129   virtual void onDisable();
00130 
00131   std::string topic_;
00132   Color color_;
00133   float alpha_;
00134   Shape current_shape_;
00135 
00136   // arrow-specific values
00137   float head_radius_;
00138   float head_length_;
00139   float shaft_radius_;
00140   float shaft_length_;
00141 
00142   // axes-specific values
00143   float axes_length_;
00144   float axes_radius_;
00145 
00146   rviz::Arrow* arrow_;
00147   rviz::Axes* axes_;
00148   CollObjectHandle coll_;
00149   PoseDisplaySelectionHandlerPtr coll_handler_;
00150 
00151   uint32_t messages_received_;
00152 
00153   Ogre::SceneNode* scene_node_;
00154 
00155   message_filters::Subscriber<geometry_msgs::PoseStamped> sub_;
00156   tf::MessageFilter<geometry_msgs::PoseStamped>* tf_filter_;
00157   geometry_msgs::PoseStampedConstPtr latest_message_;
00158 
00159   ROSTopicStringPropertyWPtr topic_property_;
00160   EnumPropertyWPtr shape_property_;
00161   CategoryPropertyWPtr shape_category_;
00162 
00163   ColorPropertyWPtr color_property_;
00164   FloatPropertyWPtr alpha_property_;
00165 
00166   FloatPropertyWPtr head_radius_property_;
00167   FloatPropertyWPtr head_length_property_;
00168   FloatPropertyWPtr shaft_radius_property_;
00169   FloatPropertyWPtr shaft_length_property_;
00170 
00171   FloatPropertyWPtr axes_length_property_;
00172   FloatPropertyWPtr axes_radius_property_;
00173 };
00174 
00175 } // namespace rviz
00176 
00177 #endif /* RVIZ_POSE_DISPLAY_H_ */


rviz
Author(s): Dave Hershberger, Josh Faust
autogenerated on Mon Jan 6 2014 11:54:32