00001
00006 #include <gtk_interface.h>
00007
00008 using namespace std;
00009
00010
00011
00012
00013 void on_application_exit (GtkObject *object, gpointer user_data)
00014 {
00015 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00016 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00017 RobotVars->parameters.exit_status=TRUE;
00018 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00019 GtkWidget *toplevel = gtk_widget_get_toplevel((GtkWidget *)object);
00020 gtk_widget_hide_all(toplevel);
00021 gtk_main_quit();
00022 }
00023
00024 void on_button_set_robot_home_pos_clicked(GtkWidget * widget, gpointer user_data)
00025 {
00026 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00027 cout<<"-> Setting robot at home position";fflush(stdout);
00028 SetRobotHomePosition(RobotVars);sleep(0.25);
00029 cout<<"...";fflush(stdout);sleep(0.25);
00030 UpdateJointDataByID(1000, 0., RobotVars);
00031 cout<<"...";fflush(stdout);
00032 UpdateKinematicModelDirKin(RobotVars);
00033 cout<<"...";fflush(stdout);
00034 RobotVars->update_labels=TRUE;
00035 cout<<"...";fflush(stdout);
00036 cout<<"Done!"<<endl;fflush(stdout);
00037 }
00038
00039 void on_button_start_loop_clicked(GtkWidget * widget, gpointer user_data)
00040 {
00041 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00042
00043 const gchar start_text[STR_LEN]="\nSTART HAPTICS/CONTROL LOOP\n";
00044 const gchar stop_text[STR_LEN]="\nSTOP HAPTICS/CONTROL LOOP\n";
00045
00046 if(!strcmp(gtk_button_get_label((GtkButton *)widget),start_text))
00047 {
00048 if(RobotVars->parameters.kinematic_model!=0)
00049 {
00050
00051 gtk_button_set_label((GtkButton *)widget,stop_text);
00052 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00053
00054 UpdateJointDataByID(1000, 0., RobotVars);
00055 UpdateKinematicModelDirKin(RobotVars);
00056 RobotVars->haptic_loop_start=TRUE;
00057 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00058 }
00059 }
00060 else
00061 {
00062
00063 gtk_button_set_label((GtkButton *)widget,start_text);
00064 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00065 RobotVars->haptic_loop_start=FALSE;
00066 RobotVars->haptics_data.demo_user_path_point_storing = FALSE;
00067 RobotVars->haptics_data.demo_user_path_run_start = FALSE;
00068 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00069 }
00070 }
00071
00072 void on_page1_left_top_frame_combobox_changed_event(GtkWidget *widget, gpointer user_data)
00073 {
00074 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00075 gint selection=gtk_combo_box_get_active((GtkComboBox *)widget);
00076 GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
00077 g_object_set_data((GObject *)toplevel,"kinematic_selection",&selection);
00078 RobotVars->parameters.kinematic_model=selection;
00079
00080
00081 if(selection<=3 && selection>0)
00082 {
00083 gtk_label_set_markup ((GtkLabel *)(RobotVars->updt_labels.joints_left_side),
00084 g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Left Arm end coordinates / Roll/Pitch/Yaw angles:"));
00085 gtk_label_set_markup ((GtkLabel *)(RobotVars->updt_labels.joints_right_side),
00086 g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Right Arm end coordinates / Roll/Pitch/Yaw angles:"));
00087 }
00088 else if(selection>=4 && selection<=5)
00089 {
00090 gtk_label_set_markup ((GtkLabel *)(RobotVars->updt_labels.joints_left_side),
00091 g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Left Detached Leg end coordinates / Roll/Pitch/Yaw angles:"));
00092 gtk_label_set_markup ((GtkLabel *)(RobotVars->updt_labels.joints_right_side),
00093 g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Right Detached Leg end coordinates / Roll/Pitch/Yaw angles:"));
00094 }
00095
00096 }
00097
00098 void on_ajustament_hscale_value_changed_event(GtkAdjustment *adjustment, gpointer user_data)
00099 {
00100 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00101 static gdouble manual_speed_value;
00102 manual_speed_value=gtk_adjustment_get_value((GtkAdjustment *)adjustment);
00103 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00104 RobotVars->parameters.manual_speed=manual_speed_value;
00105 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00106 }
00107
00108 void on_constant_speed_radio_checkbox_toggled(GtkWidget *widget, gpointer other_checkbox)
00109 {
00110 static bool man;
00111 static bool autom;
00112 GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
00113 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00114 if(gtk_toggle_button_get_active((GtkToggleButton *)widget))
00115 {
00116
00117 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,1),TRUE);
00118
00119 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,3),FALSE);
00120 gtk_toggle_button_set_active((GtkToggleButton *)other_checkbox,FALSE);
00121 man=TRUE;
00122 autom=FALSE;
00123 }
00124 else
00125 {
00126
00127 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,1),FALSE);
00128
00129 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,3),TRUE);
00130 gtk_toggle_button_set_active((GtkToggleButton *)other_checkbox,TRUE);
00131 man=FALSE;
00132 autom=TRUE;
00133 }
00134 while (g_main_context_iteration (NULL, FALSE));
00135 g_list_free(child_list);
00136 g_object_set_data((GObject *)toplevel,"manual_speed_control",&man);
00137 g_object_set_data((GObject *)toplevel,"automatic_speed_control",&autom);
00138 }
00139
00140 void on_controled_speed_radio_checkbox_toggled(GtkWidget *widget, gpointer other_checkbox)
00141 {
00142 static bool man;
00143 static bool autom;
00144 GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
00145 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00146 if(gtk_toggle_button_get_active((GtkToggleButton *)widget))
00147 {
00148
00149 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,1),FALSE);
00150
00151 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,3),TRUE);
00152 gtk_toggle_button_set_active((GtkToggleButton *)other_checkbox,FALSE);
00153 man=FALSE;
00154 autom=TRUE;
00155 }
00156 else
00157 {
00158
00159 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,1),TRUE);
00160
00161 gtk_widget_set_visible((GtkWidget *)g_list_nth_data(child_list,3),FALSE);
00162 gtk_toggle_button_set_active((GtkToggleButton *)other_checkbox,TRUE);
00163 man=TRUE;
00164 autom=FALSE;
00165 }
00166 while (g_main_context_iteration (NULL, FALSE));
00167 g_list_free(child_list);
00168 g_object_set_data((GObject *)toplevel,"manual_speed_control",&man);
00169 g_object_set_data((GObject *)toplevel,"automatic_speed_control",&autom);
00170 }
00171
00172 void on_page2_select_id_combobox_for_position_changed_event(GtkWidget *widget, gpointer label_data)
00173 {
00174
00175 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00176 cout<<"On individual joint control:"<<endl<<"Selected option "<<gtk_combo_box_get_active_text((GtkComboBox *)widget)<<"."<<endl;
00177 gint selection=gtk_combo_box_get_active((GtkComboBox *)widget);
00178
00179 switch (selection)
00180 {
00181 case 0:
00182 gtk_label_set_text((GtkLabel *)label_data,"[---]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,0.);break;
00183 case 1:
00184 gtk_label_set_text((GtkLabel *)label_data,"[0...10 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,10.);break;
00185 case 2:
00186 gtk_label_set_text((GtkLabel *)label_data,"[-40...140 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,140.);break;
00187 case 3:
00188 gtk_label_set_text((GtkLabel *)label_data,"[0...180 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,180.);break;
00189 case 4:
00190 gtk_label_set_text((GtkLabel *)label_data,"[0...120 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,120.);break;
00191 case 5:
00192 gtk_label_set_text((GtkLabel *)label_data,"[-40...140 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,140.);break;
00193 case 6:
00194 gtk_label_set_text((GtkLabel *)label_data,"[0...180 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,180.);break;
00195 case 7:
00196 gtk_label_set_text((GtkLabel *)label_data,"[0...120 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,120.);break;
00197 case 8:
00198 gtk_label_set_text((GtkLabel *)label_data,"[-90...90 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-90.,90.);break;
00199 case 9:
00200 gtk_label_set_text((GtkLabel *)label_data,"[-15...90 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-15.,90.);break;
00201 case 10:
00202 gtk_label_set_text((GtkLabel *)label_data,"[-45...45 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-45.,45.);break;
00203 case 11:
00204 gtk_label_set_text((GtkLabel *)label_data,"[-30...45 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-30.,45.);break;
00205 case 12:
00206 gtk_label_set_text((GtkLabel *)label_data,"[-40...20 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,20.);break;
00207 case 13:
00208 gtk_label_set_text((GtkLabel *)label_data,"[0...130 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,130.);break;
00209 case 14:
00210 gtk_label_set_text((GtkLabel *)label_data,"[-40...45 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,45.);break;
00211 case 15:
00212 gtk_label_set_text((GtkLabel *)label_data,"[-30...120 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-30.,120.);break;
00213 case 16:
00214 gtk_label_set_text((GtkLabel *)label_data,"[-30...45 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-30.,45.);break;
00215 case 17:
00216 gtk_label_set_text((GtkLabel *)label_data,"[-40...20 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,20.);break;
00217 case 18:
00218 gtk_label_set_text((GtkLabel *)label_data,"[0...130 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,0.,130.);break;
00219 case 19:
00220 gtk_label_set_text((GtkLabel *)label_data,"[-40...45 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-40.,45.);break;
00221 case 20:
00222 gtk_label_set_text((GtkLabel *)label_data,"[-30...120 deg]");gtk_spin_button_set_range((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data,-30.,120.);break;}
00223
00224 gtk_spin_button_set_value ((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data, 0.);
00225
00226 while (g_main_context_iteration (NULL, FALSE));
00227 }
00228
00229 void on_button_setpos_clicked(GtkWidget *widget, gpointer user_data)
00230 {
00231 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00232
00233 if(RobotVars->servo->IsActive())
00234 {
00235
00236 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00237 GList *child1=g_list_first(child_list);
00238
00239 gint selection=gtk_combo_box_get_active((GtkComboBox *)child1->data);
00240 if(selection==0){
00241 g_list_free(child_list);
00242 return;
00243 }
00244 else
00245 {
00246 int id;
00247 short unsigned int servo_position;
00248
00249 double angle_position = gtk_spin_button_get_value((GtkSpinButton *) g_list_next(g_list_next(g_list_next(child_list)))->data);
00250
00251 switch (selection){
00252 case 1:
00253 id=61;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.HeadTilt=angle_position;break;
00254 case 2:
00255 id=54;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightShoulderFlexion=angle_position;break;
00256 case 3:
00257 id=53;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightShoulderAbduction=angle_position;break;
00258 case 4:
00259 id=51;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightElbowFlexion=angle_position;break;
00260 case 5:
00261 id=44;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftShoulderFlexion=angle_position;break;
00262 case 6:
00263 id=43;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftShoulderAbduction=angle_position;break;
00264 case 7:
00265 id=41;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftElbowFlexion=angle_position;break;
00266 case 8:
00267 id=31;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.TorsoRotation=angle_position;break;
00268 case 9:
00269 id=32;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.TorsoFlexion=angle_position;break;
00270 case 10:
00271 id=33;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.TorsoLateralFlexion=angle_position;break;
00272 case 11:
00273 id=11;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightAnkleInversion=angle_position;break;
00274 case 12:
00275 id=12;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightAnkleFlexion=angle_position;break;
00276 case 13:
00277 id=13;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightKneeFlexion=angle_position;break;
00278 case 14:
00279 id=15;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightHipAbduction=angle_position;break;
00280 case 15:
00281 id=16;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.RightHipFlexion=angle_position;break;
00282 case 16:
00283 id=21;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftAnkleInversion=angle_position;break;
00284 case 17:
00285 id=22;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftAnkleFlexion=angle_position;break;
00286 case 18:
00287 id=23;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftKneeFlexion=angle_position;break;
00288 case 19:
00289 id=25;servo_position=ConvertJointAngleByID(id,angle_position);RobotVars->robot_kin_data.LeftHipAbduction=angle_position;break;
00290 case 20:
00291 id=26;servo_position=ConvertJointAngleByID(id,angle_position); RobotVars->robot_kin_data.LeftHipFlexion=angle_position;break;
00292 default:
00293 id=0;servo_position=ConvertJointAngleByID(id,angle_position);break;
00294 }
00295
00296 cout<<"Sending request to position ["<<servo_position<<"]"<<"["<<angle_position<<" deg]"<<" to servomotor id ["<<id<<"]."<<endl;
00297 int ret = RobotVars->servo->SetPosition(id,servo_position);
00298 cout<<"Servo response: "<<ret<<".";
00299 if(ret==0)
00300 {
00301 cout<<" Did not respond."<<endl;
00302 }
00303 else if(ret==0xFFFF)
00304 {
00305 cout<<" Some error occured. Value out of range or servomotor problem."<<endl;
00306 }
00307 else
00308 {
00309 cout<<endl;
00310 }
00311
00312 if(id!=0)
00313 {
00314 if(id>40 && id<55)
00315 UpdateArmsDirKinData(RobotVars);
00316 else if(id<29)
00317 UpdateDetachedLegsDirKinData(RobotVars);
00318
00319 RobotVars->update_labels=TRUE;
00320 }
00321
00322 }
00323 g_list_free(child_list);
00324 }
00325 }
00326
00327
00328 void on_button_release_all_clicked(GtkWidget *widget, gpointer user_data)
00329 {
00330 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00331 cout<<"Sending command release to all servos."<<endl;
00332 int ret=RobotVars->servo->ReleaseServos();
00333 cout<<"Servos responded: "<<ret<<"."<<endl;
00334 }
00335
00336 void on_button_go_toggled(GtkWidget *widget, gpointer user_data)
00337 {
00338 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00339 if(gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.go_button))
00340 {
00341 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.stop_button,FALSE);
00342 cout<<"Sending command GO to all servos."<<endl;
00343 int ret=RobotVars->servo->SetGoStop(1);
00344 cout<<"Servos responded: "<<ret<<"."<<endl;
00345 }
00346
00347 }
00348
00349 void on_button_stop_toggled(GtkWidget *widget, gpointer user_data)
00350 {
00351 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00352 if(gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.stop_button))
00353 {
00354 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.go_button,FALSE);
00355 cout<<"Sending command STOP to all servos."<<endl;
00356 int ret=RobotVars->servo->SetGoStop(0);
00357 cout<<"Servos responded: "<<ret<<"."<<endl;
00358 }
00359
00360 }
00361
00362 void on_about_menu_item_activate(GtkObject *object, gpointer user_data)
00363 {
00364 const gchar * const author[STR_LEN] = {"Master's Degree Student @University of Aveiro:\nPedro Cruz <pmbc@ua.pt>",NULL};
00365 const gchar copyright[STR_LEN] ="No copyright at all \xc2\xa9 2012 Pedro Cruz";
00366 const gchar comments[STR_LEN] = "PHUA Project Haptic Interface";
00367 const gchar license[STR_LEN] = "There is no license for this product!\nJust get the friggin' thing to work!\n :-D";
00368 gtk_show_about_dialog (NULL,"authors", author,"comments", comments,
00369 "copyright", copyright,"license",license,
00370 "version", "v2.0","website", "http://lars.mec.ua.pt",
00371 "website-label", "Link to LARS website and database.",
00372 "program-name", "PHUA Haptic Interface",
00373 "logo-icon-name", GTK_STOCK_EXECUTE,NULL);
00374 }
00375
00376 void on_button_set_pos_all_clicked(GtkWidget *widget, gpointer user_data)
00377 {
00378 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00379 if(RobotVars->servo->IsActive())
00380 {
00381
00382 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00383
00384 const gchar *angle_text=gtk_entry_get_text((GtkEntry *)g_list_next(g_list_first(child_list))->data);
00385
00386 if(isNumeric(angle_text))
00387 {
00388 short unsigned int position = atoi(angle_text);
00389
00390 if(position>=600 && position<=2400)
00391 {
00392
00393 cout<<"Sending request to position "<<position<<" to all servomotors in the bus."<<endl;
00394 int ret=RobotVars->servo->SetPositionAllServos(position);
00395 cout<<"Servo responded: "<<ret<<"."<<endl;
00396 UpdateJointDataByID(1000,NULL,RobotVars);
00397 UpdateArmsDirKinData(RobotVars);
00398 RobotVars->update_labels=TRUE;
00399 }
00400 else
00401 {
00402 cout<<"Invalid value for instruction."<<endl;
00403 }
00404 }
00405 g_list_free(child_list);
00406 }
00407 }
00408
00409 void on_button_setspeed_clicked(GtkWidget *widget, gpointer user_data)
00410 {
00411 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00412
00413 if(RobotVars->servo->IsActive())
00414 {
00415
00416 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00417
00418 gint selection=gtk_combo_box_get_active((GtkComboBox *)g_list_first(child_list)->data);
00419 if(selection==0){
00420 g_list_free(child_list);
00421 return;
00422 }
00423 else
00424 {
00425 int id;
00426
00427 const gchar *speed_text=gtk_entry_get_text((GtkEntry *)g_list_next(g_list_next(g_list_next(child_list)))->data);
00428 if(isNumeric(speed_text) && atoi(speed_text)!=0)
00429 {
00430 int speed = atoi(speed_text);
00431
00432 if(speed>0 && speed<256)
00433 {
00434
00435 switch (selection){
00436 case 1:
00437 id=61;break;
00438 case 2:
00439 id=54;break;
00440 case 3:
00441 id=53;break;
00442 case 4:
00443 id=51;break;
00444 case 5:
00445 id=44;break;
00446 case 6:
00447 id=43;break;
00448 case 7:
00449 id=41;break;
00450 case 8:
00451 id=31;break;
00452 case 9:
00453 id=32;break;
00454 case 10:
00455 id=33;break;
00456 case 11:
00457 id=11;break;
00458 case 12:
00459 id=12;break;
00460 case 13:
00461 id=13;break;
00462 case 14:
00463 id=15;break;
00464 case 15:
00465 id=16;break;
00466 case 16:
00467 id=21;break;
00468 case 17:
00469 id=22;break;
00470 case 18:
00471 id=23;break;
00472 case 19:
00473 id=25;break;
00474 case 20:
00475 id=26;break;
00476 default:
00477 id=0;break;}
00478
00479 cout<<"Sending request to set speed "<<speed<<" to servomotor id ["<<id<<"]."<<endl;
00480 int position=RobotVars->servo->SetSpeedPosition(id,speed);
00481 cout<<"Servo current position: "<<position<<"."<<endl;
00482
00483 if(position>=606 && position<=2406)
00484 {
00485 double joint_angle=ConvertServoValueByID(id,position);
00486 boost::format fmter("%3.1f");
00487 fmter % joint_angle;
00488 string position_label="Position read:\n" + boost::lexical_cast<string>(fmter.str())+"[deg]";
00489 gtk_label_set_text((GtkLabel *)g_list_last(child_list)->data,position_label.c_str());
00490 if(id!=0)
00491 {
00492 UpdateJointDataByID(id,joint_angle,RobotVars);
00493 if(id>40 && id<55)
00494 {
00495 UpdateArmsDirKinData(RobotVars);
00496 }
00497 else if(id<29)
00498 UpdateDetachedLegsDirKinData(RobotVars);
00499
00500 RobotVars->update_labels=TRUE;
00501 }
00502 }
00503 else
00504 {
00505 string position_label="Position read:\nERROR";
00506 gtk_label_set_text((GtkLabel *)g_list_last(child_list)->data,position_label.c_str());
00507 }
00508 }
00509 else
00510 {
00511 cout<<"Invalid value for instruction."<<endl;
00512 }
00513 }
00514 }
00515 g_list_free(child_list);
00516 }
00517 }
00518
00519 void on_button_vbuttonbox_update_robot_data_clicked(GtkWidget *widget, gpointer user_data)
00520 {
00521 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00522 pthread_mutex_lock(&RobotVars->mutex_gtk);
00523 UpdateJointDataByID(1000, 0., RobotVars);
00524 UpdateArmsDirKinData(RobotVars);
00525 UpdateDetachedLegsDirKinData(RobotVars);
00526 RobotVars->update_labels=TRUE;
00527 pthread_mutex_unlock(&RobotVars->mutex_gtk);
00528 }
00529
00530 void on_control_resolution_toggled(GtkWidget *widget, gpointer user_data)
00531 {
00532 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00533 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00534
00535 bool is_1mm=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_first(child_list)->data));
00536 bool is_0_1mm=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data));
00537 bool is_0_0_1mm=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data));
00538 bool is_0_0_0_1mm=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_last(child_list)->data));
00539
00540
00541 if(is_1mm && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget) && RobotVars->parameters.coordinate_resolution!=1.)
00542 {
00543 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00544 RobotVars->parameters.coordinate_resolution=1.;
00545 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00546 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00547 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00548 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00549 g_list_free(child_list);
00550 cout<<"Setting new control resolution to: "<<RobotVars->parameters.coordinate_resolution<<"[mm]."<<endl;
00551 return;
00552 }
00553 else if(is_0_1mm && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.coordinate_resolution!=0.1)
00554 {
00555 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00556 RobotVars->parameters.coordinate_resolution=0.1;
00557 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00558 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00559 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00560 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00561 g_list_free(child_list);
00562 cout<<"Setting new control resolution to: "<<RobotVars->parameters.coordinate_resolution<<"[mm]."<<endl;
00563 return;
00564 }
00565 else if(is_0_0_1mm && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.coordinate_resolution!=0.01)
00566 {
00567 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00568 RobotVars->parameters.coordinate_resolution=0.01;
00569 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00570 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00571 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00572 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00573 g_list_free(child_list);
00574 cout<<"Setting new control resolution to: "<<RobotVars->parameters.coordinate_resolution<<"[mm]."<<endl;
00575 return;
00576 }
00577 else if(is_0_0_0_1mm && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.coordinate_resolution!=0.001)
00578 {
00579 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00580 RobotVars->parameters.coordinate_resolution=0.001;
00581 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00582 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00583 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00584 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00585 g_list_free(child_list);
00586 cout<<"Setting new control resolution to: "<<RobotVars->parameters.coordinate_resolution<<"[mm]."<<endl;
00587 return;
00588 }
00589 }
00590
00591 void on_workspace_scaling_toggled(GtkWidget *widget, gpointer user_data)
00592 {
00593 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00594 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00595
00596 bool x1=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_first(child_list)->data));
00597 bool x2=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data));
00598 bool x3=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data));
00599 bool x4=(bool)gtk_toggle_button_get_active((GtkToggleButton *)(g_list_last(child_list)->data));
00600
00601
00602 if(x1 && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget) && RobotVars->parameters.pos_coord_scale!=1.)
00603 {
00604 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00605 RobotVars->parameters.pos_coord_scale=1.;
00606 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00607 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00608 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00609 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00610 g_list_free(child_list);
00611 cout<<"Setting workspace scaling to: x"<<RobotVars->parameters.pos_coord_scale<<"."<<endl;
00612 return;
00613 }
00614 else if(x2 && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.pos_coord_scale!=2.)
00615 {
00616 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00617 RobotVars->parameters.pos_coord_scale=2.;
00618 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00619 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00620 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00621 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00622 g_list_free(child_list);
00623 cout<<"Setting workspace scaling to: x"<<RobotVars->parameters.pos_coord_scale<<"."<<endl;
00624 return;
00625 }
00626 else if(x3 && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.pos_coord_scale!=3.)
00627 {
00628 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00629 RobotVars->parameters.pos_coord_scale=3.;
00630 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00631 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00632 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00633 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_last(child_list)->data),FALSE);
00634 g_list_free(child_list);
00635 cout<<"Setting workspace scaling to: x"<<RobotVars->parameters.pos_coord_scale<<"."<<endl;
00636 return;
00637 }
00638 else if(x4 && (bool)gtk_toggle_button_get_active((GtkToggleButton *)widget)&& RobotVars->parameters.pos_coord_scale!=4.)
00639 {
00640 pthread_mutex_lock(&(RobotVars->mutex_gtk));
00641 RobotVars->parameters.pos_coord_scale=4.;
00642 pthread_mutex_unlock(&(RobotVars->mutex_gtk));
00643 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_first(child_list)->data),FALSE);
00644 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_first(child_list))->data),FALSE);
00645 gtk_toggle_button_set_active((GtkToggleButton *)(g_list_next(g_list_next(g_list_first(child_list)))->data),FALSE);
00646 g_list_free(child_list);
00647 cout<<"Setting workspace scaling to: x"<<RobotVars->parameters.pos_coord_scale<<"."<<endl;
00648 return;
00649 }
00650 }
00651
00652 void on_button_test_invkin_clicked(GtkWidget *widget, gpointer user_data)
00653 {
00654 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00655 if(RobotVars->servo->IsActive())
00656 {
00657
00658 GList *child_list = gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00659
00660 gint selection=gtk_combo_box_get_active((GtkComboBox *)g_list_first(child_list)->data);
00661 if(selection==0){
00662 g_list_free(child_list);
00663 return;
00664 }
00665 else
00666 {
00667
00668 double X_pos=gtk_spin_button_get_value((GtkSpinButton *)g_list_next(g_list_next(g_list_first(child_list)))->data);
00669 double Y_pos=gtk_spin_button_get_value((GtkSpinButton *)g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_first(child_list)))))))->data);
00670 double Z_pos=gtk_spin_button_get_value((GtkSpinButton *)g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_next(g_list_first(child_list)))))))))))->data);
00671
00672 cout<<"POINTS READ: "<<X_pos<<"|"<<Y_pos<<"|"<<Z_pos<<" AT SELECTION: "<<selection<<endl;
00673
00674
00675 if(selection==1)
00676 {
00677 MoveArmToCartesianPosition(X_pos, Y_pos, Z_pos, LEFT, RobotVars);
00678 MoveArmToCartesianPosition(X_pos, Y_pos, Z_pos, RIGHT, RobotVars);
00679 UpdateArmsDirKinData(RobotVars);
00680 }
00681 else if(selection==2)
00682 {
00683
00684
00685
00686 MoveArmToCartesianPosition(X_pos, Y_pos, Z_pos, LEFT, RobotVars);
00687 MoveArmToCartesianPosition(X_pos, Y_pos, Z_pos, RIGHT, RobotVars);
00688 UpdateArmsDirKinData(RobotVars);
00689 }
00690 else if(selection==3)
00691 {
00692 MoveDetachedLegToCartesianPosition(X_pos, Y_pos, Z_pos, 0., LEFT, RobotVars);
00693 MoveDetachedLegToCartesianPosition(X_pos, Y_pos, Z_pos, 0., RIGHT, RobotVars);
00694 UpdateDetachedLegsDirKinData(RobotVars);
00695 }
00696 else
00697 {
00698
00699 }
00700
00701 g_list_free(child_list);
00702 }
00703
00704 }
00705 }
00706
00707 void on_button_calibration_clicked(GtkWidget *widget, gpointer user_data)
00708 {
00709 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00710 GtkWidget *dialog;
00711 dialog = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel ((GtkWidget *)widget)),
00712 GTK_DIALOG_DESTROY_WITH_PARENT,
00713 GTK_MESSAGE_WARNING,
00714 GTK_BUTTONS_OK_CANCEL,
00715 "Place the joystick pen tip pointer in the device inkwell and press OK to calibrate.");
00716 gtk_window_set_title(GTK_WINDOW(dialog), "PHANToM OMNI CALIBRATION CHECK");
00717
00718 gint result = gtk_dialog_run(GTK_DIALOG(dialog));
00719 switch (result)
00720 {
00721 case GTK_RESPONSE_OK:
00722 {
00723 pthread_mutex_lock(&RobotVars->mutex_gtk);
00724 RobotVars->phantom_data.need_update=TRUE;
00725 pthread_mutex_unlock(&RobotVars->mutex_gtk);
00726 break;
00727 }
00728 default:
00729 {
00730 pthread_mutex_lock(&RobotVars->mutex_gtk);
00731 RobotVars->phantom_data.need_update=FALSE;
00732 pthread_mutex_unlock(&RobotVars->mutex_gtk);
00733 break;
00734 }
00735 }
00736 gtk_widget_destroy(dialog);
00737 }
00738
00739 void on_notebook_change_current_page(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data)
00740 {
00741 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00742 pthread_mutex_lock(&RobotVars->mutex_gtk);
00743 RobotVars->parameters.selected_notebook_page = page_num;
00744 pthread_mutex_unlock(&RobotVars->mutex_gtk);
00745 }
00746
00747 void on_back_facing_menu_item_activate(GtkMenuItem *menuitem, gpointer user_data)
00748 {
00749
00750
00751
00752
00753
00754 }
00755
00756 void on_front_facing_menu_item_activate(GtkMenuItem *menuitem, gpointer user_data)
00757 {
00758
00759 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00760 pthread_mutex_lock(&RobotVars->mutex_gtk);
00761 RobotVars->parameters.cntrl_pos_back_front = (double)FRONT_FACING;
00762 pthread_mutex_unlock(&RobotVars->mutex_gtk);
00763 }
00764
00765 void on_demo_checkboxes_toggled(GtkToggleButton *togglebutton, gpointer user_data)
00766 {
00767 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00768 static bool demo1;
00769 static bool demo2;
00770 static bool demo3;
00771 static bool demo4;
00772
00773 demo1 = (bool)gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox);
00774 demo2 = (bool)gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox);
00775 demo3 = (bool)gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox);
00776 demo4 = (bool)gtk_toggle_button_get_active((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox);
00777
00778 if((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox == togglebutton && demo1)
00779 {
00780 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox,FALSE);
00781 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox,FALSE);
00782 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox,FALSE);
00783 RobotVars->haptics_data.chosen_demo = 1;
00784 cout<<"Chosen Haptic Demonstration "<<RobotVars->haptics_data.chosen_demo<<"."<<endl;
00785
00786 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00787 TRUE);
00788 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00789 FALSE);
00790 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00791 FALSE);
00792 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00793 FALSE);
00794
00795 }
00796 else if((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox == togglebutton && demo2)
00797 {
00798 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox,FALSE);
00799 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox,FALSE);
00800 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox,FALSE);
00801 RobotVars->haptics_data.chosen_demo = 2;
00802 cout<<"Chosen Haptic Demonstration "<<RobotVars->haptics_data.chosen_demo<<"."<<endl;
00803
00804 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00805 FALSE);
00806 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00807 TRUE);
00808 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00809 FALSE);
00810 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00811 FALSE);
00812 }
00813 else if((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox == togglebutton && demo3)
00814 {
00815 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox,FALSE);
00816 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox,FALSE);
00817 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox,FALSE);
00818 RobotVars->haptics_data.chosen_demo = 3;
00819 cout<<"Chosen Haptic Demonstration "<<RobotVars->haptics_data.chosen_demo<<"."<<endl;
00820
00821 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00822 FALSE);
00823 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00824 FALSE);
00825 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00826 FALSE);
00827 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00828 TRUE);
00829 }
00830 else if((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox == togglebutton && demo4)
00831 {
00832 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox,FALSE);
00833 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox,FALSE);
00834 gtk_toggle_button_set_active((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox,FALSE);
00835 RobotVars->haptics_data.chosen_demo = 4;
00836 cout<<"Chosen Haptic Demonstration "<<RobotVars->haptics_data.chosen_demo<<"."<<endl;
00837
00838 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00839 FALSE);
00840 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00841 FALSE);
00842 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00843 TRUE);
00844 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00845 FALSE);
00846 }
00847 else if((GtkToggleButton *)RobotVars->updt_labels.demo1_checkbox == togglebutton && !demo1 && !demo2 && !demo3 && !demo4)
00848 {
00849 RobotVars->haptics_data.chosen_demo = 0;
00850 cout<<"No Haptic Demonstration Chosen."<<endl;
00851
00852 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00853 FALSE);
00854 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00855 FALSE);
00856 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00857 FALSE);
00858 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00859 FALSE);
00860 }
00861 else if((GtkToggleButton *)RobotVars->updt_labels.demo2_checkbox == togglebutton && !demo1 && !demo2 && !demo3 && !demo4)
00862 {
00863 RobotVars->haptics_data.chosen_demo = 0;
00864 cout<<"No Haptic Demonstration Chosen."<<endl;
00865
00866 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00867 FALSE);
00868 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00869 FALSE);
00870 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00871 FALSE);
00872 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00873 FALSE);
00874 }
00875 else if((GtkToggleButton *)RobotVars->updt_labels.demo3_checkbox == togglebutton && !demo1 && !demo2 && !demo3 && !demo4)
00876 {
00877 RobotVars->haptics_data.chosen_demo = 0;
00878 cout<<"No Haptic Demonstration Chosen."<<endl;
00879
00880 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00881 FALSE);
00882 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00883 FALSE);
00884 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00885 FALSE);
00886 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00887 FALSE);
00888 }
00889 else if((GtkToggleButton *)RobotVars->updt_labels.demo4_checkbox == togglebutton && !demo1 && !demo2 && !demo3 && !demo4)
00890 {
00891 RobotVars->haptics_data.chosen_demo = 0;
00892 cout<<"No Haptic Demonstration Chosen."<<endl;
00893
00894 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.workspace_zone_label),
00895 FALSE);
00896 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.drawing_demo_label),
00897 FALSE);
00898 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.leg_balancing_demo_label),
00899 FALSE);
00900 gtk_widget_set_visible((GtkWidget *)gtk_widget_get_parent((GtkWidget *)RobotVars->updt_labels.user_path_label),
00901 FALSE);
00902 }
00903 }
00904
00905 void select_inv_kin_combobox_changed_event(GtkWidget *widget, gpointer user_data)
00906 {
00907 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00908 gint selection=gtk_combo_box_get_active((GtkComboBox *)widget);
00909
00910 if(selection==1)
00911 {
00912 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00913
00914 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,2), RobotVars->robot_kin_data.X_arm_end_left);
00915
00916 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,6), RobotVars->robot_kin_data.Y_arm_end_left);
00917
00918 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,10), RobotVars->robot_kin_data.Z_arm_end_left);
00919
00920 g_list_free(child_list);
00921 }
00922 else if(selection==2)
00923 {
00924
00925
00926 }
00927 else if(selection==3)
00928 {
00929 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)widget));
00930
00931 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,2), RobotVars->robot_kin_data.detached_leg_pos_left[0]);
00932 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,6), RobotVars->robot_kin_data.detached_leg_pos_left[1]);
00933 gtk_spin_button_set_value ((GtkSpinButton *)g_list_nth_data(child_list,10), RobotVars->robot_kin_data.detached_leg_pos_left[2]);
00934
00935 g_list_free(child_list);
00936 }
00937 else
00938 {
00939
00940 }
00941 }
00942
00943 void on_user_path_demo_point_store_button_clicked(GtkWidget *widget, gpointer user_data)
00944 {
00945 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00946 if(RobotVars->haptic_loop_start)
00947 {
00948 RobotVars->haptics_data.demo_user_path_point_storing = ! RobotVars->haptics_data.demo_user_path_point_storing;
00949 }
00950 else
00951 {
00952 RobotVars->haptics_data.demo_user_path_point_storing = FALSE;
00953 }
00954
00955 if(RobotVars->haptics_data.demo_user_path_point_storing)
00956 {
00957 gtk_button_set_label((GtkButton *)widget,"Stop Point\nAcquisition");
00958 }
00959 else
00960 {
00961 gtk_button_set_label((GtkButton *)widget,"Store Points");
00962 }
00963 }
00964
00965 void user_path_demo_run_checkbox_toggled(GtkToggleButton *togglebutton, gpointer user_data)
00966 {
00967 static bool run_once;
00968 static bool run_loop;
00969
00970 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
00971 GList *child_list=gtk_container_get_children((GtkContainer *)gtk_widget_get_parent((GtkWidget *)togglebutton));
00972
00973 run_once = (bool)gtk_toggle_button_get_active((GtkToggleButton *)g_list_first(child_list)->data);
00974 run_loop = (bool)gtk_toggle_button_get_active((GtkToggleButton *)g_list_last(child_list)->data);
00975
00976 if((GtkToggleButton *)g_list_first(child_list)->data == togglebutton && run_once)
00977 {
00978 gtk_toggle_button_set_active((GtkToggleButton *)g_list_last(child_list)->data,FALSE);
00979 }
00980 else if((GtkToggleButton *)g_list_last(child_list)->data == togglebutton && run_loop)
00981 {
00982 gtk_toggle_button_set_active((GtkToggleButton *)g_list_first(child_list)->data,FALSE);
00983 }
00984 else if((GtkToggleButton *)g_list_first(child_list)->data == togglebutton && !run_once && !run_loop)
00985 {
00986 gtk_toggle_button_set_active((GtkToggleButton *)g_list_last(child_list)->data,TRUE);
00987 }
00988 else if((GtkToggleButton *)g_list_last(child_list)->data == togglebutton && !run_once && !run_loop)
00989 {
00990 gtk_toggle_button_set_active((GtkToggleButton *)g_list_first(child_list)->data,TRUE);
00991 }
00992
00993 RobotVars->haptics_data.demo_user_path_is_run_once = run_once;
00994
00995 g_list_free(child_list);
00996 }
00997
00998 void on_user_path_demo_run_button_clicked(GtkWidget *widget, gpointer user_data)
00999 {
01000 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
01001
01002 if(RobotVars->haptic_loop_start && !RobotVars->haptics_data.demo_user_path_run_start)
01003 {
01004
01005 DemoUserPath_ReadPoints(RobotVars);
01006 }
01007 else
01008 {
01009 RobotVars->haptics_data.demo_user_path_run_start = FALSE;
01010 }
01011
01012 if(RobotVars->haptics_data.demo_user_path_run_start)
01013 {
01014 gtk_button_set_label((GtkButton *)widget,"STOP Run");
01015 }
01016 else
01017 {
01018 gtk_button_set_label((GtkButton *)widget,"Run Points");
01019 }
01020 }
01021
01022 void on_user_path_demo_clear_button_clicked(GtkWidget *widget, gpointer user_data)
01023 {
01024 shared_vars_t*RobotVars=(shared_vars_t*)user_data;
01025 if(!RobotVars->haptic_loop_start && !RobotVars->haptics_data.demo_user_path_run_start)
01026 {
01027 cout<<"-> Deleting points file...";
01028 std::string file_remove_command = "rm " + ros::package::getPath("phua_haptic") + "/pnts/" + POINTS_FILE_NAME_STRING;
01029 int ret = system(file_remove_command.c_str());
01030 if(ret < 0)
01031 {
01032 cout<<endl;
01033 perror("File remove error!");
01034 }
01035 else
01036 cout<<"DONE!"<<endl;
01037
01038 cout<<"-> Clearing points from memory...";
01039 RobotVars->haptics_data.user_path_X_pnts.clear();
01040 RobotVars->haptics_data.user_path_Y_pnts.clear();
01041 RobotVars->haptics_data.user_path_Z_pnts.clear();
01042 cout<<"DONE!"<<endl;
01043 }
01044 }
01045
01046 gboolean update_watcher(gpointer data_struct)
01047 {
01048 shared_vars_t*RobotVars=(shared_vars_t*)data_struct;
01049
01050 if(RobotVars->parameters.exit_status==TRUE)
01051 {
01052 return FALSE;
01053 }
01054 else
01055 {
01056
01057 if(RobotVars->update_labels)
01058 {
01059 UpdateLabels(RobotVars);
01060 pthread_mutex_lock(&RobotVars->mutex_gtk);
01061 RobotVars->update_labels=FALSE;
01062 pthread_mutex_unlock(&RobotVars->mutex_gtk);
01063 }
01064
01065 GtkWidget *toplevel = gtk_widget_get_toplevel ((GtkWidget *)RobotVars->updt_labels.head_tilt_label);
01066 bool *man=(bool*)g_object_get_data((GObject *)toplevel,"manual_speed_control");
01067 bool *autom=(bool*)g_object_get_data((GObject *)toplevel,"automatic_speed_control");
01068 if(*man!=RobotVars->parameters.manual_speed_control)
01069 {
01070 RobotVars->parameters.manual_speed_control=*man;
01071 }
01072 if(*autom!=RobotVars->parameters.automatic_speed_control)
01073 {
01074 RobotVars->parameters.automatic_speed_control=*autom;
01075 }
01076 if(!RobotVars->parameters.manual_speed_control)
01077 {
01078
01079 gtk_progress_bar_set_fraction((GtkProgressBar *)RobotVars->updt_labels.auto_speed_arm_theta1_bar,(double)RobotVars->parameters.arm_auto_speed[0]/255.);
01080 gtk_progress_bar_set_fraction((GtkProgressBar *)RobotVars->updt_labels.auto_speed_arm_theta2_bar,(double)RobotVars->parameters.arm_auto_speed[1]/255.);
01081 gtk_progress_bar_set_fraction((GtkProgressBar *)RobotVars->updt_labels.auto_speed_arm_theta3_bar,(double)RobotVars->parameters.arm_auto_speed[2]/255.);
01082 }
01083
01084 if(RobotVars->phantom_data.phantom_on)
01085 {
01086
01087 if(RobotVars->phantom_data.m_button1Clicked)
01088 {
01089
01090 pthread_mutex_lock(&RobotVars->mutex_gtk);
01091 RobotVars->phantom_data.m_button1Clicked=FALSE;
01092 pthread_mutex_unlock(&RobotVars->mutex_gtk);
01093 on_button_start_loop_clicked((GtkWidget *)(RobotVars->updt_labels.start_loop_button),RobotVars);
01094 }
01095
01096 if(RobotVars->phantom_data.m_button2Clicked)
01097 {
01098 if(!RobotVars->haptic_loop_start)
01099 {
01100
01101 pthread_mutex_lock(&RobotVars->mutex_gtk);
01102 RobotVars->phantom_data.m_button2Clicked=FALSE;
01103 pthread_mutex_unlock(&RobotVars->mutex_gtk);
01104 gint sel=gtk_combo_box_get_active((GtkComboBox *)(RobotVars->updt_labels.kin_model_combobox));
01105 if(sel==5)
01106 gtk_combo_box_set_active((GtkComboBox *)(RobotVars->updt_labels.kin_model_combobox),1);
01107 else
01108 gtk_combo_box_set_active((GtkComboBox *)(RobotVars->updt_labels.kin_model_combobox),sel+1);
01109 }
01110 else if(RobotVars->haptic_loop_start && RobotVars->haptics_data.demo_user_path_point_storing)
01111 {
01112 pthread_mutex_lock(&RobotVars->mutex_gtk);
01113 RobotVars->phantom_data.m_button2Clicked = FALSE;
01114 pthread_mutex_unlock(&RobotVars->mutex_gtk);
01115 cout<<"-> Storing point for User Path Demonstration...";
01116 DemoUserPath_WritePoints(RobotVars);
01117 cout<<"DONE!"<<endl;
01118 }
01119 }
01120
01121 UpdateForceBars(RobotVars);
01122 }
01123
01124 UpdateStatusBar(RobotVars);
01125
01126 if(RobotVars->haptics_data.demo_user_path_run_start)
01127 {
01128 gtk_button_set_label((GtkButton *)RobotVars->updt_labels.user_path_run_button,"STOP Run");
01129 }
01130 else
01131 {
01132 gtk_button_set_label((GtkButton *)RobotVars->updt_labels.user_path_run_button,"Run Points");
01133 }
01134 return TRUE;
01135 }
01136 }
01137
01138
01139
01140
01141 void *interface_init(void *dummy)
01142 {
01143 shared_vars_t*RobotVars=(shared_vars_t*)dummy;
01144
01145
01146 gtk_init(NULL,NULL);
01147
01148
01149 GError *err = NULL;
01150
01151
01152 GdkColor red = {0, 0xffff, 0x0000, 0x0000};
01153 GdkColor green = {0, 0x0000, 0xffff, 0x0000};
01154 GdkColor blue = {0, 0x0000, 0x0000, 0xffff};
01155
01156 char *markup;
01157
01158
01159
01160
01161 GtkWidget *main_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
01162
01163 gtk_window_set_position(GTK_WINDOW(main_window), GTK_WIN_POS_CENTER);
01164
01165 gtk_window_set_resizable ((GtkWindow *)main_window,FALSE);
01166
01167 gtk_window_set_title(GTK_WINDOW(main_window), "PHUA Haptic Interface v2.0");
01168
01169 string cmplt_icon_path = ros::package::getPath("phua_haptic") + "/image/robot.png";
01170 gtk_window_set_icon_from_file(GTK_WINDOW(main_window),cmplt_icon_path.c_str(),&err);
01171 if(err!=NULL)
01172 {
01173 cout<<"Error loading application icon."<<endl<<err->message<<endl;
01174 g_error_free(err);
01175 }
01176
01177 GtkAccelGroup *accel_group=gtk_accel_group_new();
01178 gtk_window_add_accel_group(GTK_WINDOW(main_window), accel_group);
01179
01180
01181
01182
01183
01184 GtkWidget *main_vbox=gtk_vbox_new(FALSE, 5);
01185
01186
01187
01188
01189 GtkWidget *statusbar=gtk_statusbar_new();
01190
01191 if(RobotVars->servo->IsActive() && !RobotVars->phantom_data.phantom_on)
01192 gtk_statusbar_push(GTK_STATUSBAR(statusbar),gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar),"statusbar_info"),":: Hitec servomotor COMM active :: PHANToM OMNI inactive ::");
01193 else if(RobotVars->servo->IsActive() && RobotVars->phantom_data.phantom_on)
01194 {
01195 gtk_statusbar_push(GTK_STATUSBAR(statusbar),gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar),"statusbar_info"),":: Hitec servomotor COMM active :: PHANToM OMNI active ::");
01196 }
01197 else if(!RobotVars->servo->IsActive() && RobotVars->phantom_data.phantom_on)
01198 {
01199 gtk_statusbar_push(GTK_STATUSBAR(statusbar),gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar),"statusbar_info"),":: Hitec servomotor COMM inactive :: PHANToM OMNI active ::");
01200 }
01201 else
01202 gtk_statusbar_push(GTK_STATUSBAR(statusbar),gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar),"statusbar_info"),":: Communications inactive ::");
01203
01204 RobotVars->updt_labels.status_bar = statusbar;
01205
01206
01207
01208
01209 GtkWidget *menu_bar=gtk_menu_bar_new();
01210 GtkWidget *menu_options=gtk_menu_new();
01211
01212 GtkWidget *menu_item_options=gtk_menu_item_new_with_mnemonic("Options");
01213 GtkWidget *menu_item_quit=gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group);
01214 GtkWidget *menu_item_about=gtk_menu_item_new_with_mnemonic("About");
01215
01216 GtkWidget *menu_item_back_front=gtk_menu_item_new_with_mnemonic("Control Positioning");
01217 GtkWidget *menu_back_front=gtk_menu_new();
01218 GtkWidget *menu_item_back_facing=gtk_menu_item_new_with_mnemonic("Control Robot Back-Facing");
01219 GtkWidget *menu_item_front_facing=gtk_menu_item_new_with_mnemonic("Control Robot Front-Facing");
01220
01221 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item_options), menu_options);
01222 gtk_menu_shell_append(GTK_MENU_SHELL(menu_options), menu_item_back_front);
01223 gtk_menu_item_set_submenu((GtkMenuItem *)menu_item_back_front,menu_back_front);
01224 gtk_menu_shell_append(GTK_MENU_SHELL(menu_back_front), menu_item_back_facing);
01225 gtk_menu_shell_append(GTK_MENU_SHELL(menu_back_front), menu_item_front_facing);
01226 gtk_menu_shell_append(GTK_MENU_SHELL(menu_options), menu_item_quit);
01227 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_item_options);
01228 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_item_about);
01229
01230 gtk_menu_item_set_use_underline((GtkMenuItem *)menu_item_options, TRUE);
01231 gtk_menu_item_set_use_underline((GtkMenuItem *)menu_item_about, TRUE);
01232 gtk_menu_item_set_use_underline((GtkMenuItem *)menu_item_back_front, TRUE);
01233 gtk_menu_item_set_use_underline((GtkMenuItem *)menu_item_back_facing, TRUE);
01234 gtk_menu_item_set_use_underline((GtkMenuItem *)menu_item_front_facing, TRUE);
01235
01236
01237
01238
01239
01240 GtkWidget *bottom_buttons_hbox=gtk_hbox_new(FALSE, 3);
01241
01242 GtkWidget *button_start_loop=gtk_button_new_with_label("\nSTART HAPTICS/CONTROL LOOP\n");
01243 gtk_button_set_focus_on_click((GtkButton *)button_start_loop,TRUE);
01244 RobotVars->updt_labels.start_loop_button=button_start_loop;
01245
01246 GtkWidget *button_vbuttonbox_update_robot_data=gtk_button_new_with_label("UPDATE HUMANOID ROBOT JOINT DATA");
01247
01248 GtkWidget *button_set_robot_home_pos=gtk_button_new_with_label("SET HUMANOID ROBOT @ HOME POSITION");
01249 gtk_button_set_focus_on_click((GtkButton *)button_set_robot_home_pos,TRUE);
01250
01251 GtkWidget *button_quit = gtk_button_new_from_stock(GTK_STOCK_QUIT);
01252
01253
01254
01255
01256 GtkWidget *notebook=gtk_notebook_new();
01257
01258 GtkWidget *label_notebook_page_1=gtk_label_new("Control Humanoid Robot");
01259
01260 GtkWidget *page1_main_vertbox=gtk_vbox_new(FALSE, 3);
01261
01262 GtkWidget *page1_main_hbox=gtk_hbox_new(FALSE, 5);
01263 gtk_box_pack_start(GTK_BOX(page1_main_vertbox), page1_main_hbox,TRUE, TRUE, 0);
01264
01265 gtk_notebook_append_page ((GtkNotebook *)notebook,page1_main_vertbox,label_notebook_page_1);
01266
01267
01268 GtkWidget *page2_main_hbox=gtk_hbox_new(FALSE, 5);
01269
01270 GtkWidget *label_notebook_page_2=gtk_label_new("Joystick Information and Miscellaneous Commands");
01271
01272 gtk_notebook_append_page((GtkNotebook *)notebook,page2_main_hbox,label_notebook_page_2);
01273
01274
01275 GtkWidget *page3_main_hbox_arm_demos=gtk_hbox_new(FALSE, 3);
01276
01277 GtkWidget *label_notebook_page_3=gtk_label_new("Select Demonstrations");
01278
01279 gtk_notebook_append_page((GtkNotebook *)notebook, page3_main_hbox_arm_demos, label_notebook_page_3);
01280
01281
01282
01283
01284
01285
01286 GtkWidget *notebook_vbox_left_page1=gtk_vbox_new(FALSE, 5);
01287
01288 GtkWidget *page1_left_top_frame=gtk_frame_new("Control Type:");
01289 gtk_frame_set_shadow_type((GtkFrame *)page1_left_top_frame,GTK_SHADOW_OUT);
01290
01291 GtkWidget *page1_left_top_frame_combobox=gtk_combo_box_new_text();
01292 RobotVars->updt_labels.kin_model_combobox=page1_left_top_frame_combobox;
01293 const gchar cmbbox_start[]="-> Select control type: <-";
01294 const gchar cmbbox_list1[]="Control Right Arm:";
01295 const gchar cmbbox_list2[]="Control Left Arm:";
01296 const gchar cmbbox_list3[]="Control Both Arms:";
01297 const gchar cmbbox_list4[]="Control Left Detached Leg:";
01298 const gchar cmbbox_list5[]="Control Right Detached Leg:";
01299 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_start);
01300 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_list1);
01301 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_list2);
01302 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_list3);
01303 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_list4);
01304 gtk_combo_box_append_text((GtkComboBox *)page1_left_top_frame_combobox,cmbbox_list5);
01305 gtk_combo_box_set_active((GtkComboBox *)page1_left_top_frame_combobox,0);
01306 gtk_frame_set_label_widget((GtkFrame *)page1_left_top_frame,page1_left_top_frame_combobox);
01307
01308 GtkWidget *page1_left_bottom_frame=gtk_frame_new(NULL);
01309 gtk_frame_set_shadow_type((GtkFrame *)page1_left_bottom_frame,GTK_SHADOW_OUT);
01310 GtkWidget *label_options_frame=gtk_label_new(NULL);
01311 markup = g_markup_printf_escaped ("<span size=\"large\"> :: <u>%s</u> :: </span>", "Control Type Options");
01312 gtk_label_set_markup (GTK_LABEL (label_options_frame), markup);
01313 gtk_frame_set_label_widget((GtkFrame *)page1_left_bottom_frame, label_options_frame);
01314
01315
01316
01317 GtkWidget *page1_left_top_frame_vbox=gtk_vbox_new(FALSE, 5);
01318
01319
01320 GtkWidget *label_coordinates=gtk_label_new("Robot Left Arm end coordinates / Roll/Pitch/Yaw angles:");
01321 gtk_label_set_justify((GtkLabel *)label_coordinates,GTK_JUSTIFY_CENTER);
01322 markup = g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Left Arm end coordinates / Roll/Pitch/Yaw angles:");
01323 gtk_label_set_markup (GTK_LABEL (label_coordinates), markup);
01324 RobotVars->updt_labels.joints_left_side = label_coordinates;
01325
01326
01327 GtkWidget *hbox_coordinates_left_arm=gtk_hbox_new(FALSE, 5);
01328
01329 const gchar init_val[]="---- [mm]";
01330 GString *x_text=g_string_new("X: ");
01331 g_string_append(x_text,init_val);
01332 GtkWidget *label_X=gtk_label_new(x_text->str);
01333 gtk_label_set_justify((GtkLabel *)label_X,GTK_JUSTIFY_CENTER);
01334 RobotVars->updt_labels.x_label_left=label_X;
01335
01336 GString *y_text=g_string_new("Y: ");
01337 g_string_append(y_text,init_val);
01338 GtkWidget *label_Y=gtk_label_new(y_text->str);
01339 gtk_label_set_justify((GtkLabel *)label_Y,GTK_JUSTIFY_CENTER);
01340 RobotVars->updt_labels.y_label_left=label_Y;
01341
01342 GString *z_text=g_string_new("Z: ");
01343 g_string_append(z_text,init_val);
01344 GtkWidget *label_Z=gtk_label_new(z_text->str);
01345 gtk_label_set_justify((GtkLabel *)label_Z,GTK_JUSTIFY_CENTER);
01346 RobotVars->updt_labels.z_label_left=label_Z;
01347
01348 const gchar init_val_deg[]="---- [deg]";
01349 GString *roll_text=g_string_new("R: ");
01350 g_string_append(roll_text,init_val_deg);
01351 GtkWidget *label_roll=gtk_label_new(roll_text->str);
01352 gtk_label_set_justify((GtkLabel *)label_roll,GTK_JUSTIFY_CENTER);
01353 RobotVars->updt_labels.roll_label_left=label_roll;
01354
01355 GString *pitch_text=g_string_new("P: ");
01356 g_string_append(pitch_text,init_val_deg);
01357 GtkWidget *label_pitch=gtk_label_new(pitch_text->str);
01358 gtk_label_set_justify((GtkLabel *)label_pitch,GTK_JUSTIFY_CENTER);
01359 RobotVars->updt_labels.pitch_label_left=label_pitch;
01360
01361 GString *yaw_text=g_string_new("Y: ");
01362 g_string_append(yaw_text,init_val_deg);
01363 GtkWidget *label_yaw=gtk_label_new(yaw_text->str);
01364 gtk_label_set_justify((GtkLabel *)label_yaw,GTK_JUSTIFY_CENTER);
01365 RobotVars->updt_labels.yaw_label_left=label_yaw;
01366
01367
01368 GtkWidget *label_coordinates_2=gtk_label_new("Robot Right Arm end coordinates / Roll/Pitch/Yaw angles:");
01369 gtk_label_set_justify((GtkLabel *)label_coordinates_2,GTK_JUSTIFY_CENTER);
01370 markup = g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot Right Arm end coordinates / Roll/Pitch/Yaw angles:");
01371 gtk_label_set_markup (GTK_LABEL (label_coordinates_2), markup);
01372 RobotVars->updt_labels.joints_right_side = label_coordinates_2;
01373
01374
01375 GtkWidget *hbox_coordinates_right_arm=gtk_hbox_new(FALSE, 5);
01376
01377 const gchar init_val_2[]="---- [mm]";
01378 GString *x_text_2=g_string_new("X: ");
01379 g_string_append(x_text_2,init_val_2);
01380 GtkWidget *label_X_2=gtk_label_new(x_text_2->str);
01381 gtk_label_set_justify((GtkLabel *)label_X_2,GTK_JUSTIFY_CENTER);
01382 RobotVars->updt_labels.x_label_right=label_X_2;
01383
01384 GString *y_text_2=g_string_new("Y: ");
01385 g_string_append(y_text_2,init_val_2);
01386 GtkWidget *label_Y_right=gtk_label_new(y_text_2->str);
01387 gtk_label_set_justify((GtkLabel *)label_Y_right,GTK_JUSTIFY_CENTER);
01388 RobotVars->updt_labels.y_label_right=label_Y_right;
01389
01390 GString *z_text_2=g_string_new("Z: ");
01391 g_string_append(z_text_2,init_val_2);
01392 GtkWidget *label_Z_right=gtk_label_new(z_text_2->str);
01393 gtk_label_set_justify((GtkLabel *)label_Z_right,GTK_JUSTIFY_CENTER);
01394 RobotVars->updt_labels.z_label_right=label_Z_right;
01395
01396 const gchar init_val_2_deg[]="---- [deg]";
01397 GString *roll_text_2=g_string_new("R: ");
01398 g_string_append(roll_text_2,init_val_2_deg);
01399 GtkWidget *label_roll_right=gtk_label_new(roll_text_2->str);
01400 gtk_label_set_justify((GtkLabel *)label_roll_right,GTK_JUSTIFY_CENTER);
01401 RobotVars->updt_labels.roll_label_right=label_roll_right;
01402
01403 GString *pitch_text_2=g_string_new("P: ");
01404 g_string_append(pitch_text_2,init_val_2_deg);
01405 GtkWidget *label_pitch_right=gtk_label_new(pitch_text_2->str);
01406 gtk_label_set_justify((GtkLabel *)label_pitch_right,GTK_JUSTIFY_CENTER);
01407 RobotVars->updt_labels.pitch_label_right=label_pitch_right;
01408
01409 GString *yaw_text_2=g_string_new("Y: ");
01410 g_string_append(yaw_text_2,init_val_2_deg);
01411 GtkWidget *label_yaw_right=gtk_label_new(yaw_text_2->str);
01412 gtk_label_set_justify((GtkLabel *)label_yaw_right,GTK_JUSTIFY_CENTER);
01413 RobotVars->updt_labels.yaw_label_right=label_yaw_right;
01414
01415
01416 GtkWidget *label_joint=gtk_label_new("Robot joint values (deg):");
01417 gtk_label_set_justify((GtkLabel *)label_joint,GTK_JUSTIFY_CENTER);
01418 markup = g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Robot joint values (deg):");
01419 gtk_label_set_markup (GTK_LABEL (label_joint), markup);
01420
01421 const gchar init_val_jnt_[]="--- [deg]";
01422 GString *head_label_text=g_string_new("Head Tilt: ");
01423 g_string_append(head_label_text,init_val_jnt_);
01424 GtkWidget *label_head=gtk_label_new(head_label_text->str);
01425 gtk_label_set_justify((GtkLabel *)label_head,GTK_JUSTIFY_CENTER);
01426 RobotVars->updt_labels.head_tilt_label=label_head;
01427
01428 GtkWidget *hbox_arm_jnts=gtk_hbox_new(FALSE, 5);
01429
01430 const gchar init_val_jnt[]="--- [deg]\n";
01431 GString *right_arm_label_text=g_string_new("Right Shoulder Flexion: ");
01432 g_string_append(right_arm_label_text,init_val_jnt);
01433 g_string_append(right_arm_label_text,"Right Shoulder Abduction: ");
01434 g_string_append(right_arm_label_text,init_val_jnt);
01435 g_string_append(right_arm_label_text,"Right Elbow Flexion: ");
01436 g_string_append(right_arm_label_text,init_val_jnt_);
01437 GtkWidget *label_right_arm=gtk_label_new(right_arm_label_text->str);
01438 gtk_label_set_justify((GtkLabel *)label_right_arm,GTK_JUSTIFY_CENTER);
01439 RobotVars->updt_labels.right_arm_label=label_right_arm;
01440
01441 GString *left_arm_label_text=g_string_new("Left Shoulder Flexion: ");
01442 g_string_append(left_arm_label_text,init_val_jnt);
01443 g_string_append(left_arm_label_text,"Left Shoulder Abduction: ");
01444 g_string_append(left_arm_label_text,init_val_jnt);
01445 g_string_append(left_arm_label_text,"Left Elbow Flexion: ");
01446 g_string_append(left_arm_label_text,init_val_jnt_);
01447 GtkWidget *label_left_arm=gtk_label_new(left_arm_label_text->str);
01448 gtk_label_set_justify((GtkLabel *)label_left_arm,GTK_JUSTIFY_CENTER);
01449 RobotVars->updt_labels.left_arm_label=label_left_arm;
01450
01451 GString *torso_label_text=g_string_new("Torso Rotation: ");
01452 g_string_append(torso_label_text,init_val_jnt);
01453 g_string_append(torso_label_text,"Torso Flexion: ");
01454 g_string_append(torso_label_text,init_val_jnt);
01455 g_string_append(torso_label_text,"Torso Lateral Flexion: ");
01456 g_string_append(torso_label_text,init_val_jnt_);
01457 GtkWidget *label_torso=gtk_label_new(torso_label_text->str);
01458 gtk_label_set_justify((GtkLabel *)label_torso,GTK_JUSTIFY_CENTER);
01459 RobotVars->updt_labels.torso_label=label_torso;
01460
01461 GtkWidget *hbox_leg_jnts=gtk_hbox_new(FALSE, 5);
01462
01463 GString *right_leg_label_text=g_string_new("Right Hip Flexion: ");
01464 g_string_append(right_leg_label_text,init_val_jnt);
01465 g_string_append(right_leg_label_text,"Right Hip Abduction: ");
01466 g_string_append(right_leg_label_text,init_val_jnt);
01467 g_string_append(right_leg_label_text,"Right Knee Flexion: ");
01468 g_string_append(right_leg_label_text,init_val_jnt);
01469 g_string_append(right_leg_label_text,"Right Ankle Flexion: ");
01470 g_string_append(right_leg_label_text,init_val_jnt);
01471 g_string_append(right_leg_label_text,"Right Ankle Inversion: ");
01472 g_string_append(right_leg_label_text,init_val_jnt_);
01473 GtkWidget *label_right_leg=gtk_label_new(right_leg_label_text->str);
01474 gtk_label_set_justify((GtkLabel *)label_right_leg,GTK_JUSTIFY_CENTER);
01475 RobotVars->updt_labels.right_leg_label=label_right_leg;
01476
01477 GString *left_leg_label_text=g_string_new("Left Hip Flexion: ");
01478 g_string_append(left_leg_label_text,init_val_jnt);
01479 g_string_append(left_leg_label_text,"Left Hip Abduction: ");
01480 g_string_append(left_leg_label_text,init_val_jnt);
01481 g_string_append(left_leg_label_text,"Left Knee Flexion: ");
01482 g_string_append(left_leg_label_text,init_val_jnt);
01483 g_string_append(left_leg_label_text,"Left Ankle Flexion: ");
01484 g_string_append(left_leg_label_text,init_val_jnt);
01485 g_string_append(left_leg_label_text,"Left Ankle Inversion: ");
01486 g_string_append(left_leg_label_text,init_val_jnt_);
01487 GtkWidget *label_left_leg=gtk_label_new(left_leg_label_text->str);
01488 gtk_label_set_justify((GtkLabel *)label_left_leg,GTK_JUSTIFY_CENTER);
01489 RobotVars->updt_labels.left_leg_label=label_left_leg;
01490
01491
01492 GtkWidget *page1_left_bottom_frame_vbox=gtk_vbox_new(FALSE, 5);
01493
01494 GtkWidget *constant_speed_radio_checkbox=gtk_check_button_new_with_label("Position Control Mode");
01495 gtk_toggle_button_set_active((GtkToggleButton *)constant_speed_radio_checkbox,TRUE);
01496
01497 GtkWidget *hbox_scrll_lbl=gtk_hbox_new(FALSE, 5);
01498
01499 GtkWidget *label_speed_scale_bar=gtk_label_new("Overall Servomotor Speed:");
01500 gtk_label_set_justify((GtkLabel *)label_speed_scale_bar,GTK_JUSTIFY_LEFT);
01501
01502 GtkObject *ajustament_hscale=gtk_adjustment_new(50,1,280,1,25,25);
01503 GtkWidget *set_speed_hscale=gtk_hscale_new((GtkAdjustment *)ajustament_hscale);
01504 gtk_scale_set_digits((GtkScale *)set_speed_hscale,0);
01505 gtk_scale_set_value_pos((GtkScale *)set_speed_hscale,GTK_POS_RIGHT);
01506
01507 int tick;
01508 for(tick=0;tick<255;tick=tick+50)
01509 gtk_scale_add_mark((GtkScale *)set_speed_hscale,tick,GTK_POS_BOTTOM,NULL);
01510
01511 GtkWidget *controled_speed_radio_checkbox=gtk_check_button_new_with_label("Speed Control Mode");
01512 gtk_toggle_button_set_active((GtkToggleButton *)controled_speed_radio_checkbox,FALSE);
01513
01514
01515 GtkWidget *hbox_prog_bars_auto_speed=gtk_hbox_new(FALSE, 5);
01516 gtk_widget_set_visible((GtkWidget *)hbox_prog_bars_auto_speed,FALSE);
01517
01518 GtkWidget *arm_theta1_speed_prog_bar=gtk_progress_bar_new();
01519 gtk_progress_bar_set_text((GtkProgressBar *)arm_theta1_speed_prog_bar,"Shoulder Flexion Speed");
01520 gtk_progress_bar_set_fraction((GtkProgressBar *)arm_theta1_speed_prog_bar,1./255.);
01521 RobotVars->updt_labels.auto_speed_arm_theta1_bar=arm_theta1_speed_prog_bar;
01522 GtkWidget *arm_theta2_speed_prog_bar=gtk_progress_bar_new();
01523 gtk_progress_bar_set_text((GtkProgressBar *)arm_theta2_speed_prog_bar,"Shoulder Abduction Speed");
01524 gtk_progress_bar_set_fraction((GtkProgressBar *)arm_theta2_speed_prog_bar,1./255.);
01525 RobotVars->updt_labels.auto_speed_arm_theta2_bar=arm_theta2_speed_prog_bar;
01526 GtkWidget *arm_theta3_speed_prog_bar=gtk_progress_bar_new();
01527 gtk_progress_bar_set_text((GtkProgressBar *)arm_theta3_speed_prog_bar,"Elbow Flexion Speed");
01528 gtk_progress_bar_set_fraction((GtkProgressBar *)arm_theta3_speed_prog_bar,1./255.);
01529 RobotVars->updt_labels.auto_speed_arm_theta3_bar=arm_theta3_speed_prog_bar;
01530
01531
01532
01533
01534
01535 GtkWidget *page1_middle_frame=gtk_frame_new(" :: Haptics and Control Parameters :: ");
01536 gtk_frame_set_shadow_type((GtkFrame *)page1_middle_frame,GTK_SHADOW_OUT);
01537 gtk_frame_set_label_align((GtkFrame *)page1_middle_frame,0.5,0.5);
01538 GtkWidget *label_haptics_data_frame=gtk_label_new(NULL);
01539 markup = g_markup_printf_escaped (" :: <b>%s</b> :: ", "Haptics and Control Parameters");
01540 gtk_label_set_markup (GTK_LABEL (label_haptics_data_frame), markup);
01541 gtk_frame_set_label_widget((GtkFrame *)page1_middle_frame, label_haptics_data_frame);
01542
01543
01544 GtkWidget *vbox_phantom=gtk_vbox_new(FALSE, 3);
01545
01546
01547
01548 GtkWidget *page1_haptics_data_frame=gtk_frame_new("Haptics Data:");
01549 gtk_frame_set_shadow_type((GtkFrame *)page1_haptics_data_frame,GTK_SHADOW_OUT);
01550
01551 GtkWidget *vbox_haptic_information=gtk_vbox_new(FALSE, 0);
01552
01553 GtkWidget *hbox_workspace_interaction=gtk_hbox_new(FALSE, 3);
01554
01555 GtkWidget *label_workspace_interaction=gtk_label_new("Workspace Demonstration --");
01556 gtk_label_set_justify((GtkLabel *)label_workspace_interaction,GTK_JUSTIFY_LEFT);
01557 RobotVars->updt_labels.workspace_zone_label=label_workspace_interaction;
01558
01559
01560 GtkWidget *hbox_drawing_demo=gtk_hbox_new(FALSE, 3);
01561
01562 GtkWidget *label_drawing_demo=gtk_label_new("Plane navigation: -------------\nPlane equation: ax + by + cz + d = 0");
01563 gtk_label_set_justify((GtkLabel *)label_drawing_demo,GTK_JUSTIFY_LEFT);
01564 RobotVars->updt_labels.drawing_demo_label=label_drawing_demo;
01565
01566
01567 GtkWidget *hbox_user_path_demo=gtk_hbox_new(FALSE, 3);
01568
01569 GtkWidget *label_user_path_demo=gtk_label_new("User path following\nDEMO.");
01570 gtk_label_set_justify((GtkLabel *)label_user_path_demo,GTK_JUSTIFY_LEFT);
01571 RobotVars->updt_labels.user_path_label=label_user_path_demo;
01572
01573 GtkWidget *user_path_demo_point_store_button = gtk_button_new_with_label("Store Points");
01574
01575 GtkWidget *vbox_user_path_run_options = gtk_vbox_new(FALSE, 3);
01576
01577 GtkWidget *user_path_demo_run_button = gtk_button_new_with_label("Run Points");
01578 RobotVars->updt_labels.user_path_run_button = user_path_demo_run_button;
01579
01580 GtkWidget *hbox_user_path_checkboxes = gtk_hbox_new(FALSE, 3);
01581
01582 GtkWidget *user_path_demo_run_once_checkbox = gtk_check_button_new_with_label("Once");
01583 gtk_toggle_button_set_active((GtkToggleButton *)user_path_demo_run_once_checkbox,TRUE);
01584 GtkWidget *user_path_demo_run_loop_checkbox = gtk_check_button_new_with_label("Loop");
01585 gtk_toggle_button_set_active((GtkToggleButton *)user_path_demo_run_loop_checkbox,FALSE);
01586
01587 GtkWidget *user_path_demo_clear_button = gtk_button_new_with_label("Clear");
01588
01589
01590 GtkWidget *hbox_leg_balancing_demo=gtk_hbox_new(FALSE, 3);
01591
01592 GtkWidget *label_leg_balancing_cog_demo=gtk_label_new("Balancing Support Leg:\nCOG: X:--- Y:--- Z:---");
01593 gtk_label_set_justify((GtkLabel *)label_leg_balancing_cog_demo,GTK_JUSTIFY_LEFT);
01594 RobotVars->updt_labels.leg_balancing_demo_label=label_leg_balancing_cog_demo;
01595
01596
01597 GtkWidget *label_force_feedback=gtk_label_new(NULL);
01598 markup = g_markup_printf_escaped ("<span underline=\"single\"><b>%s</b></span>", "Force Feedback");
01599 gtk_label_set_markup (GTK_LABEL (label_force_feedback), markup);
01600 gtk_label_set_justify((GtkLabel *)label_force_feedback,GTK_JUSTIFY_CENTER);
01601
01602 GtkWidget *vbox_force_feedback=gtk_vbox_new(FALSE, 0);
01603
01604 GtkWidget *hbox_haptic_x_force=gtk_hbox_new(FALSE, 3);
01605
01606 GtkWidget *x_force_bar=gtk_progress_bar_new();
01607 gtk_progress_bar_set_fraction((GtkProgressBar *)x_force_bar, 0.);
01608 RobotVars->updt_labels.pos_x_force_bar=x_force_bar;
01609 GtkWidget *x_neg_force_bar=gtk_progress_bar_new();
01610 gtk_progress_bar_set_fraction((GtkProgressBar *)x_neg_force_bar, 0.);
01611 gtk_progress_bar_set_orientation((GtkProgressBar *)x_neg_force_bar,GTK_PROGRESS_RIGHT_TO_LEFT);
01612 RobotVars->updt_labels.neg_x_force_bar=x_neg_force_bar;
01613
01614 GtkWidget *label_x_force=gtk_label_new("X");
01615 gtk_label_set_justify((GtkLabel *)label_x_force,GTK_JUSTIFY_CENTER);
01616 gtk_widget_modify_fg(label_x_force, GTK_STATE_NORMAL, &red);
01617
01618 GtkWidget *hbox_haptic_y_force=gtk_hbox_new(FALSE, 3);
01619
01620 GtkWidget *y_force_bar=gtk_progress_bar_new();
01621 gtk_progress_bar_set_fraction((GtkProgressBar *)y_force_bar, 0.);
01622 RobotVars->updt_labels.pos_y_force_bar = y_force_bar;
01623 GtkWidget *y_neg_force_bar=gtk_progress_bar_new();
01624 gtk_progress_bar_set_fraction((GtkProgressBar *)y_neg_force_bar, 0.);
01625 gtk_progress_bar_set_orientation((GtkProgressBar *)y_neg_force_bar,GTK_PROGRESS_RIGHT_TO_LEFT);
01626 RobotVars->updt_labels.neg_y_force_bar = y_neg_force_bar;
01627
01628 GtkWidget *label_y_force=gtk_label_new("Y");
01629 gtk_label_set_justify((GtkLabel *)label_y_force,GTK_JUSTIFY_CENTER);
01630 gtk_widget_modify_fg(label_y_force, GTK_STATE_NORMAL, &green);
01631
01632 GtkWidget *hbox_haptic_z_force=gtk_hbox_new(FALSE, 3);
01633
01634 GtkWidget *z_force_bar=gtk_progress_bar_new();
01635 gtk_progress_bar_set_fraction((GtkProgressBar *)z_force_bar, 0.);
01636 RobotVars->updt_labels.pos_z_force_bar = z_force_bar;
01637 GtkWidget *z_neg_force_bar=gtk_progress_bar_new();
01638 gtk_progress_bar_set_fraction((GtkProgressBar *)z_neg_force_bar, 0.);
01639 gtk_progress_bar_set_orientation((GtkProgressBar *)z_neg_force_bar,GTK_PROGRESS_RIGHT_TO_LEFT);
01640 RobotVars->updt_labels.neg_z_force_bar = z_neg_force_bar;
01641
01642 GtkWidget *label_z_force=gtk_label_new("Z");
01643 gtk_label_set_justify((GtkLabel *)label_z_force,GTK_JUSTIFY_CENTER);
01644 gtk_widget_modify_fg(label_z_force, GTK_STATE_NORMAL, &blue);
01645
01646 GtkWidget *label_force_magnitude=gtk_label_new("Force magnitude: --- [N] (sent to the device)");
01647 gtk_label_set_justify((GtkLabel *)label_force_magnitude,GTK_JUSTIFY_CENTER);
01648 RobotVars->updt_labels.force_magnitude_label = label_force_magnitude;
01649
01650
01651
01652 GtkWidget *page1_control_parameters_frame=gtk_frame_new("Control Parameters:");
01653 gtk_frame_set_shadow_type((GtkFrame *)page1_control_parameters_frame,GTK_SHADOW_OUT);
01654
01655 GtkWidget *vbox_control_parameters=gtk_vbox_new(FALSE, 0);
01656
01657 GtkWidget *label_control_resolution=gtk_label_new("Control Resolution:");
01658 gtk_label_set_justify((GtkLabel *)label_control_resolution,GTK_JUSTIFY_LEFT);
01659
01660 GtkWidget *hbox_control_parameters=gtk_hbox_new(FALSE, 3);
01661
01662 GtkWidget *control_resolution_checkb_1mm=gtk_check_button_new_with_label("1 mm");
01663 gtk_toggle_button_set_active((GtkToggleButton *)control_resolution_checkb_1mm,TRUE);
01664 GtkWidget *control_resolution_checkb_0_1mm=gtk_check_button_new_with_label("0.1 mm");
01665 gtk_toggle_button_set_active((GtkToggleButton *)control_resolution_checkb_0_1mm,FALSE);
01666 GtkWidget *control_resolution_checkb_0_0_1mm=gtk_check_button_new_with_label("0.01 mm");
01667 gtk_toggle_button_set_active((GtkToggleButton *)control_resolution_checkb_0_0_1mm,FALSE);
01668 GtkWidget *control_resolution_checkb_0_0_0_1mm=gtk_check_button_new_with_label("0.001 mm");
01669 gtk_toggle_button_set_active((GtkToggleButton *)control_resolution_checkb_0_0_0_1mm,FALSE);
01670
01671 GtkWidget *label_workspace_scale=gtk_label_new("Workspace Scaling:");
01672 gtk_label_set_justify((GtkLabel *)label_workspace_scale,GTK_JUSTIFY_LEFT);
01673
01674 GtkWidget *hbox_workspace_scale=gtk_hbox_new(FALSE, 3);
01675
01676 GtkWidget *scale_1=gtk_check_button_new_with_label("x1");
01677 gtk_toggle_button_set_active((GtkToggleButton *)scale_1,FALSE);
01678 GtkWidget *scale_2=gtk_check_button_new_with_label("x2");
01679 gtk_toggle_button_set_active((GtkToggleButton *)scale_2,TRUE);
01680 GtkWidget *scale_3=gtk_check_button_new_with_label("x3");
01681 gtk_toggle_button_set_active((GtkToggleButton *)scale_3,FALSE);
01682 GtkWidget *scale_4=gtk_check_button_new_with_label("x4");
01683 gtk_toggle_button_set_active((GtkToggleButton *)scale_4,FALSE);
01684
01685
01686
01687
01688
01689
01690 GtkWidget *page2_left_frame=gtk_frame_new(NULL);
01691 gtk_frame_set_shadow_type((GtkFrame *)page2_left_frame,GTK_SHADOW_OUT);
01692 GtkWidget *label_indivdual_control_frame=gtk_label_new(NULL);
01693 markup = g_markup_printf_escaped (" :: <b>%s</b> :: ", "Miscellaneous Humanoid Robot Control");
01694 gtk_label_set_markup (GTK_LABEL (label_indivdual_control_frame), markup);
01695 gtk_frame_set_label_widget((GtkFrame *)page2_left_frame, label_indivdual_control_frame);
01696
01697
01698 GtkWidget *page2_vbox_funcs=gtk_vbox_new(FALSE, 5);
01699
01700 GtkWidget *label_page_2_setpos=gtk_label_new(NULL);
01701 markup = g_markup_printf_escaped ("<u>%s</u>:", "Set Individual Joint Angle");
01702 gtk_label_set_markup (GTK_LABEL (label_page_2_setpos), markup);
01703
01704 GtkWidget *page2_setpos_hbox=gtk_hbox_new(FALSE, 5);
01705
01706 GtkWidget *page2_select_id_combobox=gtk_combo_box_new_text();
01707 const gchar id_cmbbox_start[]=" >> Select Joint: <<";
01708 const gchar id_cmbbox_list1[]="Head Tilt";
01709 const gchar id_cmbbox_list2[]="Right Shoulder Flexion";
01710 const gchar id_cmbbox_list3[]="Right Shoulder Abduction";
01711 const gchar id_cmbbox_list4[]="Right Elbow Flexion";
01712 const gchar id_cmbbox_list5[]="Left Shoulder Flexion";
01713 const gchar id_cmbbox_list6[]="Left Shoulder Abduction";
01714 const gchar id_cmbbox_list7[]="Left Elbow Flexion";
01715 const gchar id_cmbbox_list8[]="Torso Rotation";
01716 const gchar id_cmbbox_list9[]="Torso Flexion";
01717 const gchar id_cmbbox_list10[]="Torso Lateral Flexion";
01718 const gchar id_cmbbox_list11[]="Right Ankle Inversion";
01719 const gchar id_cmbbox_list12[]="Right Ankle Flexion";
01720 const gchar id_cmbbox_list13[]="Right Knee Flexion";
01721 const gchar id_cmbbox_list14[]="Right Hip Abduction";
01722 const gchar id_cmbbox_list15[]="Right Hip Flexion";
01723 const gchar id_cmbbox_list16[]="Left Ankle Inversion";
01724 const gchar id_cmbbox_list17[]="Left Ankle Flexion";
01725 const gchar id_cmbbox_list18[]="Left Knee Flexion";
01726 const gchar id_cmbbox_list19[]="Left Hip Abduction";
01727 const gchar id_cmbbox_list20[]="Left Hip Flexion";
01728 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_start);
01729 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list1);
01730 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list2);
01731 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list3);
01732 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list4);
01733 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list5);
01734 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list6);
01735 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list7);
01736 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list8);
01737 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list9);
01738 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list10);
01739 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list11);
01740 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list12);
01741 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list13);
01742 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list14);
01743 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list15);
01744 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list16);
01745 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list17);
01746 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list18);
01747 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list19);
01748 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox,id_cmbbox_list20);
01749 gtk_combo_box_set_active((GtkComboBox *)page2_select_id_combobox,0);
01750
01751 GtkWidget *label_page_2_joint_angle=gtk_label_new("Joint Angle:");
01752
01753
01754
01755
01756
01757 GtkWidget *spinbutton_angle = gtk_spin_button_new_with_range ( -360., 360., 0.05);
01758 gtk_spin_button_set_value ((GtkSpinButton *)spinbutton_angle, 0.);
01759
01760
01761 GtkWidget *label_page_2_angle=gtk_label_new("[---]");
01762
01763 GtkWidget *button_setpos=gtk_button_new_with_label("Submit Angle");
01764
01765
01766 GtkWidget *label_page_2_setspeed=gtk_label_new(NULL);
01767 markup = g_markup_printf_escaped ("<u>%s</u> / <u>%s</u>:", "Set Individual Joint Speed","Read Position");
01768 gtk_label_set_markup (GTK_LABEL (label_page_2_setspeed), markup);
01769
01770 GtkWidget *page2_setspeed_hbox=gtk_hbox_new(FALSE, 3);
01771
01772 GtkWidget *page2_select_id_combobox2=gtk_combo_box_new_text();
01773 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_start);
01774 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list1);
01775 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list2);
01776 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list3);
01777 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list4);
01778 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list5);
01779 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list6);
01780 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list7);
01781 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list8);
01782 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list9);
01783 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list10);
01784 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list11);
01785 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list12);
01786 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list13);
01787 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list14);
01788 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list15);
01789 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list16);
01790 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list17);
01791 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list18);
01792 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list19);
01793 gtk_combo_box_append_text((GtkComboBox *)page2_select_id_combobox2,id_cmbbox_list20);
01794 gtk_combo_box_set_active((GtkComboBox *)page2_select_id_combobox2,0);
01795
01796 GtkWidget *label_page_2_speed_entry=gtk_label_new("Speed:");
01797
01798 GtkWidget *spinbutton_speed = gtk_spin_button_new_with_range ( 1., 255., 1.);
01799 gtk_spin_button_set_value ((GtkSpinButton *)spinbutton_speed, 1.);
01800
01801
01802 GtkWidget *label_page_2_speed=gtk_label_new("[1...255]");
01803
01804 GtkWidget *button_setspeed=gtk_button_new_with_label("Submit Speed");
01805
01806 GtkWidget *label_page_2_pos_read=gtk_label_new("Position read:\n---[deg]");
01807 gtk_label_set_justify((GtkLabel *)label_page_2_pos_read,GTK_JUSTIFY_CENTER);
01808
01809
01810 GtkWidget *label_page_2_set_pos_all=gtk_label_new(NULL);
01811 markup = g_markup_printf_escaped ("<u>%s</u>:", "Set Servomotor Position Off All The Joints");
01812 gtk_label_set_markup (GTK_LABEL (label_page_2_set_pos_all), markup);
01813
01814
01815 GtkWidget *page2_set_pos_all_hbox=gtk_hbox_new(FALSE, 3);
01816
01817 GtkWidget *label_page_2_setposall=gtk_label_new(" Digital Position:");
01818
01819 GtkWidget *entry_pos_all=gtk_entry_new();
01820 gtk_entry_set_max_length((GtkEntry *)entry_pos_all,4);
01821
01822 GtkWidget *label_page_2_limits=gtk_label_new("Value range [600...2400]");
01823 gtk_label_set_justify((GtkLabel *)label_page_2_limits,GTK_JUSTIFY_CENTER);
01824
01825 GtkWidget *button_set_pos_all=gtk_button_new_with_label("Submit Position");
01826
01827
01828 GtkWidget *label_page_2_invkin=gtk_label_new(NULL);
01829 markup = g_markup_printf_escaped ("<u>%s</u>:", "Inverse Kinematics");
01830 gtk_label_set_markup (GTK_LABEL (label_page_2_invkin), markup);
01831
01832 GtkWidget *page2_invkin_hbox=gtk_hbox_new(FALSE, 3);
01833
01834 GtkWidget *select_inv_kin_combobox=gtk_combo_box_new_text();
01835 gtk_combo_box_append_text((GtkComboBox *)select_inv_kin_combobox, " >> Kinematic Model: <<");
01836 gtk_combo_box_append_text((GtkComboBox *)select_inv_kin_combobox, "Arm (Shoulder ref.)");
01837 gtk_combo_box_append_text((GtkComboBox *)select_inv_kin_combobox, "Arm (Main ref.)");
01838 gtk_combo_box_append_text((GtkComboBox *)select_inv_kin_combobox, "Detached Leg");
01839 gtk_combo_box_set_active((GtkComboBox *)select_inv_kin_combobox,0);
01840
01841
01842 GtkWidget *label_invkin_X=gtk_label_new("X:");
01843
01844 GtkWidget *spinbutton_invkin_X = gtk_spin_button_new_with_range ( -1000, 1000, 0.1);
01845 gtk_spin_button_set_value ((GtkSpinButton *)spinbutton_invkin_X, 0);
01846
01847 GtkWidget *label_mm_1=gtk_label_new("[mm] ");
01848 GtkWidget *label_invkin_Y=gtk_label_new("Y:");
01849
01850 GtkWidget *spinbutton_invkin_Y = gtk_spin_button_new_with_range ( -1000, 1000, 0.1);
01851 gtk_spin_button_set_value ((GtkSpinButton *)spinbutton_invkin_Y, 0);
01852
01853 GtkWidget *label_mm_2=gtk_label_new("[mm] ");
01854 GtkWidget *label_invkin_Z=gtk_label_new("Z:");
01855
01856 GtkWidget *spinbutton_invkin_Z = gtk_spin_button_new_with_range ( -1000, 1000, 0.1);
01857 gtk_spin_button_set_value ((GtkSpinButton *)spinbutton_invkin_Z, 0);
01858
01859 GtkWidget *label_mm_3=gtk_label_new("[mm] ");
01860
01861 GtkWidget *button_test_invkin=gtk_button_new_with_label("Test I.K.");
01862
01863
01864 GtkWidget *page2_utilities_hbox=gtk_hbox_new(FALSE, 5);
01865
01866 GtkWidget *label_page_2_utils=gtk_label_new(NULL);
01867 markup = g_markup_printf_escaped ("<b>%s</b>", "Utilities");
01868 gtk_label_set_markup (GTK_LABEL (label_page_2_utils), markup);
01869
01870 GtkWidget *button_release=gtk_button_new_with_label("Release Servos");
01871
01872 GtkWidget *button_go=gtk_toggle_button_new_with_label ("Set Go");
01873 RobotVars->updt_labels.go_button = button_go;
01874 GtkWidget *button_stop=gtk_toggle_button_new_with_label("Set Stop");
01875 RobotVars->updt_labels.stop_button = button_stop;
01876
01877
01878 GtkWidget *page2_right_frame=gtk_frame_new(NULL);
01879 gtk_frame_set_shadow_type((GtkFrame *)page2_right_frame,GTK_SHADOW_OUT);
01880 GtkWidget *label_phantom_data_frame=gtk_label_new(NULL);
01881 markup = g_markup_printf_escaped (" :: <b>%s</b> :: ", "PHANToM OMNI Data and Parameters");
01882 gtk_label_set_markup (GTK_LABEL (label_phantom_data_frame), markup);
01883 gtk_frame_set_label_widget((GtkFrame *)page2_right_frame, label_phantom_data_frame);
01884
01885
01886 GtkWidget *page2_vbox_phantom=gtk_vbox_new(FALSE, 5);
01887
01888 GtkWidget *label_calibration=gtk_label_new(NULL);
01889 markup = g_markup_printf_escaped ("<i>%s</i>","Normal usage of the PHANToM haptic device will cause a small decalibration to incrementally appear. Please take the time to check it, following the instructions from the small window shown after pressing the button below.");
01890 gtk_label_set_markup (GTK_LABEL (label_calibration), markup);
01891 gtk_label_set_justify((GtkLabel *)label_calibration,GTK_JUSTIFY_CENTER);
01892 gtk_label_set_line_wrap((GtkLabel *)label_calibration,TRUE);
01893
01894 GtkWidget *button_calibration = gtk_toggle_button_new();
01895 GtkWidget *calibration_button_label = gtk_label_new(NULL);
01896 markup = g_markup_printf_escaped ("<span size=\"larger\"><i><b>%s</b>\n<b>%s</b></i></span>","PHANToM OMNI DEVICE","CALIBRATION TEST");
01897 gtk_label_set_markup (GTK_LABEL (calibration_button_label), markup);
01898 gtk_label_set_justify((GtkLabel *)calibration_button_label,GTK_JUSTIFY_CENTER);
01899 gtk_container_add(GTK_CONTAINER(button_calibration),calibration_button_label);
01900
01901
01902
01903
01904 GtkWidget *page2_joystick_raw_data_frame=gtk_frame_new("PHANToM Raw Data:");
01905 gtk_frame_set_shadow_type((GtkFrame *)page2_joystick_raw_data_frame,GTK_SHADOW_OUT);
01906
01907 GtkWidget *vbox_phantom_raw=gtk_vbox_new(FALSE, 0);
01908
01909 GtkWidget *joystick_position_label=gtk_label_new("PHANToM OMNI Coordinates:");
01910 gtk_label_set_justify((GtkLabel *)joystick_position_label,GTK_JUSTIFY_CENTER);
01911
01912 GtkWidget *joystick_position_hbox=gtk_hbox_new(FALSE, 5);
01913
01914 GtkWidget *joystick_X_label=gtk_label_new("X: --- [mm]");
01915 RobotVars->updt_labels.phantom_x_label=joystick_X_label;
01916
01917 GtkWidget *joystick_Y_label=gtk_label_new("Y: --- [mm]");
01918 RobotVars->updt_labels.phantom_y_label=joystick_Y_label;
01919
01920 GtkWidget *joystick_Z_label=gtk_label_new("Z: --- [mm]");
01921 RobotVars->updt_labels.phantom_z_label=joystick_Z_label;
01922
01923
01924 GtkWidget *joystick_pen_tip_position_label=gtk_label_new("PHANToM OMNI Pen Tip Coordinates:");
01925 gtk_label_set_justify((GtkLabel *)joystick_pen_tip_position_label,GTK_JUSTIFY_CENTER);
01926
01927 GtkWidget *joystick_pen_tip_position_hbox=gtk_hbox_new(FALSE, 5);
01928
01929 GtkWidget *joystick_pen_tip_X_label=gtk_label_new("X: --- [mm]");
01930 RobotVars->updt_labels.phantom_pen_tip_x_label=joystick_pen_tip_X_label;
01931
01932 GtkWidget *joystick_pen_tip_Y_label=gtk_label_new("Y: --- [mm]");
01933 RobotVars->updt_labels.phantom_pen_tip_y_label=joystick_pen_tip_Y_label;
01934
01935 GtkWidget *joystick_pen_tip_Z_label=gtk_label_new("Z: --- [mm]");
01936 RobotVars->updt_labels.phantom_pen_tip_z_label=joystick_pen_tip_Z_label;
01937
01938
01939 GtkWidget *joystick_speed_label=gtk_label_new("PHANToM OMNI Cartesian Speed:");
01940 gtk_label_set_justify((GtkLabel *)joystick_speed_label,GTK_JUSTIFY_CENTER);
01941
01942 GtkWidget *joystick_speed_hbox=gtk_hbox_new(FALSE, 5);
01943
01944 GtkWidget *joystick_speed_values_label=gtk_label_new("Magnitude: --- [mm/s] (---,---,---)");
01945 RobotVars->updt_labels.phantom_speed_label=joystick_speed_values_label;
01946
01947
01948 GtkWidget *joystick_joint_angles_label=gtk_label_new("PHANToM OMNI Joint Angles:");
01949 gtk_label_set_justify((GtkLabel *)joystick_joint_angles_label,GTK_JUSTIFY_CENTER);
01950
01951 GtkWidget *joystick_joint_angles_hbox=gtk_hbox_new(FALSE, 5);
01952
01953 GtkWidget *joystick_joint1_label=gtk_label_new(NULL);
01954 gtk_label_set_markup (GTK_LABEL (joystick_joint1_label),
01955 g_markup_printf_escaped ("\u03B8<sub>1</sub>: %s<sup>o</sup>", "0"));
01956 RobotVars->updt_labels.phantom_jnt1_label=joystick_joint1_label;
01957
01958 GtkWidget *joystick_joint2_label=gtk_label_new(NULL);
01959 gtk_label_set_markup (GTK_LABEL (joystick_joint2_label),
01960 g_markup_printf_escaped ("\u03B8<sub>2</sub>: %s<sup>o</sup>", "0"));
01961 RobotVars->updt_labels.phantom_jnt2_label=joystick_joint2_label;
01962
01963 GtkWidget *joystick_joint3_label=gtk_label_new(NULL);
01964 gtk_label_set_markup (GTK_LABEL (joystick_joint3_label),
01965 g_markup_printf_escaped ("\u03B8<sub>3</sub>: %s<sup>o</sup>", "0"));
01966 RobotVars->updt_labels.phantom_jnt3_label=joystick_joint3_label;
01967
01968 GtkWidget *joystick_gimbal_angles_label=gtk_label_new("PHANToM OMNI Gimbal Angles:");
01969 gtk_label_set_justify((GtkLabel *)joystick_gimbal_angles_label,GTK_JUSTIFY_CENTER);
01970
01971 GtkWidget *joystick_gimbal_angles_hbox=gtk_hbox_new(FALSE, 5);
01972
01973 GtkWidget *joystick_gimbal1_label=gtk_label_new(NULL);
01974 gtk_label_set_markup (GTK_LABEL (joystick_gimbal1_label),
01975 g_markup_printf_escaped ("\u03B8<sub>4</sub>: %s<sup>o</sup>", "0"));
01976 RobotVars->updt_labels.phantom_gbl1_label=joystick_gimbal1_label;
01977
01978 GtkWidget *joystick_gimbal2_label=gtk_label_new(NULL);
01979 gtk_label_set_markup (GTK_LABEL (joystick_gimbal2_label),
01980 g_markup_printf_escaped ("\u03B8<sub>5</sub>: %s<sup>o</sup>", "0"));
01981 RobotVars->updt_labels.phantom_gbl2_label=joystick_gimbal2_label;
01982
01983 GtkWidget *joystick_gimbal3_label=gtk_label_new(NULL);
01984 gtk_label_set_markup (GTK_LABEL (joystick_gimbal3_label),
01985 g_markup_printf_escaped ("\u03B8<sub>6</sub>: %s<sup>o</sup>", "0"));
01986 RobotVars->updt_labels.phantom_gbl3_label=joystick_gimbal3_label;
01987
01988 GtkWidget *motor_temp_label=gtk_label_new("PHANToM OMNI Motor Temperatures:\n[0...1] coolest to warmest");
01989 gtk_label_set_justify((GtkLabel *)motor_temp_label,GTK_JUSTIFY_CENTER);
01990
01991 GtkWidget *motor_temp_hbox=gtk_hbox_new(FALSE, 5);
01992
01993 GtkWidget *motor_temp_1_label=gtk_label_new("Motor 1: --- ");
01994 RobotVars->updt_labels.motor_1_temp=motor_temp_1_label;
01995 GtkWidget *motor_temp_2_label=gtk_label_new("Motor 2: --- ");
01996 RobotVars->updt_labels.motor_2_temp=motor_temp_2_label;
01997 GtkWidget *motor_temp_3_label=gtk_label_new("Motor 3: --- ");
01998 RobotVars->updt_labels.motor_3_temp=motor_temp_3_label;
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008 GtkWidget *image_humanoid=gtk_image_new();
02009
02010 string cmplt_img_path = ros::package::getPath("phua_haptic") + "/image/humanoid2.jpg";
02011 gtk_image_set_from_file((GtkImage *)image_humanoid,cmplt_img_path.c_str());
02012
02013
02014
02015
02016 GtkWidget *demo_workspace_limits_frame=gtk_frame_new(NULL);
02017 gtk_frame_set_shadow_type((GtkFrame *)demo_workspace_limits_frame,GTK_SHADOW_OUT);
02018 gtk_frame_set_label_align((GtkFrame *)demo_workspace_limits_frame,0.5,0.5);
02019 GtkWidget *label_demo_workspace_limits_TITLE=gtk_label_new(NULL);
02020 markup = g_markup_printf_escaped ("<span size=\"larger\"><u><b>%s</b></u></span>", "WORKSPACE LIMITS");
02021 gtk_label_set_markup (GTK_LABEL (label_demo_workspace_limits_TITLE), markup);
02022 gtk_frame_set_label_widget((GtkFrame *)demo_workspace_limits_frame, label_demo_workspace_limits_TITLE);
02023
02024 GtkWidget *vbox_demo_workspace_limits=gtk_vbox_new(FALSE, 3);
02025
02026 char description[] = "\
02027 This demonstration allows the user\n\
02028 to command a robot kinematic model\n\
02029 with the ability to feel the workspace \n\
02030 limits rendered as a force vector.\n\
02031 \n\
02032 The application renders an approach\n\
02033 force as the user reaches any one of\n\
02034 the workspace limit zones, and will\n\
02035 apply a step in force magnitude to\n\
02036 represent the end of the reachable\n\
02037 space for the selected kinematic\n\
02038 model.\n\
02039 \n\
02040 This demonstration attempts to\n\
02041 exemplify how an haptic interface can\n\
02042 be used to control humanoid/industrial \n\
02043 robots giving the user an enhanced\n\
02044 perception of the robots workspace\n\
02045 limitations.\n";
02046 GtkWidget *label_demo_workspace_limits_description=gtk_label_new(description);
02047 gtk_label_set_justify((GtkLabel *)label_demo_workspace_limits_description,GTK_JUSTIFY_LEFT);
02048
02049 GtkWidget *demo_workspace_limits_checkbox=gtk_check_button_new_with_label("\n\nSELECT WORKSPACE LIMITS DEMO\n\n");
02050
02051 RobotVars->updt_labels.demo1_checkbox = demo_workspace_limits_checkbox;
02052
02053
02054
02055 GtkWidget *demo_plane_drawing_frame=gtk_frame_new(NULL);
02056 gtk_frame_set_shadow_type((GtkFrame *)demo_plane_drawing_frame,GTK_SHADOW_OUT);
02057 gtk_frame_set_label_align((GtkFrame *)demo_plane_drawing_frame,0.5,0.5);
02058 GtkWidget *label_demo_plane_drawing_TITLE=gtk_label_new(NULL);
02059 markup = g_markup_printf_escaped ("<span size=\"larger\"><u><b>%s</b></u></span>", "UA SUMMER ACADEMY: DRAWING");
02060 gtk_label_set_markup (GTK_LABEL (label_demo_plane_drawing_TITLE), markup);
02061 gtk_frame_set_label_widget((GtkFrame *)demo_plane_drawing_frame, label_demo_plane_drawing_TITLE);
02062
02063 GtkWidget *vbox_demo_plane_drawing=gtk_vbox_new(FALSE, 3);
02064
02065 char description_2[] = "\
02066 This demonstration allows the user\n\
02067 to command a robot arm in order to\n\
02068 draw some lines on a vertical board.\n\
02069 \n\
02070 The user is able to determine the\n\
02071 plane equation by giving the input of\n\
02072 three points belonging to the board.\n\
02073 This plane will then be used to create\n\
02074 a planar force field that resembles\n\
02075 the board plane.\n\
02076 This force field is then used as a\n\
02077 reference object to try and draw\n\
02078 simple shapes.\n\
02079 \n\
02080 This demonstration attempts to show\n\
02081 how real world elements can be\n\
02082 virtualized as force fields in the\n\
02083 joystick workspace, allowing for a\n\
02084 better integration of the robot with\n\
02085 its surroundings.\n";
02086 GtkWidget *label_demo_plane_drawing_description=gtk_label_new(description_2);
02087 gtk_label_set_justify((GtkLabel *)label_demo_plane_drawing_description,GTK_JUSTIFY_LEFT);
02088
02089 GtkWidget *demo_plane_drawing_checkbox=gtk_check_button_new_with_label("\n\nSELECT PLANE DRAWING DEMO\n\n");
02090 gtk_toggle_button_set_active((GtkToggleButton *)demo_plane_drawing_checkbox, FALSE);
02091 RobotVars->updt_labels.demo2_checkbox = demo_plane_drawing_checkbox;
02092
02093
02094
02095 GtkWidget *demo_user_path_spring_force_frame=gtk_frame_new(NULL);
02096 gtk_frame_set_shadow_type((GtkFrame *)demo_user_path_spring_force_frame,GTK_SHADOW_OUT);
02097 gtk_frame_set_label_align((GtkFrame *)demo_user_path_spring_force_frame,0.5,0.5);
02098 GtkWidget *label_user_path_spring_force_TITLE=gtk_label_new(NULL);
02099 markup = g_markup_printf_escaped ("<span size=\"larger\"><u><b>%s</b></u></span>", "USER DEFINED PATH");
02100 gtk_label_set_markup (GTK_LABEL (label_user_path_spring_force_TITLE), markup);
02101 gtk_frame_set_label_widget((GtkFrame *)demo_user_path_spring_force_frame, label_user_path_spring_force_TITLE);
02102
02103 GtkWidget *vbox_demo_user_path_spring_force=gtk_vbox_new(FALSE, 3);
02104
02105 char description_3[] = "\
02106 This demonstration allows the user\n\
02107 to store a set of points in the\n\
02108 workspace of the kinematic model\n\
02109 selected and set to robot to keep \n\
02110 reproducing them over time.\n\
02111 \n\
02112 The user selects a point set to be\n\
02113 stored for reproduction by the robot.\n\
02114 The three dimensional points are then\n\
02115 executed in order running once or in\n\
02116 a loop.\n\
02117 \n\
02118 This demonstration is used to put\n\
02119 the robot executing defined paths,\n\
02120 for demonstration purposes.\n\
02121 \n";
02122 GtkWidget *label_demo_user_path_spring_force_description=gtk_label_new(description_3);
02123 gtk_label_set_justify((GtkLabel *)label_demo_user_path_spring_force_description,GTK_JUSTIFY_LEFT);
02124
02125
02126 GtkWidget *demo_user_path_spring_force_checkbox=gtk_check_button_new_with_label("\n\nSELECT USER PATH DEMO\n\n");
02127 gtk_toggle_button_set_active((GtkToggleButton *)demo_user_path_spring_force_checkbox, FALSE);
02128 RobotVars->updt_labels.demo3_checkbox = demo_user_path_spring_force_checkbox;
02129
02130
02131
02132
02133 GtkWidget *demo_detached_legs_balance_frame=gtk_frame_new(NULL);
02134 gtk_frame_set_shadow_type((GtkFrame *)demo_detached_legs_balance_frame,GTK_SHADOW_OUT);
02135 gtk_frame_set_label_align((GtkFrame *)demo_detached_legs_balance_frame,0.5,0.5);
02136
02137
02138 GtkWidget *label_detached_legs_balance_TITLE=gtk_label_new(NULL);
02139 markup = g_markup_printf_escaped ("<span size=\"larger\"><u><b>%s</b></u></span>", "LEG BALANCING");
02140 gtk_label_set_markup (GTK_LABEL (label_detached_legs_balance_TITLE), markup);
02141 gtk_frame_set_label_widget((GtkFrame *)demo_detached_legs_balance_frame, label_detached_legs_balance_TITLE);
02142
02143
02144
02145 GtkWidget *vbox_demo_detached_legs_balance=gtk_vbox_new(FALSE, 3);
02146
02147 char description_4[] = "\
02148 This demonstration allows the user \n\
02149 to control the detached leg while the\n\
02150 system monitors its centre-of-gravity\n\
02151 (COG).\n\
02152 \n\
02153 During the control loop, the system\n\
02154 will signal the user using the joystick\n\
02155 when the centre-of-gravity projection,\n\
02156 the centre-of-pressure (COP) leaves the\n\
02157 area of the robots foot.\n\
02158 \n\
02159 This demonstration attempts to show \n\
02160 the possiblity of using the haptic feed-\n\
02161 back to collect enriched data of for \n\
02162 teaching purposes.\n\
02163 \n";
02164 GtkWidget *label_demo_detached_legs_balance_description=gtk_label_new(description_4);
02165 gtk_label_set_justify((GtkLabel *)label_demo_detached_legs_balance_description,GTK_JUSTIFY_LEFT);
02166
02167
02168 GtkWidget *demo_detached_legs_balance_checkbox=gtk_check_button_new_with_label("\n\nSELECT LEG BALANCING DEMO\n\n");
02169 gtk_toggle_button_set_active((GtkToggleButton *)demo_detached_legs_balance_checkbox, FALSE);
02170 RobotVars->updt_labels.demo4_checkbox = demo_detached_legs_balance_checkbox;
02171
02172
02173
02174
02175
02176 g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(on_application_exit), RobotVars);
02177 g_signal_connect(G_OBJECT(button_quit), "clicked", G_CALLBACK(on_application_exit), RobotVars);
02178 g_signal_connect(G_OBJECT(notebook), "switch-page", G_CALLBACK(on_notebook_change_current_page), RobotVars);
02179
02180 g_signal_connect(G_OBJECT(menu_item_back_facing), "activate",G_CALLBACK(on_back_facing_menu_item_activate), RobotVars);
02181 g_signal_connect(G_OBJECT(menu_item_front_facing), "activate",G_CALLBACK(on_front_facing_menu_item_activate), RobotVars);
02182
02183 g_signal_connect(G_OBJECT(menu_item_quit), "activate",G_CALLBACK(on_application_exit), RobotVars);
02184 g_signal_connect(G_OBJECT(menu_item_about), "activate",G_CALLBACK(on_about_menu_item_activate), NULL);
02185 g_signal_connect(G_OBJECT(button_set_robot_home_pos), "clicked",G_CALLBACK(on_button_set_robot_home_pos_clicked),RobotVars);
02186 g_signal_connect(G_OBJECT(button_start_loop), "clicked",G_CALLBACK(on_button_start_loop_clicked), RobotVars);
02187 g_signal_connect(G_OBJECT(page1_left_top_frame_combobox), "changed",G_CALLBACK(on_page1_left_top_frame_combobox_changed_event),RobotVars);
02188 g_signal_connect(G_OBJECT(constant_speed_radio_checkbox), "toggled",G_CALLBACK(on_constant_speed_radio_checkbox_toggled), (gpointer) controled_speed_radio_checkbox);
02189 g_signal_connect(G_OBJECT(controled_speed_radio_checkbox), "toggled",G_CALLBACK(on_controled_speed_radio_checkbox_toggled), (gpointer) constant_speed_radio_checkbox);
02190 g_signal_connect(G_OBJECT(ajustament_hscale), "value-changed",G_CALLBACK(on_ajustament_hscale_value_changed_event),RobotVars);
02191 g_signal_connect(G_OBJECT(page2_select_id_combobox), "changed",G_CALLBACK(on_page2_select_id_combobox_for_position_changed_event), (gpointer) label_page_2_angle);
02192 g_signal_connect(G_OBJECT(button_release), "clicked",G_CALLBACK(on_button_release_all_clicked), RobotVars);
02193 g_signal_connect(G_OBJECT(button_go), "toggled",G_CALLBACK(on_button_go_toggled), RobotVars);
02194 g_signal_connect(G_OBJECT(button_stop), "toggled",G_CALLBACK(on_button_stop_toggled), RobotVars);
02195
02196 g_signal_connect(G_OBJECT(button_setpos), "clicked",G_CALLBACK(on_button_setpos_clicked),RobotVars);
02197 g_signal_connect(G_OBJECT(spinbutton_angle), "value-changed", G_CALLBACK(on_button_setpos_clicked), RobotVars);
02198
02199 g_signal_connect(G_OBJECT(button_set_pos_all), "clicked",G_CALLBACK(on_button_set_pos_all_clicked),RobotVars);
02200 g_signal_connect(G_OBJECT(button_setspeed), "clicked",G_CALLBACK(on_button_setspeed_clicked),RobotVars);
02201
02202 g_signal_connect(G_OBJECT(spinbutton_speed), "value-changed", G_CALLBACK(on_button_setspeed_clicked), RobotVars);
02203
02204 g_signal_connect(G_OBJECT(entry_pos_all), "activate", G_CALLBACK(on_button_set_pos_all_clicked), RobotVars);
02205 g_signal_connect(G_OBJECT(button_vbuttonbox_update_robot_data), "clicked",G_CALLBACK(on_button_vbuttonbox_update_robot_data_clicked),RobotVars);
02206 g_signal_connect(G_OBJECT(control_resolution_checkb_1mm), "toggled",G_CALLBACK(on_control_resolution_toggled), RobotVars);
02207 g_signal_connect(G_OBJECT(control_resolution_checkb_0_1mm), "toggled",G_CALLBACK(on_control_resolution_toggled), RobotVars);
02208 g_signal_connect(G_OBJECT(control_resolution_checkb_0_0_1mm), "toggled",G_CALLBACK(on_control_resolution_toggled), RobotVars);
02209 g_signal_connect(G_OBJECT(control_resolution_checkb_0_0_0_1mm), "toggled",G_CALLBACK(on_control_resolution_toggled), RobotVars);
02210 g_signal_connect(G_OBJECT(scale_1), "toggled",G_CALLBACK(on_workspace_scaling_toggled), RobotVars);
02211 g_signal_connect(G_OBJECT(scale_2), "toggled",G_CALLBACK(on_workspace_scaling_toggled), RobotVars);
02212 g_signal_connect(G_OBJECT(scale_3), "toggled",G_CALLBACK(on_workspace_scaling_toggled), RobotVars);
02213 g_signal_connect(G_OBJECT(scale_4), "toggled",G_CALLBACK(on_workspace_scaling_toggled), RobotVars);
02214 g_signal_connect(G_OBJECT(button_test_invkin), "clicked",G_CALLBACK(on_button_test_invkin_clicked),RobotVars);
02215
02216 g_signal_connect(G_OBJECT(spinbutton_invkin_X), "value-changed", G_CALLBACK(on_button_test_invkin_clicked),RobotVars);
02217 g_signal_connect(G_OBJECT(spinbutton_invkin_Y), "value-changed", G_CALLBACK(on_button_test_invkin_clicked),RobotVars);
02218 g_signal_connect(G_OBJECT(spinbutton_invkin_Z), "value-changed", G_CALLBACK(on_button_test_invkin_clicked),RobotVars);
02219
02220 g_signal_connect(G_OBJECT(select_inv_kin_combobox), "changed",G_CALLBACK(select_inv_kin_combobox_changed_event),RobotVars);
02221
02222 g_signal_connect(G_OBJECT(button_calibration), "clicked",G_CALLBACK(on_button_calibration_clicked),RobotVars);
02223 g_signal_connect(G_OBJECT(demo_workspace_limits_checkbox), "toggled",G_CALLBACK(on_demo_checkboxes_toggled), RobotVars);
02224 g_signal_connect(G_OBJECT(demo_plane_drawing_checkbox), "toggled",G_CALLBACK(on_demo_checkboxes_toggled), RobotVars);
02225 g_signal_connect(G_OBJECT(demo_user_path_spring_force_checkbox), "toggled",G_CALLBACK(on_demo_checkboxes_toggled), RobotVars);
02226 g_signal_connect(G_OBJECT(demo_detached_legs_balance_checkbox), "toggled",G_CALLBACK(on_demo_checkboxes_toggled), RobotVars);
02227
02228 g_signal_connect(G_OBJECT(user_path_demo_point_store_button), "clicked",G_CALLBACK(on_user_path_demo_point_store_button_clicked), RobotVars);
02229
02230 g_signal_connect(G_OBJECT(user_path_demo_run_once_checkbox), "toggled",G_CALLBACK(user_path_demo_run_checkbox_toggled), RobotVars);
02231 g_signal_connect(G_OBJECT(user_path_demo_run_loop_checkbox), "toggled",G_CALLBACK(user_path_demo_run_checkbox_toggled), RobotVars);
02232
02233 g_signal_connect(G_OBJECT(user_path_demo_run_button), "clicked",G_CALLBACK(on_user_path_demo_run_button_clicked), RobotVars);
02234 g_signal_connect(G_OBJECT(user_path_demo_clear_button), "clicked",G_CALLBACK(on_user_path_demo_clear_button_clicked), RobotVars);
02235
02236
02237
02238
02239
02240
02241 gtk_box_pack_start(GTK_BOX(vbox_phantom), page1_haptics_data_frame,TRUE, TRUE, 0);
02242 gtk_container_add(GTK_CONTAINER(page1_haptics_data_frame), vbox_haptic_information);
02243 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), hbox_workspace_interaction,TRUE, TRUE, 0);
02244 gtk_box_pack_start(GTK_BOX(hbox_workspace_interaction), label_workspace_interaction,TRUE, TRUE, 0);
02245
02246 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), hbox_drawing_demo,TRUE, TRUE, 0);
02247 gtk_box_pack_start(GTK_BOX(hbox_drawing_demo), label_drawing_demo,TRUE, TRUE, 0);
02248
02249 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), hbox_leg_balancing_demo,TRUE, TRUE, 0);
02250 gtk_box_pack_start(GTK_BOX(hbox_leg_balancing_demo), label_leg_balancing_cog_demo,TRUE, TRUE, 0);
02251
02252 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), hbox_user_path_demo,FALSE, FALSE, 0);
02253 gtk_box_pack_start(GTK_BOX(hbox_user_path_demo), label_user_path_demo,TRUE, TRUE, 0);
02254 gtk_box_pack_start(GTK_BOX(hbox_user_path_demo), user_path_demo_point_store_button,TRUE, TRUE, 0);
02255 gtk_box_pack_start(GTK_BOX(hbox_user_path_demo), vbox_user_path_run_options,TRUE, TRUE, 0);
02256
02257 gtk_box_pack_start(GTK_BOX(hbox_user_path_checkboxes), user_path_demo_run_once_checkbox,TRUE, TRUE, 0);
02258 gtk_box_pack_start(GTK_BOX(hbox_user_path_checkboxes), user_path_demo_run_loop_checkbox,TRUE, TRUE, 0);
02259 gtk_box_pack_start(GTK_BOX(vbox_user_path_run_options), user_path_demo_run_button,FALSE, FALSE, 0);
02260 gtk_box_pack_start(GTK_BOX(vbox_user_path_run_options), hbox_user_path_checkboxes,FALSE, FALSE, 0);
02261
02262 gtk_box_pack_start(GTK_BOX(hbox_user_path_demo), user_path_demo_clear_button,TRUE, TRUE, 0);
02263
02264
02265 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), gtk_hseparator_new(),FALSE, FALSE, 0);
02266 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), label_force_feedback,TRUE, TRUE, 0);
02267 gtk_box_pack_start(GTK_BOX(vbox_haptic_information), vbox_force_feedback,TRUE, TRUE, 0);
02268 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), hbox_haptic_x_force,TRUE, TRUE, 0);
02269 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), gtk_hseparator_new(), TRUE, TRUE, 0);
02270 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), hbox_haptic_y_force,TRUE, TRUE, 0);
02271 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), gtk_hseparator_new(), TRUE, TRUE, 0);
02272 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), hbox_haptic_z_force,TRUE, TRUE, 0);
02273 string max = "+ 3.3 N";
02274 string min = "- 3.3 N";
02275 gtk_box_pack_start(GTK_BOX(hbox_haptic_x_force), gtk_label_new(min.c_str()),TRUE, TRUE, 0);
02276 gtk_box_pack_start(GTK_BOX(hbox_haptic_x_force), x_neg_force_bar,TRUE, TRUE, 0);
02277 gtk_box_pack_start(GTK_BOX(hbox_haptic_x_force), label_x_force,TRUE, TRUE, 0);
02278 gtk_box_pack_start(GTK_BOX(hbox_haptic_x_force), x_force_bar,TRUE, TRUE, 0);
02279 gtk_box_pack_start(GTK_BOX(hbox_haptic_x_force), gtk_label_new(max.c_str()),TRUE, TRUE, 0);
02280 gtk_box_pack_start(GTK_BOX(hbox_haptic_y_force), gtk_label_new(min.c_str()),TRUE, TRUE, 0);
02281 gtk_box_pack_start(GTK_BOX(hbox_haptic_y_force), y_neg_force_bar,TRUE, TRUE, 0);
02282 gtk_box_pack_start(GTK_BOX(hbox_haptic_y_force), label_y_force,TRUE, TRUE, 0);
02283 gtk_box_pack_start(GTK_BOX(hbox_haptic_y_force), y_force_bar,TRUE, TRUE, 0);
02284 gtk_box_pack_start(GTK_BOX(hbox_haptic_y_force), gtk_label_new(max.c_str()),TRUE, TRUE, 0);
02285 gtk_box_pack_start(GTK_BOX(hbox_haptic_z_force), gtk_label_new(min.c_str()),TRUE, TRUE, 0);
02286 gtk_box_pack_start(GTK_BOX(hbox_haptic_z_force), z_neg_force_bar,TRUE, TRUE, 0);
02287 gtk_box_pack_start(GTK_BOX(hbox_haptic_z_force), label_z_force,TRUE, TRUE, 0);
02288 gtk_box_pack_start(GTK_BOX(hbox_haptic_z_force), z_force_bar,TRUE, TRUE, 0);
02289 gtk_box_pack_start(GTK_BOX(hbox_haptic_z_force), gtk_label_new(max.c_str()),TRUE, TRUE, 0);
02290 gtk_box_pack_start(GTK_BOX(vbox_force_feedback), label_force_magnitude,TRUE, TRUE, 0);
02291
02292 gtk_box_pack_start(GTK_BOX(vbox_phantom), page1_control_parameters_frame,TRUE, TRUE, 0);
02293 gtk_container_add(GTK_CONTAINER(page1_control_parameters_frame), vbox_control_parameters);
02294 gtk_box_pack_start(GTK_BOX(vbox_control_parameters), label_control_resolution,TRUE, TRUE, 0);
02295 gtk_box_pack_start(GTK_BOX(vbox_control_parameters), hbox_control_parameters,TRUE, TRUE, 0);
02296 gtk_box_pack_start(GTK_BOX(hbox_control_parameters), control_resolution_checkb_1mm,TRUE, TRUE, 0);
02297 gtk_box_pack_start(GTK_BOX(hbox_control_parameters), control_resolution_checkb_0_1mm,TRUE, TRUE, 0);
02298 gtk_box_pack_start(GTK_BOX(hbox_control_parameters), control_resolution_checkb_0_0_1mm,TRUE, TRUE, 0);
02299 gtk_box_pack_start(GTK_BOX(hbox_control_parameters), control_resolution_checkb_0_0_0_1mm,TRUE, TRUE, 0);
02300 gtk_box_pack_start(GTK_BOX(vbox_control_parameters), gtk_hseparator_new(), FALSE, FALSE, 0);
02301 gtk_box_pack_start(GTK_BOX(vbox_control_parameters), label_workspace_scale,TRUE, TRUE, 0);
02302 gtk_box_pack_start(GTK_BOX(vbox_control_parameters), hbox_workspace_scale,TRUE, TRUE, 0);
02303 gtk_box_pack_start(GTK_BOX(hbox_workspace_scale), scale_1,TRUE, TRUE, 0);
02304 gtk_box_pack_start(GTK_BOX(hbox_workspace_scale), scale_2,TRUE, TRUE, 0);
02305 gtk_box_pack_start(GTK_BOX(hbox_workspace_scale), scale_3,TRUE, TRUE, 0);
02306 gtk_box_pack_start(GTK_BOX(hbox_workspace_scale), scale_4,TRUE, TRUE, 0);
02307 gtk_container_add(GTK_CONTAINER(page1_middle_frame), vbox_phantom);
02308
02309 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), label_page_2_setpos,TRUE, TRUE, 0);
02310 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), page2_setpos_hbox,TRUE, TRUE, 0);
02311 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), page2_select_id_combobox,TRUE, TRUE, 0);
02312 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), gtk_vseparator_new(), TRUE, TRUE, 0);
02313 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), label_page_2_joint_angle,FALSE, FALSE, 0);
02314 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), spinbutton_angle,FALSE, FALSE, 0);
02315 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), label_page_2_angle,FALSE, FALSE, 0);
02316 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), gtk_vseparator_new(), TRUE, TRUE, 0);
02317 gtk_box_pack_start(GTK_BOX(page2_setpos_hbox), button_setpos,TRUE, TRUE, 0);
02318 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), gtk_hseparator_new(),TRUE, TRUE, 0);
02319 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), label_page_2_setspeed,TRUE, TRUE, 0);
02320 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), page2_setspeed_hbox,TRUE, TRUE, 0);
02321 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), page2_select_id_combobox2,TRUE, TRUE, 0);
02322 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), gtk_vseparator_new(), TRUE, TRUE, 0);
02323 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), label_page_2_speed_entry,FALSE, FALSE, 0);
02324 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), spinbutton_speed,FALSE, FALSE, 0);
02325 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), label_page_2_speed,FALSE, FALSE, 0);
02326 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), gtk_vseparator_new(), TRUE, TRUE, 0);
02327 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), button_setspeed,TRUE, TRUE, 0);
02328 gtk_box_pack_start(GTK_BOX(page2_setspeed_hbox), label_page_2_pos_read,TRUE, TRUE, 0);
02329 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), gtk_hseparator_new(),TRUE, TRUE, 0);
02330 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), label_page_2_set_pos_all,TRUE, TRUE, 0);
02331 gtk_box_pack_start(GTK_BOX(page2_set_pos_all_hbox), label_page_2_setposall, FALSE, FALSE, 0);
02332 gtk_box_pack_start(GTK_BOX(page2_set_pos_all_hbox), entry_pos_all, FALSE, FALSE, 0);
02333 gtk_box_pack_start(GTK_BOX(page2_set_pos_all_hbox), label_page_2_limits, FALSE, FALSE, 0);
02334 gtk_box_pack_start(GTK_BOX(page2_set_pos_all_hbox), gtk_vseparator_new(), TRUE, TRUE, 0);
02335 gtk_box_pack_start(GTK_BOX(page2_set_pos_all_hbox), button_set_pos_all,TRUE, TRUE, 0);
02336 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), page2_set_pos_all_hbox,TRUE, TRUE, 0);
02337 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), gtk_hseparator_new(),TRUE, TRUE, 0);
02338 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), label_page_2_invkin,TRUE, TRUE, 0);
02339 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), page2_invkin_hbox,TRUE, TRUE, 0);
02340
02341 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), select_inv_kin_combobox,TRUE, TRUE, 0);
02342
02343 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_invkin_X,TRUE, TRUE, 0);
02344
02345
02346 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), spinbutton_invkin_X,TRUE, TRUE, 0);
02347
02348 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_mm_1,TRUE, TRUE, 0);
02349 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), gtk_vseparator_new(),TRUE, TRUE, 0);
02350 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_invkin_Y,TRUE, TRUE, 0);
02351
02352
02353 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), spinbutton_invkin_Y,TRUE, TRUE, 0);
02354
02355 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_mm_2,TRUE, TRUE, 0);
02356 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), gtk_vseparator_new(),TRUE, TRUE, 0);
02357 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_invkin_Z,TRUE, TRUE, 0);
02358
02359
02360 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), spinbutton_invkin_Z,TRUE, TRUE, 0);
02361
02362 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), label_mm_3,TRUE, TRUE, 0);
02363 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), gtk_vseparator_new(),TRUE, TRUE, 0);
02364 gtk_box_pack_start(GTK_BOX(page2_invkin_hbox), button_test_invkin,TRUE, TRUE, 0);
02365
02366 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), gtk_hseparator_new(),TRUE, TRUE, 0);
02367 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), label_page_2_utils,TRUE, TRUE, 0);
02368 gtk_box_pack_start(GTK_BOX(page2_vbox_funcs), page2_utilities_hbox,TRUE, TRUE, 0);
02369 gtk_box_pack_start(GTK_BOX(page2_utilities_hbox), button_release,TRUE, TRUE, 0);
02370 gtk_box_pack_start(GTK_BOX(page2_utilities_hbox), button_go,TRUE, TRUE, 0);
02371 gtk_box_pack_end(GTK_BOX(page2_utilities_hbox), button_stop,TRUE, TRUE, 0);
02372 gtk_container_add(GTK_CONTAINER(page2_left_frame), page2_vbox_funcs);
02373 gtk_box_pack_start(GTK_BOX(page2_main_hbox), page2_left_frame,TRUE, TRUE, 0);
02374 gtk_box_pack_start(GTK_BOX(page2_main_hbox), page2_right_frame,TRUE, TRUE, 0);
02375
02376 gtk_container_add(GTK_CONTAINER(page2_right_frame), page2_vbox_phantom);
02377
02378 gtk_box_pack_start(GTK_BOX(page2_vbox_phantom), label_calibration, FALSE, FALSE, 0);
02379 gtk_box_pack_start(GTK_BOX(page2_vbox_phantom), button_calibration, TRUE, TRUE, 0);
02380
02381
02382 gtk_box_pack_start(GTK_BOX(page2_vbox_phantom), page2_joystick_raw_data_frame,TRUE, TRUE, 0);
02383 gtk_container_add(GTK_CONTAINER(page2_joystick_raw_data_frame), vbox_phantom_raw);
02384 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_position_label,TRUE, TRUE, 0);
02385 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_position_hbox,TRUE, TRUE, 0);
02386 gtk_box_pack_start(GTK_BOX(joystick_position_hbox), joystick_X_label,TRUE, TRUE, 0);
02387 gtk_box_pack_start(GTK_BOX(joystick_position_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02388 gtk_box_pack_start(GTK_BOX(joystick_position_hbox), joystick_Y_label,TRUE, TRUE, 0);
02389 gtk_box_pack_start(GTK_BOX(joystick_position_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02390 gtk_box_pack_start(GTK_BOX(joystick_position_hbox), joystick_Z_label,TRUE, TRUE, 0);
02391 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), gtk_hseparator_new(),TRUE, TRUE, 0);
02392
02393 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_pen_tip_position_label,TRUE, TRUE, 0);
02394 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_pen_tip_position_hbox,TRUE, TRUE, 0);
02395 gtk_box_pack_start(GTK_BOX(joystick_pen_tip_position_hbox), joystick_pen_tip_X_label,TRUE, TRUE, 0);
02396 gtk_box_pack_start(GTK_BOX(joystick_pen_tip_position_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02397 gtk_box_pack_start(GTK_BOX(joystick_pen_tip_position_hbox), joystick_pen_tip_Y_label,TRUE, TRUE, 0);
02398 gtk_box_pack_start(GTK_BOX(joystick_pen_tip_position_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02399 gtk_box_pack_start(GTK_BOX(joystick_pen_tip_position_hbox), joystick_pen_tip_Z_label,TRUE, TRUE, 0);
02400 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), gtk_hseparator_new(),TRUE, TRUE, 0);
02401
02402 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_speed_label,TRUE, TRUE, 0);
02403 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_speed_hbox,TRUE, TRUE, 0);
02404 gtk_box_pack_start(GTK_BOX(joystick_speed_hbox), joystick_speed_values_label,TRUE, TRUE, 0);
02405
02406 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), gtk_hseparator_new(),TRUE, TRUE, 0);
02407 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_joint_angles_label,TRUE, TRUE, 0);
02408 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_joint_angles_hbox,TRUE, TRUE, 0);
02409 gtk_box_pack_start(GTK_BOX(joystick_joint_angles_hbox), joystick_joint1_label,TRUE, TRUE, 0);
02410 gtk_box_pack_start(GTK_BOX(joystick_joint_angles_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02411 gtk_box_pack_start(GTK_BOX(joystick_joint_angles_hbox), joystick_joint2_label,TRUE, TRUE, 0);
02412 gtk_box_pack_start(GTK_BOX(joystick_joint_angles_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02413 gtk_box_pack_start(GTK_BOX(joystick_joint_angles_hbox), joystick_joint3_label,TRUE, TRUE, 0);
02414 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), gtk_hseparator_new(),TRUE, TRUE, 0);
02415 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_gimbal_angles_label,TRUE, TRUE, 0);
02416 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), joystick_gimbal_angles_hbox,TRUE, TRUE, 0);
02417 gtk_box_pack_start(GTK_BOX(joystick_gimbal_angles_hbox), joystick_gimbal1_label,TRUE, TRUE, 0);
02418 gtk_box_pack_start(GTK_BOX(joystick_gimbal_angles_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02419 gtk_box_pack_start(GTK_BOX(joystick_gimbal_angles_hbox), joystick_gimbal2_label,TRUE, TRUE, 0);
02420 gtk_box_pack_start(GTK_BOX(joystick_gimbal_angles_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02421 gtk_box_pack_start(GTK_BOX(joystick_gimbal_angles_hbox), joystick_gimbal3_label,TRUE, TRUE, 0);
02422 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), gtk_hseparator_new(),TRUE, TRUE, 0);
02423 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), motor_temp_label,TRUE, TRUE, 0);
02424 gtk_box_pack_start(GTK_BOX(vbox_phantom_raw), motor_temp_hbox,TRUE, TRUE, 0);
02425 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), motor_temp_1_label,TRUE, TRUE, 0);
02426 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02427 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), motor_temp_2_label,TRUE, TRUE, 0);
02428 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02429 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), motor_temp_3_label,TRUE, TRUE, 0);
02430 gtk_box_pack_start(GTK_BOX(motor_temp_hbox), gtk_vseparator_new(), FALSE, FALSE, 0);
02431
02432 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), label_coordinates,TRUE, TRUE, 0);
02433 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_X,TRUE, TRUE, 0);
02434 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02435 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_Y,TRUE, TRUE, 0);
02436 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02437 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_Z,TRUE, TRUE, 0);
02438 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02439 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_roll,TRUE, TRUE, 0);
02440 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02441 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_pitch,TRUE, TRUE, 0);
02442 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02443 gtk_box_pack_start(GTK_BOX(hbox_coordinates_left_arm), label_yaw,TRUE, TRUE, 0);
02444 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), hbox_coordinates_left_arm,TRUE, TRUE, 0);
02445 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), gtk_hseparator_new(),TRUE, TRUE, 0);
02446 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), label_coordinates_2,TRUE, TRUE, 0);
02447 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_X_2,TRUE, TRUE, 0);
02448 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02449 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_Y_right,TRUE, TRUE, 0);
02450 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02451 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_Z_right,TRUE, TRUE, 0);
02452 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02453 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_roll_right,TRUE, TRUE, 0);
02454 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02455 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_pitch_right,TRUE, TRUE, 0);
02456 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), gtk_vseparator_new(), FALSE, FALSE, 0);
02457 gtk_box_pack_start(GTK_BOX(hbox_coordinates_right_arm), label_yaw_right,TRUE, TRUE, 0);
02458 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), hbox_coordinates_right_arm,TRUE, TRUE, 0);
02459 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), gtk_hseparator_new(),TRUE, TRUE, 0);
02460 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), label_joint,TRUE, TRUE, 0);
02461 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), label_head,TRUE, TRUE, 0);
02462 gtk_box_pack_start(GTK_BOX(hbox_arm_jnts), label_right_arm,TRUE, TRUE, 0);
02463 gtk_box_pack_start(GTK_BOX(hbox_arm_jnts), gtk_vseparator_new(), FALSE, FALSE, 0);
02464 gtk_box_pack_start(GTK_BOX(hbox_arm_jnts), label_left_arm,TRUE, TRUE, 0);
02465 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), hbox_arm_jnts,TRUE, TRUE, 0);
02466 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), label_torso,TRUE, TRUE, 0);
02467 gtk_box_pack_start(GTK_BOX(hbox_leg_jnts), label_right_leg,TRUE, TRUE, 0);
02468 gtk_box_pack_start(GTK_BOX(hbox_leg_jnts), gtk_vseparator_new(), FALSE, FALSE, 0);
02469 gtk_box_pack_start(GTK_BOX(hbox_leg_jnts), label_left_leg,TRUE, TRUE, 0);
02470 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), hbox_leg_jnts,TRUE, TRUE, 0);
02471 gtk_box_pack_start(GTK_BOX(page1_left_top_frame_vbox), gtk_hseparator_new(),TRUE, TRUE, 0);
02472
02473 gtk_box_pack_start(GTK_BOX(page1_left_bottom_frame_vbox), constant_speed_radio_checkbox,TRUE, TRUE, 0);
02474 gtk_box_pack_start(GTK_BOX(page1_left_bottom_frame_vbox), hbox_scrll_lbl,TRUE, TRUE, 0);
02475 gtk_box_pack_start(GTK_BOX(hbox_scrll_lbl), label_speed_scale_bar,FALSE, FALSE, 0);
02476 gtk_box_pack_start(GTK_BOX(hbox_scrll_lbl), set_speed_hscale,TRUE, TRUE, 0);
02477 gtk_box_pack_start(GTK_BOX(page1_left_bottom_frame_vbox), controled_speed_radio_checkbox,TRUE, TRUE, 0);
02478 gtk_box_pack_start(GTK_BOX(hbox_prog_bars_auto_speed), arm_theta1_speed_prog_bar,TRUE, TRUE, 0);
02479 gtk_box_pack_start(GTK_BOX(hbox_prog_bars_auto_speed), arm_theta2_speed_prog_bar,TRUE, TRUE, 0);
02480 gtk_box_pack_start(GTK_BOX(hbox_prog_bars_auto_speed), arm_theta3_speed_prog_bar,TRUE, TRUE, 0);
02481 gtk_box_pack_start(GTK_BOX(page1_left_bottom_frame_vbox), hbox_prog_bars_auto_speed,TRUE, TRUE, 0);
02482 gtk_container_add(GTK_CONTAINER(page1_left_top_frame), page1_left_top_frame_vbox);
02483 gtk_container_add(GTK_CONTAINER(page1_left_bottom_frame), page1_left_bottom_frame_vbox);
02484 gtk_box_pack_start(GTK_BOX(notebook_vbox_left_page1), page1_left_top_frame,TRUE, TRUE, 0);
02485 gtk_box_pack_start(GTK_BOX(notebook_vbox_left_page1), page1_left_bottom_frame,TRUE, TRUE, 0);
02486 gtk_box_pack_start(GTK_BOX(page1_main_hbox), notebook_vbox_left_page1,TRUE, TRUE, 0);
02487 gtk_box_pack_start(GTK_BOX(page1_main_hbox), page1_middle_frame,TRUE, TRUE, 0);
02488
02489 gtk_box_pack_start(GTK_BOX(page1_main_vertbox), bottom_buttons_hbox,TRUE, TRUE, 0);
02490 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), button_start_loop,TRUE, TRUE, 0);
02491 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), gtk_vseparator_new(),FALSE, FALSE, 0);
02492 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), button_vbuttonbox_update_robot_data,TRUE, TRUE, 0);
02493 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), gtk_vseparator_new(),FALSE, FALSE, 0);
02494 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), button_set_robot_home_pos,TRUE, TRUE, 0);
02495 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), gtk_vseparator_new(),FALSE, FALSE, 0);
02496 gtk_box_pack_start(GTK_BOX(bottom_buttons_hbox), button_quit,TRUE, TRUE, 0);
02497
02498 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), demo_workspace_limits_frame ,TRUE, TRUE, 0);
02499 gtk_container_add(GTK_CONTAINER(demo_workspace_limits_frame), vbox_demo_workspace_limits);
02500 gtk_box_pack_start(GTK_BOX(vbox_demo_workspace_limits), label_demo_workspace_limits_description ,TRUE, TRUE, 0);
02501 gtk_box_pack_start(GTK_BOX(vbox_demo_workspace_limits), gtk_hseparator_new() ,FALSE, FALSE, 0);
02502 gtk_box_pack_start(GTK_BOX(vbox_demo_workspace_limits), demo_workspace_limits_checkbox ,FALSE, FALSE, 0);
02503 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), gtk_vseparator_new() , FALSE, FALSE, 0);
02504 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), demo_plane_drawing_frame ,TRUE, TRUE, 0);
02505 gtk_container_add(GTK_CONTAINER(demo_plane_drawing_frame), vbox_demo_plane_drawing);
02506 gtk_box_pack_start(GTK_BOX(vbox_demo_plane_drawing), label_demo_plane_drawing_description ,TRUE, TRUE, 0);
02507 gtk_box_pack_start(GTK_BOX(vbox_demo_plane_drawing), gtk_hseparator_new() ,FALSE, FALSE, 0);
02508 gtk_box_pack_start(GTK_BOX(vbox_demo_plane_drawing), demo_plane_drawing_checkbox ,FALSE, FALSE, 0);
02509 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), gtk_vseparator_new() , FALSE, FALSE, 0);
02510 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), demo_user_path_spring_force_frame ,TRUE, TRUE, 0);
02511 gtk_container_add(GTK_CONTAINER(demo_user_path_spring_force_frame), vbox_demo_user_path_spring_force);
02512 gtk_box_pack_start(GTK_BOX(vbox_demo_user_path_spring_force), label_demo_user_path_spring_force_description,TRUE, TRUE, 0);
02513 gtk_box_pack_start(GTK_BOX(vbox_demo_user_path_spring_force), gtk_hseparator_new() ,FALSE, FALSE, 0);
02514 gtk_box_pack_start(GTK_BOX(vbox_demo_user_path_spring_force), demo_user_path_spring_force_checkbox,FALSE, FALSE, 0);
02515 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), gtk_vseparator_new() , FALSE, FALSE, 0);
02516 gtk_box_pack_start(GTK_BOX(page3_main_hbox_arm_demos), demo_detached_legs_balance_frame ,TRUE, TRUE, 0);
02517 gtk_container_add(GTK_CONTAINER(demo_detached_legs_balance_frame), vbox_demo_detached_legs_balance);
02518 gtk_box_pack_start(GTK_BOX(vbox_demo_detached_legs_balance), label_demo_detached_legs_balance_description,TRUE, TRUE, 0);
02519 gtk_box_pack_start(GTK_BOX(vbox_demo_detached_legs_balance), gtk_hseparator_new() ,FALSE, FALSE, 0);
02520 gtk_box_pack_start(GTK_BOX(vbox_demo_detached_legs_balance), demo_detached_legs_balance_checkbox,FALSE, FALSE, 0);
02521
02522
02523
02524
02525
02526 gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, FALSE, 0);
02527 gtk_box_pack_start(GTK_BOX(main_vbox), notebook, TRUE, TRUE, 0);
02528 gtk_box_pack_end(GTK_BOX(main_vbox), statusbar, FALSE, TRUE, 1);
02529 gtk_container_add(GTK_CONTAINER(main_window), main_vbox);
02530
02531
02532
02533 on_page1_left_top_frame_combobox_changed_event((GtkWidget *)page1_left_top_frame_combobox,(gpointer)button_start_loop);
02534
02535 on_ajustament_hscale_value_changed_event((GtkAdjustment *)ajustament_hscale, (gpointer)RobotVars);
02536
02537 on_front_facing_menu_item_activate((GtkMenuItem *)menu_item_front_facing, (gpointer)RobotVars);
02538
02539
02540
02541
02542 gtk_widget_show_all(main_vbox);
02543 gtk_widget_show_all(main_window);
02544
02545
02546 on_controled_speed_radio_checkbox_toggled((GtkWidget *)controled_speed_radio_checkbox,(gpointer) constant_speed_radio_checkbox);
02547
02548 gtk_widget_set_visible((GtkWidget*)hbox_drawing_demo, FALSE);
02549 gtk_widget_set_visible((GtkWidget*)hbox_leg_balancing_demo, FALSE);
02550 gtk_widget_set_visible((GtkWidget*)hbox_user_path_demo, FALSE);
02551
02552
02553 g_timeout_add((1000/RobotVars->parameters.graphics_refresh_rate),update_watcher,RobotVars);
02554
02555 cout<<"* User interface built."<<endl;
02556
02557 gtk_main();
02558 RobotVars->parameters.exit_status = TRUE;
02559 g_free(markup);
02560 return NULL;
02561 }