00001 /* 00002 * Copyright (c) 2009, 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 INTERACTIVE_MANIPULATION_FRONTEND 00031 #define INTERACTIVE_MANIPULATION_FRONTEND 00032 00033 #include <QWidget> 00034 00035 #include <ros/ros.h> 00036 00037 #include <actionlib/client/simple_action_client.h> 00038 00039 #include <std_msgs/String.h> 00040 00041 #include "pr2_interactive_manipulation/advanced_options_dialog.h" 00042 #include "pr2_object_manipulation_msgs/IMGUIOptions.h" 00043 #include "pr2_object_manipulation_msgs/IMGUIAdvancedOptions.h" 00044 #include "pr2_object_manipulation_msgs/IMGUIAction.h" 00045 #include "pr2_object_manipulation_msgs/ActionInfo.h" 00046 00047 namespace Ui 00048 { 00049 class InteractiveManipulation; 00050 } 00051 00052 namespace rviz { 00053 class VisualizationManager; 00054 class FrameManager; 00055 } 00056 00057 namespace pr2_interactive_manipulation { 00058 00059 class InteractiveManipulationFrontend : public QWidget 00060 { 00061 Q_OBJECT 00062 public: 00063 InteractiveManipulationFrontend(rviz::VisualizationManager* manager, QWidget* parent = 0); 00064 00065 ~InteractiveManipulationFrontend(); 00066 00067 void update(); 00068 00069 void setAdvancedOptions(pr2_object_manipulation_msgs::IMGUIAdvancedOptions ago){adv_options_ = ago;} 00070 00071 int interface_number_; 00072 00073 int task_number_; 00074 00075 protected Q_SLOTS: 00076 void graspButtonClicked(); 00077 00078 void placeButtonClicked(); 00079 00080 void plannedMoveButtonClicked(); 00081 00082 void cancelButtonClicked(); 00083 00084 void stopNavButtonClicked(); 00085 00086 void centerHeadButtonClicked(); 00087 00088 void drawReachableZonesButtonClicked(); 00089 00090 void resetButtonClicked(); 00091 00092 void armGoButtonClicked(); 00093 00094 void cameraLeftButtonClicked(); 00095 00096 void cameraRightButtonClicked(); 00097 00098 void cameraFrontButtonClicked(); 00099 00100 void cameraTopButtonClicked(); 00101 00102 void advancedOptionsClicked(); 00103 00104 void modelObjectClicked(); 00105 00106 //void openDrawerButtonClicked(); 00107 00108 void rcommandRunButtonClicked(); 00109 00110 void rcommandRefreshButtonClicked(); 00111 00112 void gripperSliderScrollChanged(); 00113 00114 protected: 00115 00116 void feedbackCallback(const pr2_object_manipulation_msgs::IMGUIFeedbackConstPtr &feedback); 00117 00118 void statusCallback( const std_msgs::StringConstPtr &status); 00119 00120 pr2_object_manipulation_msgs::IMGUIOptions getDialogOptions(); 00121 00122 void setCamera(std::vector<double> params); 00123 00124 rviz::VisualizationManager* vis_manager_; 00125 00126 ros::NodeHandle root_nh_; 00127 ros::NodeHandle priv_nh_; 00128 00129 ros::ServiceClient rcommander_action_info_client_; 00130 actionlib::SimpleActionClient<pr2_object_manipulation_msgs::IMGUIAction> *action_client_; 00131 //actionlib::SimpleActionClient<RunScriptAction> *scripted_action_client_; 00132 //std::string scripted_action_name_; 00133 ros::Subscriber status_sub_; 00134 ros::Publisher draw_reachable_zones_pub_; 00135 00136 std::string rcommander_action_info_name_; 00137 std::string rcommander_group_name_; 00138 std::string action_name_; 00139 std::string status_name_; 00140 00141 std::string status_label_text_; 00142 00143 boost::mutex status_label_mutex_; 00144 00145 pr2_object_manipulation_msgs::IMGUIAdvancedOptions adv_options_; 00146 00147 private: 00148 Ui::InteractiveManipulation* ui_; 00149 }; 00150 00151 } 00152 00153 #endif