00001 #ifndef COMMAND_GUI_RVIZ_PANEL_H 00002 #define COMMAND_GUI_RVIZ_PANEL_H 00003 00004 #include <wx/panel.h> 00005 #include <wx/button.h> 00006 #include <wx/stattext.h> 00007 #include <wx/checkbox.h> 00008 #include <wx/sizer.h> 00009 00010 #include <ros/ros.h> 00011 #include <cob_script_server/ScriptAction.h> 00012 #include <actionlib/client/simple_action_client.h> 00013 00014 namespace rviz 00015 { 00016 struct Button_Description 00017 { 00018 int id; 00019 std::string button_name; 00020 std::string function_name; 00021 std::pair<std::string, std::string> args; 00022 }; 00023 00024 typedef std::list<Button_Description> Buttonlist; 00025 typedef std::list< std::pair<std::string, Buttonlist> > Grouplist; 00026 typedef std::vector<wxSizer*> Sizerlist; 00027 typedef std::list<std::string> Stringlist; 00028 00029 class CommandGuiRvizPanel : public wxPanel 00030 { 00031 public: 00032 00033 CommandGuiRvizPanel(wxWindow *parent, const wxString&title); 00034 ~CommandGuiRvizPanel(); 00035 00036 protected: 00037 00038 //widgets for 'general' box 00039 wxStaticText *statuslabel_; 00040 wxCheckBox *cbPlanning_; 00041 wxCheckBox *cbBaseDiff_; 00042 00043 //containers 00044 Sizerlist sizers_; 00045 Grouplist groups_; 00046 00047 Stringlist stop_buttons_; 00048 Stringlist init_buttons_; 00049 Stringlist recover_buttons_; 00050 00051 //checkbox status 00052 bool planning_enabled; 00053 bool base_diff_enabled; 00054 00055 //actionclient 00056 actionlib::SimpleActionClient<cob_script_server::ScriptAction>* action_client_; 00057 00058 bool Getparams(); 00059 void Creategui(); 00060 wxSizer* CreatesbGeneral(); 00061 00062 Button_Description Descripe_button(const int &ID, XmlRpc::XmlRpcValue data, const std::string &component_name) const; 00063 wxButton* AddButton(const int &ID, const wxString &title); 00064 00065 //event-functions 00066 void OnClick(wxCommandEvent &event); 00067 void OnStopAll(wxCommandEvent &event); 00068 void OnInitAll(wxCommandEvent &event); 00069 void OnRecoverAll(wxCommandEvent &event); 00070 inline void planned_toggle(wxCommandEvent &event); 00071 inline void base_mode_toggle(wxCommandEvent &event); 00072 00073 private: 00074 //some typecast-functions 00075 inline wxString TowxString(const std::string &temp) const; 00076 inline std::string TostlString(XmlRpc::XmlRpcValue temp) const; 00077 inline std::string TostlString(wxString temp) const; 00078 }; 00079 } 00080 00081 #endif