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 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 "author_information_widget.h" 00062 #include "configuration_files_widget.h" 00063 00064 #ifndef Q_MOC_RUN 00065 #include <moveit/setup_assistant/tools/moveit_config_data.h> 00066 00067 // Other 00068 #include <ros/ros.h> 00069 #include <boost/program_options.hpp> // for parsing input arguments 00070 #include <boost/thread/mutex.hpp> 00071 #endif 00072 00073 // Forward declarations 00074 namespace rviz 00075 { 00076 class GridDisplay; 00077 class RenderPanel; 00078 class VisualizationManager; 00079 } 00080 00081 namespace moveit_rviz_plugin 00082 { 00083 class RobotStateDisplay; 00084 } 00085 00086 namespace moveit_setup_assistant 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 private Q_SLOTS: 00143 // ****************************************************************************************** 00144 // Slot Event Functions 00145 // ****************************************************************************************** 00146 00151 void navigationClicked(const QModelIndex& index); 00152 00156 void updateTimer(); 00157 00161 void progressPastStartScreen(); 00162 00167 void loadRviz(); 00168 00174 void setModalMode(bool isModal); 00175 00181 void highlightLink(const std::string& link_name, const QColor& color); 00182 00186 void highlightGroup(const std::string& group_name); 00187 00191 void unhighlightAll(); 00192 00193 // received when virtual joints that change the reference frame are added 00194 void virtualJointReferenceFrameChanged(); 00195 00196 private: 00197 // ****************************************************************************************** 00198 // Variables 00199 // ****************************************************************************************** 00200 QList<QString> nav_name_list_; 00201 NavigationWidget* navs_view_; 00202 00203 QWidget* middle_frame_; 00204 QWidget* rviz_container_; 00205 QSplitter* splitter_; 00206 QStackedLayout* main_content_; 00207 int current_index_; 00208 boost::mutex change_screen_lock_; 00209 00210 // Rviz Panel 00211 rviz::RenderPanel* rviz_render_panel_; 00212 rviz::VisualizationManager* rviz_manager_; 00213 moveit_rviz_plugin::RobotStateDisplay* robot_state_display_; 00214 00215 // Screen Widgets 00216 StartScreenWidget* ssw_; 00217 DefaultCollisionsWidget* dcw_; 00218 PlanningGroupsWidget* pgw_; 00219 RobotPosesWidget* rpw_; 00220 EndEffectorsWidget* efw_; 00221 VirtualJointsWidget* vjw_; 00222 PassiveJointsWidget* pjw_; 00223 AuthorInformationWidget* aiw_; 00224 ConfigurationFilesWidget* cfw_; 00225 00227 moveit_setup_assistant::MoveItConfigDataPtr config_data_; 00228 00229 // ****************************************************************************************** 00230 // Private Functions 00231 // ****************************************************************************************** 00232 }; 00233 } 00234 00235 #endif