From: Chris S M. <gi...@gi...> - 2014-02-26 09:32:57
|
pncconf -fix live test bugs - openloop and stepper tune test tried on a real machine with the 5i25 http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=f8a6993 --- src/emc/usr_intf/pncconf/dialogs.glade | 133 +++++++++++++++++++++++++- src/emc/usr_intf/pncconf/pages.py | 46 ++++++--- src/emc/usr_intf/pncconf/pncconf.py | 17 ++-- src/emc/usr_intf/pncconf/tests.py | 166 +++++++++++++++------------------ 4 files changed, 246 insertions(+), 116 deletions(-) diff --git a/src/emc/usr_intf/pncconf/dialogs.glade b/src/emc/usr_intf/pncconf/dialogs.glade index 3306cd0..48c7ef0 100644 --- a/src/emc/usr_intf/pncconf/dialogs.glade +++ b/src/emc/usr_intf/pncconf/dialogs.glade @@ -45,6 +45,7 @@ <property name="invisible_char">●</property> <property name="adjustment">slow_dac_adjust</property> <property name="digits">2</property> + <signal name="value_changed" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -60,6 +61,7 @@ <property name="invisible_char">●</property> <property name="adjustment">fast_dac_adjust</property> <property name="digits">2</property> + <signal name="value_changed" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -90,6 +92,7 @@ <property name="receives_default">False</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <signal name="group_changed" handler="update_oloop_params"/> </object> <packing> <property name="top_attach">1</property> @@ -117,6 +120,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="pressed" handler="on_oloop_jogplus_pressed"/> + <signal name="released" handler="on_oloop_jogplus_released"/> <child> <object class="GtkImage" id="image4"> <property name="visible">True</property> @@ -135,6 +140,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="pressed" handler="on_oloop_jogminus_pressed"/> + <signal name="released" handler="on_oloop_jogminus_released"/> <child> <object class="GtkImage" id="image10"> <property name="visible">True</property> @@ -164,6 +171,7 @@ <property name="invisible_char">●</property> <property name="adjustment">dac_offset_adjust</property> <property name="digits">4</property> + <signal name="value_changed" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -200,6 +208,7 @@ <property name="invisible_char">●</property> <property name="adjustment">openloop_encoder_adjust</property> <property name="digits">3</property> + <signal name="value_changed" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -214,6 +223,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="pressed" handler="on_resetbutton_pressed"/> + <signal name="released" handler="on_resetbutton_released"/> </object> <packing> <property name="top_attach">11</property> @@ -226,6 +237,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="toggled" handler="on_oloop_enableamp_toggled"/> </object> <packing> <property name="top_attach">8</property> @@ -239,6 +251,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="draw_indicator">True</property> + <signal name="toggled" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -254,6 +267,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="draw_indicator">True</property> + <signal name="toggled" handler="update_oloop_params"/> </object> <packing> <property name="left_attach">1</property> @@ -349,7 +363,6 @@ <child> <object class="GtkTable" id="xtunepage"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="n_rows">10</property> <property name="n_columns">2</property> <child> @@ -384,6 +397,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_tuneinvertmotor_toggled"/> </object> <packing> <property name="left_attach">1</property> @@ -401,6 +415,8 @@ <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="pressed" handler="on_tune_jogminus_pressed"/> + <signal name="released" handler="on_tune_jogminus_released"/> <child> <object class="GtkImage" id="image6"> <property name="visible">True</property> @@ -421,6 +437,8 @@ <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="pressed" handler="on_tune_jogplus_pressed"/> + <signal name="released" handler="on_tune_jogplus_released"/> <child> <object class="GtkImage" id="image7"> <property name="visible">True</property> @@ -480,6 +498,14 @@ <child> <object class="GtkComboBox" id="xtunedir"> <property name="visible">True</property> + <property name="model">test_direction_store</property> + <signal name="changed" handler="on_update_tune_params"/> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> </object> <packing> <property name="expand">False</property> @@ -494,6 +520,7 @@ <property name="invisible_char">●</property> <property name="adjustment">tune_length_adjust</property> <property name="climb_rate">1</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="expand">False</property> @@ -544,6 +571,7 @@ <property name="can_focus">True</property> <property name="invisible_char">●</property> <property name="adjustment">tune_pause_adjust</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="expand">False</property> @@ -585,6 +613,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="toggled" handler="on_update_tune_params"/> <child> <object class="GtkHBox" id="hbox17"> <property name="visible">True</property> @@ -629,6 +658,7 @@ <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <signal name="toggled" handler="on_update_tune_params"/> <child> <object class="GtkHBox" id="hbox35"> <property name="visible">True</property> @@ -647,7 +677,6 @@ <child> <object class="GtkLabel" id="label486"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="label" translatable="yes">Run</property> <property name="use_underline">True</property> </object> @@ -702,6 +731,7 @@ <property name="invisible_char">●</property> <property name="adjustment">tune_accl_adjust</property> <property name="climb_rate">1</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="expand">False</property> @@ -739,6 +769,7 @@ <property name="invisible_char">●</property> <property name="adjustment">tune_vel_adjust</property> <property name="climb_rate">1</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="expand">False</property> @@ -971,6 +1002,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_p_adjust</property> <property name="digits">4</property> </object> <packing> @@ -985,6 +1017,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_i_adjust</property> <property name="digits">4</property> </object> <packing> @@ -999,6 +1032,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_d_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1013,6 +1047,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_ff0_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1027,6 +1062,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_ff1_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1041,6 +1077,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_ff2_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1099,6 +1136,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_bias_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1113,6 +1151,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">tune_deadband_adjust</property> <property name="digits">4</property> </object> <packing> @@ -1231,6 +1270,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">step_time_adjust</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="left_attach">1</property> @@ -1244,6 +1285,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">step_space_adjust</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="left_attach">1</property> @@ -1257,6 +1300,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">dir_hold_adjust</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="left_attach">1</property> @@ -1270,6 +1315,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="adjustment">dir_setup_adjust</property> + <signal name="value_changed" handler="on_update_tune_params"/> </object> <packing> <property name="left_attach">1</property> @@ -2686,21 +2733,24 @@ <property name="step_increment">1</property> </object> <object class="GtkAdjustment" id="fast_dac_adjust"> + <property name="value">1</property> <property name="upper">100</property> <property name="step_increment">1</property> </object> <object class="GtkAdjustment" id="slow_dac_adjust"> + <property name="value">0.5</property> <property name="upper">100</property> - <property name="step_increment">1</property> + <property name="step_increment">0.25</property> </object> <object class="GtkAdjustment" id="dac_offset_adjust"> <property name="lower">-100</property> <property name="upper">100</property> - <property name="step_increment">1</property> </object> <object class="GtkAdjustment" id="openloop_encoder_adjust"> + <property name="value">1000</property> + <property name="lower">1</property> <property name="upper">100000</property> - <property name="step_increment">0.97999999999999998</property> + <property name="step_increment">100</property> </object> <object class="GtkAdjustment" id="tune_vel_adjust"> <property name="upper">6000</property> @@ -2718,4 +2768,77 @@ <property name="upper">15</property> <property name="step_increment">1</property> </object> + <object class="GtkAdjustment" id="step_time_adjust"> + <property name="value">1000</property> + <property name="lower">100</property> + <property name="upper">5000</property> + <property name="step_increment">10</property> + </object> + <object class="GtkAdjustment" id="step_space_adjust"> + <property name="value">1000</property> + <property name="lower">100</property> + <property name="upper">5000</property> + <property name="step_increment">10</property> + </object> + <object class="GtkAdjustment" id="dir_hold_adjust"> + <property name="value">1000</property> + <property name="lower">100</property> + <property name="upper">5000</property> + <property name="step_increment">10</property> + </object> + <object class="GtkAdjustment" id="dir_setup_adjust"> + <property name="value">1000</property> + <property name="lower">100</property> + <property name="upper">5000</property> + <property name="step_increment">10</property> + </object> + <object class="GtkListStore" id="test_direction_store"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">±</col> + </row> + <row> + <col id="0" translatable="yes">+</col> + </row> + <row> + <col id="0" translatable="yes">-</col> + </row> + </data> + </object> + <object class="GtkAdjustment" id="tune_p_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_i_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_d_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_ff0_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_ff1_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_ff2_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_bias_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> + <object class="GtkAdjustment" id="tune_deadband_adjust"> + <property name="upper">6000</property> + <property name="step_increment">1</property> + </object> </interface> diff --git a/src/emc/usr_intf/pncconf/pages.py b/src/emc/usr_intf/pncconf/pages.py index 23ed335..b83c4f4 100644 --- a/src/emc/usr_intf/pncconf/pages.py +++ b/src/emc/usr_intf/pncconf/pages.py @@ -74,8 +74,8 @@ class Pages: name,text,init_state,state = self._p.available_page[u] dbg( "FWD search %s,%s,%s,%s,%s,of %d pages"%(u,name,text,init_state,state,len(self._p.available_page)-1)) if state and not init_state: - dbg( 'Loading page %s'%name) self.set_buttons_sensitive(0,0) + dbg( 'Loading page %s'%name) self.a.builder.add_from_file(os.path.join(self._p.DATADIR, '%s.glade'%name)) page = self.a.builder.get_object(name) self.w.notebook1.remove_page(u) #remove place holding page @@ -1226,19 +1226,41 @@ different program to copy to your configuration file.\nThe edited program will b self.a.clean_unused_ports() self.a.buid_config() #************** -# stepper test +# tune test +#************** + # callbacks + def on_update_tune_params(self, *args): + self.t.update_tune_test_params() + def on_tune_jogminus_pressed(self, w): + self.t.tune_jogminus(1) + def on_tune_jogminus_released(self, w): + self.t.tune_jogminus(0) + def on_tune_jogplus_pressed(self, w): + self.t.tune_jogplus(1) + def on_tune_jogplus_released(self, w): + self.t.tune_jogplus(0) + def on_tuneinvertmotor_toggled(self,w): + self.t.toggle_tuneinvertmotor() +#************** +# openloop test #************** # callbacks - def on_update_axis_params(self, *args): - self.a.update_axis_params() - def on_jogminus_pressed(self, w): - self.a.jogminus_pressed() - def on_jogminus_released(self, w): - self.a.jogminus_released() - def on_jogplus_pressed(self, w): - self.a.jogplus_pressed() - def on_jogplus_released(self, w): - self.a.jogplus_released() + def update_oloop_params(self, w): + self.t.update_axis_params() + def on_oloop_enableamp_toggled(self, w): + self.t.oloop_enableamp() + def on_oloop_jogminus_pressed(self, w): + self.t.oloop_jogminus(1) + def on_oloop_jogminus_released(self, w): + self.t.oloop_jogminus(0) + def on_oloop_jogplus_pressed(self, w): + self.t.oloop_jogplus(1) + def on_oloop_jogplus_released(self, w): + self.t.oloop_jogplus(0) + def on_resetbutton_pressed(self, w): + self.t.oloop_resetencoder(1) + def on_resetbutton_released(self, w): + self.t.oloop_resetencoder(0) # BOILER CODE def __getitem__(self, item): diff --git a/src/emc/usr_intf/pncconf/pncconf.py b/src/emc/usr_intf/pncconf/pncconf.py index 3ca5975..54cd8f9 100755 --- a/src/emc/usr_intf/pncconf/pncconf.py +++ b/src/emc/usr_intf/pncconf/pncconf.py @@ -665,8 +665,6 @@ class Data: self[temp+"comptype"]= 0 self[temp+"usebacklash"]= 0 self[temp+"backlash"]= 0 - self[temp+"maxvel"]= 1.667 - self[temp+"maxacc"]= 2 self[temp+"invertmotor"]= 0 self[temp+"invertencoder"]= 0 self[temp+"3pwmscale"]= 1 @@ -687,21 +685,14 @@ class Data: self[temp+"stepspace"]= 1000 self[temp+"dirhold"]= 1000 self[temp+"dirsetup"]= 1000 - self[temp+"minferror"]= .0005 - self[temp+"maxferror"]= .005 self[temp+"homepos"]= 0 - self[temp+"minlim"]= 0 - self[temp+"maxlim"]= 8 self[temp+"homesw"]= 0 - self[temp+"homesearchvel"]= .05 - self[temp+"homelatchvel"]= .025 self[temp+"homefinalvel"]= 0 self[temp+"latchdir"]= 0 self[temp+"searchdir"]= 0 self[temp+"usehomeindex"]= 0 self[temp+"stepscale"]= 0 self[temp+"encoderscale"]= 0 - self[temp+"bldc_option"]= False self[temp+"bldc_config"]= "" self[temp+"bldc_no_feedback"]= False @@ -749,6 +740,10 @@ class Data: self[i+'maxvel'] = 1 self[i+'maxacc'] = 30 self[i+'homevel'] = .05 + self[i+"homesearchvel"]= .05 + self[i+"homelatchvel"]= .025 + self[i+"minferror"]= .05 + self[i+"maxferror"]= .5 if not i == 'z': self[i+'minlim'] = 0 self[i+'maxlim'] = 8 @@ -760,6 +755,10 @@ class Data: self[i+'maxvel'] = 25 self[i+'maxacc'] = 750 self[i+'homevel'] = 1.5 + self[i+"homesearchvel"]= 1 + self[i+"homelatchvel"]= .5 + self[i+"minferror"]= 1 + self[i+"maxferror"]= 10 if not i =='z': self[i+'minlim'] = 0 self[i+'maxlim'] = 200 diff --git a/src/emc/usr_intf/pncconf/tests.py b/src/emc/usr_intf/pncconf/tests.py index f35e636..832c966 100644 --- a/src/emc/usr_intf/pncconf/tests.py +++ b/src/emc/usr_intf/pncconf/tests.py @@ -40,7 +40,7 @@ class TESTS: def parporttest(self,w): if not self.a.check_for_rt(self): return - panelname = os.path.join(self._p.DISTDIR, "configurable_options/pyvcp") + panelname = os.path.join(_PD.DISTDIR, "configurable_options/pyvcp") self.halrun = halrun = os.popen("cd %(panelname)s\nhalrun -Is > /dev/null"% {'panelname':panelname,}, "w" ) halrun.write("loadrt threads period1=100000 name1=fast fp1=0 period2=%d name2=slow\n"% self.d.servoperiod) self.hal_cmnds("LOAD") @@ -88,7 +88,7 @@ class TESTS: def testpanel(self,w): pos = "+0+0" size = "" - panelname = os.path.join(self._p.DISTDIR, "configurable_options/pyvcp") + panelname = os.path.join(_PD.DISTDIR, "configurable_options/pyvcp") if self.w.pyvcpblank.get_active() == True: return True if self.w.pyvcp1.get_active() == True: @@ -121,7 +121,7 @@ class TESTS: if not self.w.createconfig.get_active() and self.w.gladeexists.get_active(): folder = os.path.expanduser("~/linuxcnc/configs/%s" % self.d.machinename) if not os.path.exists(folder + "/gvcp-panel.ui"): - self.warning_dialog (_("""You specified there is an existing gladefile, \ + self.a.warning_dialog (_("""You specified there is an existing gladefile, \ But there is not one in the machine-named folder.."""),True) return self.gladevcptestpanel(self) @@ -360,7 +360,7 @@ But there is not one in the machine-named folder.."""),True) # for classicladder test def load_ladder(self,w): - newfilename = os.path.join(self._p.DISTDIR, "configurable_options/ladder/TEMP.clp") + newfilename = os.path.join(_PD.DISTDIR, "configurable_options/ladder/TEMP.clp") self.d.modbus = self.w.modbus.get_active() self.halrun = halrun = os.popen("halrun -Is > /dev/null", "w") if debug: @@ -402,7 +402,7 @@ But there is not one in the machine-named folder.."""),True) self.d.laddername='custom.clp' originalfile = filename = os.path.expanduser("~/linuxcnc/configs/%s/custom.clp" % self.d.machinename) else: - filename = os.path.join(self._p.DISTDIR, "configurable_options/ladder/"+ self.d.laddername) + filename = os.path.join(_PD.DISTDIR, "configurable_options/ladder/"+ self.d.laddername) if self.d.modbus == True: halrun.write("loadusr -w classicladder --modmaster --newpath=%(newname)s %(filename)s\n" % {'newname':newfilename,'filename':filename}) else: @@ -447,7 +447,7 @@ But there is not one in the machine-named folder.."""),True) w.xstep.set_sensitive(0) w.xsteptable.set_sensitive(0) text = _("Servo tuning is not avaiable in PNCconf yet\n") - self.warning_dialog(text,True) + self.a.warning_dialog(text,True) return if axis == "a": @@ -638,7 +638,7 @@ But there is not one in the machine-named folder.."""),True) w[axis+"FF2"].set_value( get_value(w.xtunecurrentFF2)) w[axis+"bias"].set_value( get_value(w.xtunecurrentbias)) w[axis+"deadband"].set_value( get_value(w.xtunecurrentdeadband)) - w[axis+"tunecurrentbias"].set_value(w.xbias.get_value()) + w[axis+"bias"].set_value(w.xtunecurrentbias.get_value()) w[axis+"steptime"].set_value(get_value(w.xtunecurrentsteptime)) w[axis+"stepspace"].set_value(get_value(w.xtunecurrentstepspace)) w[axis+"dirhold"].set_value(get_value(w.xtunecurrentdirhold)) @@ -650,20 +650,20 @@ But there is not one in the machine-named folder.."""),True) halrun.close() self.w['window1'].set_sensitive(1) - def update_tune_axis_params(self, *args): + def update_tune_test_params(self, *args): axis = self.axis_under_tune if axis is None or not self.updaterunning: return - temp = not self.w[axis+"tunerun"].get_active() - self.w[axis+"tuneinvertmotor"].set_sensitive( temp) - self.w[axis+"tuneamplitude"].set_sensitive( temp) - self.w[axis+"tunedir"].set_sensitive( temp) - self.w[axis+"tunejogminus"].set_sensitive(temp) - self.w[axis+"tunejogplus"].set_sensitive(temp) - temp = self.w[axis+"tuneenable"].get_active() - if not self.w[axis+"tunerun"].get_active(): - self.w[axis+"tunejogminus"].set_sensitive(temp) - self.w[axis+"tunejogplus"].set_sensitive(temp) - self.w[axis+"tunerun"].set_sensitive(temp) + temp = not self. w.xtunerun.get_active() + self.w.xtuneinvertmotor.set_sensitive( temp) + self.w.xtuneamplitude.set_sensitive( temp) + self.w.xtunedir.set_sensitive( temp) + self.w.xtunejogminus.set_sensitive(temp) + self.w.xtunejogplus.set_sensitive(temp) + temp = self.w.xtuneenable.get_active() + if not self.w.xtunerun.get_active(): + self.w.xtunejogminus.set_sensitive(temp) + self.w.xtunejogplus.set_sensitive(temp) + self.w.xtunerun.set_sensitive(temp) halrun = self.halrun if self.stepgen: halrun.write(""" @@ -686,22 +686,22 @@ But there is not one in the machine-named folder.."""),True) sets estop-out %(estop)s """ % { 'scale':self.scale, - 'len':self.w[axis+"tunecurrentsteptime"].get_value(), - 'space':self.w[axis+"tunecurrentstepspace"].get_value(), - 'hold':self.w[axis+"tunecurrentdirhold"].get_value(), - 'setup':self.w[axis+"tunecurrentdirsetup"].get_value(), + 'len':self.w.xtunecurrentsteptime.get_value(), + 'space':self.w.xtunecurrentstepspace.get_value(), + 'hold':self.w.xtunecurrentdirhold.get_value(), + 'setup':self.w.xtunecurrentdirsetup.get_value(), 'stepgen': self.step_signalname, 'jogminus': self.tunejogminus, 'jogplus': self.tunejogplus, - 'run': self.w[axis+"tunerun"].get_active(), - 'amplitude': self.w[axis+"tuneamplitude"].get_value(), - 'accel': self.w[axis+"tuneacc"].get_value(), - 'vel': self.w[axis+"tunevel"].get_value(), - 'velps': (self.w[axis+"tunevel"].get_value()/60), - 'dir': self.w[axis+"tunedir"].get_active(), - 'pause':int(self.w[axis+"tunepause"].get_value()), - 'enable':self.w[axis+"tuneenable"].get_active(), - 'estop':(self.w[axis+"tuneenable"].get_active()) + 'run': self.w.xtunerun.get_active(), + 'amplitude': self.w.xtuneamplitude.get_value(), + 'accel': self.w.xtuneacc.get_value(), + 'vel': self.w.xtunevel.get_value(), + 'velps': (self.w.xtunevel.get_value()/60), + 'dir': self.w.xtunedir.get_active(), + 'pause':int(self.w.xtunepause.get_value()), + 'enable':self.w.xtuneenable.get_active(), + 'estop':(self.w.xtuneenable.get_active()) }) else: halrun.write(""" @@ -724,49 +724,45 @@ But there is not one in the machine-named folder.."""),True) setp steptest.0.pause %(pause)d sets enable %(enable)s """ % { - 'p':self.w[axis+"tunecurrentP"].get_value(), - 'i':self.w[axis+"tunecurrentI"].get_value(), - 'd':self.w[axis+"tunecurrentD"].get_value(), - 'ff0':self.w[axis+"tunecurrentFF0"].get_value(), - 'ff1':self.w[axis+"tunecurrentFF1"].get_value(), - 'ff2':self.w[axis+"tunecurrentFF2"].get_value(), - 'bias':self.w[axis+"tunecurrentbias"].get_value(), - 'deadband':self.w[axis+"tunecurrentdeadband"].get_value(), - 'invert':self.w[axis+"tuneinvertmotor"].get_active(), + 'p':self.w.xtunecurrentP.get_value(), + 'i':self.w.xtunecurrentI.get_value(), + 'd':self.w.xtunecurrentD.get_value(), + 'ff0':self.w.xtunecurrentFF0.get_value(), + 'ff1':self.w.xtunecurrentFF1.get_value(), + 'ff2':self.w.xtunecurrentFF2.get_value(), + 'bias':self.w.xtunecurrentbias.get_value(), + 'deadband':self.w.xtunecurrentdeadband.get_value(), + 'invert':self.w.xtuneinvertmotor.get_active(), 'jogminus': self.tunejogminus, 'jogplus': self.tunejogplus, - 'run': self.w[axis+"tunerun"].get_active(), - 'amplitude': self.w[axis+"tuneamplitude"].get_value(), - 'accel': self.w[axis+"tuneacc"].get_value(), - 'vel': self.w[axis+"tunevel"].get_value(), - 'velps': (self.w[axis+"tunevel"].get_value()/60), - 'dir': self.w[axis+"tunedir"].get_active(), - 'pause':int(self.w[axis+"tunepause"].get_value()), - 'enable':self.w[axis+"tuneenable"].get_active() + 'run': self.w.xtunerun.get_active(), + 'amplitude': self.w.xtuneamplitude.get_value(), + 'accel': self.w.xtuneacc.get_value(), + 'vel': self.w.xtunevel.get_value(), + 'velps': (self.w.xtunevel.get_value()/60), + 'dir': self.w.xtunedir.get_active(), + 'pause':int(self.w.xtunepause.get_value()), + 'enable':self.w.xtuneenable.get_active() }) halrun.flush() - def on_tunejogminus_pressed(self, w): - self.tunejogminus = 1 - self.update_tune_axis_params() - def on_tunejogminus_released(self, w): - self.tunejogminus = 0 - self.update_tune_axis_params() - def on_tunejogplus_pressed(self, w): - self.tunejogplus = 1 - self.update_tune_axis_params() - def on_tunejogplus_released(self, w): - self.tunejogplus = 0 - self.update_tune_axis_params() + def tune_jogminus(self, direction): + self.tunejogminus = direction + self.update_tune_test_params() + def tune_jogplus(self, direction): + self.tunejogplus = direction + self.update_tune_test_params() # TODO fix scaling for servos: - def on_tuneinvertmotor_toggled(self, w): + def toggle_tuneinvertmotor(self): + def get_value(d): + return self.a.get_value(d) axis = self.axis_under_tune w = self.w - if w[axis+"tuneinvertmotor"].get_active(): + if w.xtuneinvertmotor.get_active(): self.scale = get_value(w[axis + "stepscale"]) * -1 else: self.scale = get_value(w[axis + "stepscale"]) - self.update_tune_axis_params() + self.update_tune_test_params() # openloop servo test def test_axis(self, axis): @@ -787,14 +783,16 @@ But there is not one in the machine-named folder.."""),True) if axis == "s": if (not self.pwm and not self.pot) and (not self.enc and not self.res): - self.warning_dialog( _(" You must designate a ENCODER / RESOLVER signal and an ANALOG SPINDLE signal for this axis test") , True) + self.a.warning_dialog( _(" You must designate a ENCODER / RESOLVER signal and an ANALOG SPINDLE signal for this axis test") , True) return else: if not self.pwm or (not self.enc and not self.res) : - self.warning_dialog( _(" You must designate a ENCODER / RESOLVER signal and a PWM signal for this axis test") , True) + self.a.warning_dialog( _(" You must designate a ENCODER / RESOLVER signal and a PWM signal for this axis test") , True) return - self.halrun = halrun = os.popen("halrun -Is > /dev/null", "w") + self.halrun = halrun = os.popen("halrun -Is > /dev/null", "w") + if debug: + halrun.write("echo\n") data = self.d widgets = self.w axnum = "xyzas".index(axis) @@ -921,6 +919,8 @@ But there is not one in the machine-named folder.."""),True) self.w['window1'].set_sensitive(1) def update_axis_params(self, *args): + def get_value(d): + return self.a.get_value(d) axis = self.axis_under_test if axis is None: return halrun = self.halrun @@ -965,32 +965,18 @@ But there is not one in the machine-named folder.."""),True) halrun.write("sets dir-not true\n") halrun.flush() - def jogminus_pressed(self, w): - self.jogminus = 1 + def oloop_jogminus(self, direction): + self.jogminus = direction self.update_axis_params() - def jogminus_released(self, w): - self.jogminus = 0 - self.update_axis_params() - def jogplus_pressed(self, w): - self.jogplus = 1 - self.update_axis_params() - def jogplus_released(self, w): - self.jogplus = 0 + def oloop_jogplus(self, direction): + self.jogplus = direction self.update_axis_params() - def on_resetbutton_pressed(self, w): - self.enc_reset = self.res_reset = 1 - self.update_axis_params() - def on_resetbutton_released(self, w): - self.enc_reset = self.res_reset = 0 - self.update_axis_params() - def on_testinvertmotor_toggled(self, w): + def oloop_resetencoder(self, state): + self.enc_reset = self.res_reset = state self.update_axis_params() - def on_testinvertencoder_toggled(self, w): - self.update_axis_params() - def on_testoutputoffset_value_changed(self, w): - self.update_axis_params() - def on_enableamp_toggled(self, w): + + def oloop_enableamp(self): self.enable_amp = self.enable_amp * -1 + 1 self.w.jogminus.set_sensitive(self.enable_amp) self.w.jogplus.set_sensitive(self.enable_amp) @@ -1058,7 +1044,7 @@ But there is not one in the machine-named folder.."""),True) port = 0 for channel in range (0,self.d["mesa%d_currentfirmwaredata"% boardnum][_PD._MAXSSERIALCHANNELS]): if channel >4: break # TODO only have 5 channels worth of glade widgets - for pin in range (0,self._p._SSCOMBOLEN): + for pin in range (0,_PD._SSCOMBOLEN): pname = 'mesa%dsserial%d_%dpin%d' % (boardnum,port,channel,pin) p = self.d['mesa%dsserial%d_%dpin%d' % (boardnum,port,channel,pin)] i = self.d['mesa%dsserial%d_%dpin%dinv' % (boardnum,port,channel,pin)] |