Fawkes API  Fawkes Development Version
naostiffness_config_plugin.h
1 
2 /***************************************************************************
3  * naostiffness_config_plugin.h - Config plugin for the nao joint stiffnesses
4  *
5  * Created: Tue Apr 7 15:15:15 2009
6  * Copyright 2009 Tobias Kellner
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_
24 #define __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_
25 
26 #include "config_editor_plugin.h"
27 
28 #include <gtkmm.h>
29 
30 #include <string>
31 #include <vector>
32 
33 class NaoStiffnessConfigDialog : public Gtk::Dialog
34 {
35 public:
36  struct nao_stiffnesses /**< joint stiffness values */
37  {
38  float hy; /**< head yaw */
39  float hp; /**< head pitch */
40 
41  float lsp; /**< left shoulder pitch */
42  float rsp; /**< right shoulder pitch */
43  float lsr; /**< left shoulder roll */
44  float rsr; /**< right shoulder roll */
45  float ley; /**< left elbow yaw */
46  float rey; /**< right elbow yaw */
47  float ler; /**< left elbow roll */
48  float rer; /**< right elbow roll */
49 
50  float lhyp; /**< left hip yaw/pitch */
51  float rhyp; /**< right hip yaw/pitch */
52  float lhr; /**< left hip roll */
53  float rhr; /**< right hip roll */
54  float lhp; /**< left hip pitch */
55  float rhp; /**< right hip pitch */
56  float lkp; /**< left knee pitch */
57  float rkp; /**< right knee pitch */
58  float lar; /**< left ankle roll */
59  float rar; /**< right ankle roll */
60  float lap; /**< left ankle pitch */
61  float rap; /**< right ankle pitch */
62  };
63 
64  public:
65  NaoStiffnessConfigDialog(BaseObjectType *cobject,
66  const Glib::RefPtr<Gtk::Builder> &builder);
67  virtual ~NaoStiffnessConfigDialog();
68 
69  virtual void set_stiffnesses(const nao_stiffnesses &vals);
70  virtual void get_stiffnesses(nao_stiffnesses &vals);
71 
72  virtual void on_checkbutton_lock_toggled();
73  virtual void on_combobox_behaviour_changed();
74 
75  virtual std::string get_cur_behaviour();
76  virtual bool get_save_default();
77  virtual void set_load_vals(sigc::slot<void> cb);
78 
79  private:
80  Gtk::SpinButton *__hy;
81  Gtk::SpinButton *__hp;
82 
83  Gtk::SpinButton *__lsp;
84  Gtk::SpinButton *__rsp;
85  Gtk::SpinButton *__lsr;
86  Gtk::SpinButton *__rsr;
87  Gtk::SpinButton *__ley;
88  Gtk::SpinButton *__rey;
89  Gtk::SpinButton *__ler;
90  Gtk::SpinButton *__rer;
91 
92  Gtk::SpinButton *__lhyp;
93  Gtk::SpinButton *__rhyp;
94  Gtk::SpinButton *__lhr;
95  Gtk::SpinButton *__rhr;
96  Gtk::SpinButton *__lhp;
97  Gtk::SpinButton *__rhp;
98  Gtk::SpinButton *__lkp;
99  Gtk::SpinButton *__rkp;
100  Gtk::SpinButton *__lar;
101  Gtk::SpinButton *__rar;
102  Gtk::SpinButton *__lap;
103  Gtk::SpinButton *__rap;
104 
105  Gtk::CheckButton *__def;
106  Gtk::CheckButton *__lck;
107  std::vector<sigc::connection> __connections;
108 
109  Gtk::ComboBox *__bhv;
110  std::string __cur_bhv;
111 
112  sigc::slot<void> __load_vals;
113 };
114 
116 {
117  public:
118  NaoStiffnessConfigPlugin(std::string ui_path);
119  virtual ~NaoStiffnessConfigPlugin();
120 
121  protected:
122  virtual void pre_run();
123  virtual void post_run(int response);
124 
125  virtual Gtk::Dialog* load_dialog();
126 
127  private:
128  virtual void load_vals();
129  virtual void save_vals();
130 
131  private:
133 };
134 
135 #endif /* __TOOLS_CONFIG_EDITOR_NAOSTIFFNESS_CONFIG_PLUGIN_H_ */
NaoStiffnessConfigPlugin(std::string ui_path)
Constructor.
virtual ~NaoStiffnessConfigPlugin()
Destructor.
virtual std::string get_cur_behaviour()
Return currently selected behaviour.
Config dialog of the config editor plugin for the nao joint stiffnesses.
virtual ~NaoStiffnessConfigDialog()
Destructor.
NaoStiffnessConfigDialog(BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &builder)
Constructor.
virtual void on_checkbutton_lock_toggled()
Lock checkbox toggled handler.
virtual void post_run(int response)
This method is called after the dialog is closed.
virtual void on_combobox_behaviour_changed()
Behaviour combobox changed handler.
virtual void set_load_vals(sigc::slot< void > cb)
Set the callback function for loading values in the plugin.
virtual Gtk::Dialog * load_dialog()
In this function the (custom) dialog of the plugin needs to be initialized.
Config editor plugin for the Nao joint stiffness values.
virtual void get_stiffnesses(nao_stiffnesses &vals)
Get joint stiffness values from the dialog.
Base class for plugins for the Fawkes config editor.
virtual bool get_save_default()
Return whether default checkbox is checked.
virtual void pre_run()
Config editor plugins need to implement this function.
virtual void set_stiffnesses(const nao_stiffnesses &vals)
Set joint stiffness values in the dialog.