Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * naostiffness_config_plugin.h - Config plugin for the nao joint stiffnesses 00004 * 00005 * Created: Tue Apr 7 15:15:15 2009 00006 * Copyright 2009 Tobias Kellner 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_ 00024 #define __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_ 00025 00026 #include "config_editor_plugin.h" 00027 00028 #include <gtkmm.h> 00029 00030 #include <string> 00031 #include <vector> 00032 00033 class NaoStiffnessConfigDialog : public Gtk::Dialog 00034 { 00035 public: 00036 struct nao_stiffnesses /**< joint stiffness values */ 00037 { 00038 float hy; /**< head yaw */ 00039 float hp; /**< head pitch */ 00040 00041 float lsp; /**< left shoulder pitch */ 00042 float rsp; /**< right shoulder pitch */ 00043 float lsr; /**< left shoulder roll */ 00044 float rsr; /**< right shoulder roll */ 00045 float ley; /**< left elbow yaw */ 00046 float rey; /**< right elbow yaw */ 00047 float ler; /**< left elbow roll */ 00048 float rer; /**< right elbow roll */ 00049 00050 float lhyp; /**< left hip yaw/pitch */ 00051 float rhyp; /**< right hip yaw/pitch */ 00052 float lhr; /**< left hip roll */ 00053 float rhr; /**< right hip roll */ 00054 float lhp; /**< left hip pitch */ 00055 float rhp; /**< right hip pitch */ 00056 float lkp; /**< left knee pitch */ 00057 float rkp; /**< right knee pitch */ 00058 float lar; /**< left ankle roll */ 00059 float rar; /**< right ankle roll */ 00060 float lap; /**< left ankle pitch */ 00061 float rap; /**< right ankle pitch */ 00062 }; 00063 00064 public: 00065 NaoStiffnessConfigDialog(BaseObjectType *cobject, 00066 const Glib::RefPtr<Gtk::Builder> &builder); 00067 virtual ~NaoStiffnessConfigDialog(); 00068 00069 virtual void set_stiffnesses(const nao_stiffnesses &vals); 00070 virtual void get_stiffnesses(nao_stiffnesses &vals); 00071 00072 virtual void on_checkbutton_lock_toggled(); 00073 virtual void on_combobox_behaviour_changed(); 00074 00075 virtual std::string get_cur_behaviour(); 00076 virtual bool get_save_default(); 00077 virtual void set_load_vals(sigc::slot<void> cb); 00078 00079 private: 00080 Gtk::SpinButton *__hy; 00081 Gtk::SpinButton *__hp; 00082 00083 Gtk::SpinButton *__lsp; 00084 Gtk::SpinButton *__rsp; 00085 Gtk::SpinButton *__lsr; 00086 Gtk::SpinButton *__rsr; 00087 Gtk::SpinButton *__ley; 00088 Gtk::SpinButton *__rey; 00089 Gtk::SpinButton *__ler; 00090 Gtk::SpinButton *__rer; 00091 00092 Gtk::SpinButton *__lhyp; 00093 Gtk::SpinButton *__rhyp; 00094 Gtk::SpinButton *__lhr; 00095 Gtk::SpinButton *__rhr; 00096 Gtk::SpinButton *__lhp; 00097 Gtk::SpinButton *__rhp; 00098 Gtk::SpinButton *__lkp; 00099 Gtk::SpinButton *__rkp; 00100 Gtk::SpinButton *__lar; 00101 Gtk::SpinButton *__rar; 00102 Gtk::SpinButton *__lap; 00103 Gtk::SpinButton *__rap; 00104 00105 Gtk::CheckButton *__def; 00106 Gtk::CheckButton *__lck; 00107 std::vector<sigc::connection> __connections; 00108 00109 Gtk::ComboBox *__bhv; 00110 std::string __cur_bhv; 00111 00112 sigc::slot<void> __load_vals; 00113 }; 00114 00115 class NaoStiffnessConfigPlugin : public ConfigEditorPlugin 00116 { 00117 public: 00118 NaoStiffnessConfigPlugin(std::string ui_path); 00119 virtual ~NaoStiffnessConfigPlugin(); 00120 00121 protected: 00122 virtual void pre_run(); 00123 virtual void post_run(int response); 00124 00125 virtual Gtk::Dialog* load_dialog(); 00126 00127 private: 00128 virtual void load_vals(); 00129 virtual void save_vals(); 00130 00131 private: 00132 NaoStiffnessConfigDialog::nao_stiffnesses __initial_vals; 00133 }; 00134 00135 #endif /* __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_ */