00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2012, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of the Willow Garage nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00035 /* Author: Dave Coleman */ 00036 00037 #ifndef MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_SETUP_ASSISTANT_WIDGET_ 00038 #define MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_SETUP_ASSISTANT_WIDGET_ 00039 00040 // Qt 00041 #include <QWidget> 00042 #include <QVBoxLayout> 00043 #include <QHBoxLayout> 00044 #include <QString> 00045 #include <QApplication> 00046 #include <QObject> 00047 #include <QEvent> 00048 #include <QListWidget> 00049 #include <QTimer> 00050 #include <QSplitter> 00051 #include <QStringList> 00052 // Setup Asst 00053 #include "navigation_widget.h" 00054 #include "start_screen_widget.h" 00055 #include "default_collisions_widget.h" 00056 #include "planning_groups_widget.h" 00057 #include "robot_poses_widget.h" 00058 #include "end_effectors_widget.h" 00059 #include "virtual_joints_widget.h" 00060 #include "passive_joints_widget.h" 00061 #include "configuration_files_widget.h" 00062 00063 #ifndef Q_MOC_RUN 00064 #include <moveit/setup_assistant/tools/moveit_config_data.h> 00065 00066 // Other 00067 #include <ros/ros.h> 00068 #include <boost/program_options.hpp> // for parsing input arguments 00069 #include <boost/thread/mutex.hpp> 00070 #endif 00071 00072 // Forward declarations 00073 namespace rviz 00074 { 00075 class GridDisplay; 00076 class RenderPanel; 00077 class VisualizationManager; 00078 } 00079 00080 namespace moveit_rviz_plugin 00081 { 00082 class RobotStateDisplay; 00083 } 00084 00085 namespace moveit_setup_assistant 00086 { 00087 00088 class SetupAssistantWidget : public QWidget 00089 { 00090 Q_OBJECT 00091 00092 public: 00093 // ****************************************************************************************** 00094 // Public Functions 00095 // ****************************************************************************************** 00096 00102 SetupAssistantWidget( QWidget *parent, boost::program_options::variables_map args ); 00103 00108 ~SetupAssistantWidget(); 00109 00115 void moveToScreen( const int index ); 00116 00121 void closeEvent( QCloseEvent * event ); 00122 00130 virtual bool notify( QObject * rec, QEvent * ev ); 00131 00136 //void showRviz( bool show ); 00137 00138 // ****************************************************************************************** 00139 // Qt Components 00140 // ****************************************************************************************** 00141 00142 00143 private Q_SLOTS: 00144 // ****************************************************************************************** 00145 // Slot Event Functions 00146 // ****************************************************************************************** 00147 00152 void navigationClicked( const QModelIndex& index ); 00153 00157 void updateTimer(); 00158 00162 void progressPastStartScreen(); 00163 00168 void loadRviz(); 00169 00175 void setModalMode( bool isModal ); 00176 00182 void highlightLink( const std::string& link_name ); 00183 00187 void highlightGroup( const std::string& group_name ); 00188 00192 void unhighlightAll(); 00193 00194 // received when virtual joints that change the reference frame are added 00195 void virtualJointReferenceFrameChanged(); 00196 00197 private: 00198 00199 00200 // ****************************************************************************************** 00201 // Variables 00202 // ****************************************************************************************** 00203 QList<QString> nav_name_list_; 00204 NavigationWidget *navs_view_; 00205 00206 QWidget *middle_frame_; 00207 QWidget *rviz_container_; 00208 QSplitter *splitter_; 00209 QStackedLayout *main_content_; 00210 int current_index_; 00211 boost::mutex change_screen_lock_; 00212 00213 // Rviz Panel 00214 rviz::RenderPanel* rviz_render_panel_; 00215 rviz::VisualizationManager* rviz_manager_; 00216 moveit_rviz_plugin::RobotStateDisplay* robot_state_display_; 00217 00218 // Screen Widgets 00219 StartScreenWidget *ssw_; 00220 DefaultCollisionsWidget *dcw_; 00221 PlanningGroupsWidget *pgw_; 00222 RobotPosesWidget *rpw_; 00223 EndEffectorsWidget *efw_; 00224 VirtualJointsWidget *vjw_; 00225 PassiveJointsWidget *pjw_; 00226 ConfigurationFilesWidget *cfw_; 00227 00229 moveit_setup_assistant::MoveItConfigDataPtr config_data_; 00230 00231 // ****************************************************************************************** 00232 // Private Functions 00233 // ****************************************************************************************** 00234 00235 00236 }; 00237 00238 00239 } 00240 00241 #endif