00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2010 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: care-o-bot 00011 * ROS stack name: cob_3d_environment_perception_intern 00012 * ROS package name: cob_3d_mapping_demonstrator 00013 * Description: Feature Map for storing and handling geometric features 00014 * 00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00016 * 00017 * Author: Georg Arbeiter, email:georg.arbeiter@ipa.fhg.de 00018 * Supervised by: Georg Arbeiter, email:georg.arbeiter@ipa.fhg.de 00019 * 00020 * Date of creation: 03/2012 00021 * ToDo: 00022 * 00023 * 00024 * 00025 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00026 * 00027 * Redistribution and use in source and binary forms, with or without 00028 * modification, are permitted provided that the following conditions are met: 00029 * 00030 * * Redistributions of source code must retain the above copyright 00031 * notice, this list of conditions and the following disclaimer. 00032 * * Redistributions in binary form must reproduce the above copyright 00033 * notice, this list of conditions and the following disclaimer in the 00034 * documentation and/or other materials provided with the distribution. 00035 * * Neither the name of the Fraunhofer Institute for Manufacturing 00036 * Engineering and Automation (IPA) nor the names of its 00037 * contributors may be used to endorse or promote products derived from 00038 * this software without specific prior written permission. 00039 * 00040 * This program is free software: you can redistribute it and/or modify 00041 * it under the terms of the GNU Lesser General Public License LGPL as 00042 * published by the Free Software Foundation, either version 3 of the 00043 * License, or (at your option) any later version. 00044 * 00045 * This program is distributed in the hope that it will be useful, 00046 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00047 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00048 * GNU Lesser General Public License LGPL for more details. 00049 * 00050 * You should have received a copy of the GNU Lesser General Public 00051 * License LGPL along with this program. 00052 * If not, see <http://www.gnu.org/licenses/>. 00053 * 00054 ****************************************************************/ 00055 00056 #include "cob_3d_mapping_demonstrator/wx_rviz_buttons.h" 00057 #include "rviz/visualization_manager.h" 00058 #include "rviz/window_manager_interface.h" 00059 00060 using namespace std; 00061 00062 00063 namespace rviz 00064 { 00065 00066 const int ID_BUTTON_START(101); 00067 const int ID_BUTTON_STOP(102); 00068 const int ID_BUTTON_RESET(103); 00069 const int ID_BUTTON_CLEAR(104); 00070 const int ID_BUTTON_RECOVER(105); 00071 00072 RvizButtons::~RvizButtons() { 00073 00074 } 00075 00079 RvizButtons::RvizButtons(const std::string& name, VisualizationManager* manager/*wxWindow *parent, const wxString& title, rviz::WindowManagerInterface * wmi */) 00080 : Display( name, manager ), 00081 frame_(0) 00082 //: wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize(280, 180), wxTAB_TRAVERSAL, title) 00083 //, m_wmi( wmi ) 00084 { 00085 // Create controls 00086 //m_button = new wxButton(this, ID_RESET_BUTTON, wxT("Reset map")); 00087 wxWindow* parent = 0; 00088 00089 WindowManagerInterface* wm = vis_manager_->getWindowManager(); 00090 if (wm) 00091 { 00092 parent = wm->getParentWindow(); 00093 } 00094 else 00095 { 00096 frame_ = new wxFrame(0, wxID_ANY, wxString::FromAscii(name.c_str()), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN); 00097 parent = frame_; 00098 } 00099 00100 panel_ = new RvizButtonsPanel(parent, wxString()/*parent, false, this*/); 00101 //render_panel_->SetSize(wxSize(640, 480)); 00102 if (wm) 00103 { 00104 wm->addPane(name, panel_); 00105 } 00106 00107 //parent_ = parent; 00108 00109 /*button_start_ = new wxButton(this, ID_BUTTON_START, wxT("New"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT); 00110 button_stop_ = new wxButton(this, ID_BUTTON_STOP, wxT("Plan"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT); 00111 button_reset_ = new wxButton(this, ID_BUTTON_RESET, wxT("Play"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT); 00112 button_clear_ = new wxButton(this, ID_BUTTON_CLEAR, wxT("Execute"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT); 00113 button_recover_ = new wxButton(this, ID_BUTTON_RECOVER, wxT("Reset"),wxDefaultPosition,wxDefaultSize,wxBU_EXACTFIT);*/ 00114 00115 /*m_text_status = new wxStaticText(this, -1, wxT("status: waiting")); 00116 m_text_object = new wxStaticText(this, -1, wxT("object: none")); 00117 m_text_timeout = new wxStaticText(this, -1, wxT("timeout: none")); 00118 m_text_dist = new wxStaticText(this, -1, wxT("closest pos.: none"));*/ 00119 00120 /*button_start_->Enable(false); 00121 button_stop_->Enable(false); 00122 button_reset_->Enable(false); 00123 button_clear_->Enable(false); 00124 button_recover_->Enable(false);*/ 00125 00126 //wxSizer *vsizer = new wxBoxSizer(wxVERTICAL); // top sizer 00127 00128 00129 /*wxSizer *vsizer_top = new wxStaticBoxSizer(wxVERTICAL,this,wxT("Trajectory planning")); 00130 wxSizer *hsizer_traj_top = new wxBoxSizer(wxHORIZONTAL); 00131 wxSizer *hsizer_traj_mid = new wxBoxSizer(wxHORIZONTAL); 00132 wxSizer *hsizer_traj_bot = new wxBoxSizer(wxHORIZONTAL);*/ 00133 00134 00135 //wxSizer *vsizer_mes = new wxStaticBoxSizer(wxVERTICAL,this,wxT("Messages")); 00136 00137 //wxSizer *hsizer_add = new wxStaticBoxSizer(wxHORIZONTAL,this,wxT("Additional controls")); 00138 00139 00140 /* Trajectory planning related buttons, on top*/ 00141 /*vsizer->Add(button_start_, ID_BUTTON_START); 00142 vsizer->Add(button_stop_, ID_BUTTON_STOP); 00143 vsizer->Add(button_reset_, ID_BUTTON_RESET); 00144 vsizer->Add(button_clear_, ID_BUTTON_CLEAR); 00145 vsizer->Add(button_recover_, ID_BUTTON_RECOVER);*/ 00146 00147 00148 /* Status messages*/ 00149 /*vsizer_mes->Add(m_text_status); 00150 vsizer_mes->Add(m_text_object); 00151 vsizer_mes->Add(m_text_timeout); 00152 vsizer_mes->Add(m_text_dist);*/ 00153 00154 00155 //vsizer->SetSizeHints(this); 00157 00158 //ros::NodeHandle nh; 00159 //service_start_ = nh.advertiseService("arm_nav_start",&RvizButtons::nav_start,this); 00160 00161 } 00162 00163 void RvizButtons::onEnable() 00164 { 00165 if (frame_) 00166 { 00167 frame_->Show(true); 00168 } 00169 else 00170 { 00171 WindowManagerInterface* wm = vis_manager_->getWindowManager(); 00172 wm->showPane(panel_); 00173 } 00174 } 00175 00176 void RvizButtons::onDisable() 00177 { 00178 if (frame_) 00179 { 00180 frame_->Show(false); 00181 } 00182 else 00183 { 00184 WindowManagerInterface* wm = vis_manager_->getWindowManager(); 00185 wm->closePane(panel_); 00186 } 00187 } 00188 00189 } 00191