00001 00008 #ifndef tibi_dabo_sequence_editor_MAIN_WINDOW_H 00009 #define tibi_dabo_sequence_editor_MAIN_WINDOW_H 00010 00011 /***************************************************************************** 00012 ** Includes 00013 *****************************************************************************/ 00014 00015 #include <QtGui/QMainWindow> 00016 #include "ui_main_window.h" 00017 #include "qnode.hpp" 00018 00019 #ifdef _HAVE_XSD 00020 #include "xml/motor_cfg_file.hxx" 00021 #include "xml/motion_sequence_file.hxx" 00022 #endif 00023 00024 #include "eventserver.h" 00025 #include "motion_sequence.h" 00026 00027 /***************************************************************************** 00028 ** Namespace 00029 *****************************************************************************/ 00030 00031 #define NUM_JOINTS 6 00032 namespace tibi_dabo_sequence_editor { 00033 00034 /***************************************************************************** 00035 ** Interface [MainWindow] 00036 *****************************************************************************/ 00040 class MainWindow : public QMainWindow 00041 { 00042 Q_OBJECT 00043 00044 public: 00045 MainWindow(int argc, char** argv, QWidget *parent = 0); 00046 ~MainWindow(); 00047 00048 void closeEvent(QCloseEvent *event); // Overloaded function 00049 void showNoMasterMessage(); 00050 00051 public slots: 00052 /****************************************** 00053 ** Auto-connections (connectSlotsByName()) 00054 *******************************************/ 00055 void on_actionAbout_triggered(); 00056 void on_load_sequence_clicked(); 00057 void on_save_sequence_clicked(); 00058 void on_create_sequence_clicked(); 00059 void on_execute_sequence_clicked(); 00060 void on_get_current_clicked(); 00061 void on_add_step_clicked(); 00062 void on_delete_step_clicked(); 00063 void on_insert_step_clicked(); 00064 void on_motion_step_changed(); 00065 00066 protected: 00067 void timerEvent(QTimerEvent * event); 00068 void load_joints_config(void); 00069 void config_joint(int index,bool enable,float min_pos,float max_pos,float min_vel, float max_vel); 00070 void fill_motion_table(void); 00071 void add_motion_step(std::vector<float> position, std::vector<float> velocity, float delay); 00072 00073 private: 00074 Ui::MainWindowDesign ui; 00075 QNode qnode; 00076 // widget arrays 00077 QLabel *min_pos_text[NUM_JOINTS]; 00078 QLabel *max_pos_text[NUM_JOINTS]; 00079 QLabel *min_vel_text[NUM_JOINTS]; 00080 QLabel *max_vel_text[NUM_JOINTS]; 00081 QLabel *position_text[NUM_JOINTS]; 00082 QLabel *velocity_text[NUM_JOINTS]; 00083 QSlider *desired_pos[NUM_JOINTS]; 00084 QSlider *desired_vel[NUM_JOINTS]; 00085 QLineEdit *desired_pos_value[NUM_JOINTS]; 00086 QLineEdit *desired_vel_value[NUM_JOINTS]; 00087 // internal attributes 00088 std::string motion_file_name; 00089 std::vector<TMotionStep> seq; 00090 unsigned int current_step; 00091 CEventServer *event_server; 00092 std::vector<float> min_pos; 00093 std::vector<float> max_pos; 00094 std::vector<float> min_vel; 00095 std::vector<float> max_vel; 00096 unsigned int dof; 00097 }; 00098 00099 } // namespace tibi_dabo_sequence_editor 00100 00101 #endif // tibi_dabo_sequence_editor_MAIN_WINDOW_H