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 #ifndef MOTION_PLANNING_RVIZ_PLUGIN_PLANNING_DISPLAY_H 00031 #define MOTION_PLANNING_RVIZ_PLUGIN_PLANNING_DISPLAY_H 00032 00033 #include "rviz/display.h" 00034 00035 #include <arm_navigation_msgs/DisplayTrajectory.h> 00036 #include <std_msgs/Bool.h> 00037 00038 #include <ros/ros.h> 00039 00040 #include <map> 00041 00042 namespace Ogre 00043 { 00044 class Entity; 00045 class SceneNode; 00046 } 00047 00048 namespace planning_models 00049 { 00050 class KinematicModel; 00051 } 00052 00053 namespace planning_environment 00054 { 00055 class RobotModels; 00056 } 00057 00058 namespace rviz 00059 { 00060 class Robot; 00061 class BoolProperty; 00062 class FloatProperty; 00063 class StringProperty; 00064 class RosTopicProperty; 00065 } 00066 00067 namespace motion_planning_rviz_plugin 00068 { 00069 00074 class PlanningDisplay : public rviz::Display 00075 { 00076 public: 00077 PlanningDisplay(); 00078 virtual ~PlanningDisplay(); 00079 00080 virtual void onInitialize(); 00081 00086 void changedRobotDescription( ); 00087 00092 void changedTopic( ); 00093 00098 void changedStateDisplayTime( ); 00099 00104 void changedVisualVisible( ); 00105 00110 void changedCollisionVisible( ); 00111 00112 void changedAlpha(); 00113 void changedLoopDisplay(); 00114 00115 virtual void update(float wall_dt, float ros_dt); 00116 00117 // Overrides from Display 00118 virtual void fixedFrameChanged(); 00119 00120 protected: 00124 void subscribe(); 00128 void unsubscribe(); 00129 00133 void advertise(); 00134 00138 void unadvertise(); 00139 00143 void load(); 00144 00148 void incomingJointPath(const arm_navigation_msgs::DisplayTrajectory::ConstPtr& msg); 00149 00153 void calculateRobotPosition(); 00154 00155 // overrides from Display 00156 virtual void onEnable(); 00157 virtual void onDisable(); 00158 00159 std::string description_param_; 00160 00161 rviz::Robot* robot_; 00162 00163 ros::Subscriber sub_; 00164 std::string kinematic_path_topic_; 00165 planning_environment::RobotModels* env_models_; 00166 const planning_models::KinematicModel* kinematic_model_; 00167 arm_navigation_msgs::DisplayTrajectory::ConstPtr incoming_kinematic_path_message_; 00168 arm_navigation_msgs::DisplayTrajectory::ConstPtr displaying_kinematic_path_message_; 00169 bool new_kinematic_path_; 00170 bool animating_path_; 00171 int current_state_; 00172 bool loop_display_; 00173 float state_display_time_; 00174 float current_state_time_; 00175 float alpha_; 00176 00177 rviz::BoolProperty* visual_enabled_property_; 00178 rviz::BoolProperty* collision_enabled_property_; 00179 rviz::FloatProperty* state_display_time_property_; 00180 rviz::StringProperty* robot_description_property_; 00181 rviz::RosTopicProperty* topic_property_; 00182 rviz::FloatProperty* alpha_property_; 00183 rviz::BoolProperty* loop_display_property_; 00184 00185 ros::Publisher state_publisher_; 00186 00187 }; 00188 00189 } // namespace motion_planning_rviz_plugin 00190 00191 #endif 00192 00193