@@ -61,7 +61,7 @@ def __init__(self, master):
6161 self .master = master
6262 self .master .title ('PID tuner Crazyflie' )
6363
64- self .figplot = plt .Figure (figsize = (5 , 4 ), dpi = 100 )
64+ self .figplot = plt .Figure (figsize = (2 , 1 ), dpi = 100 )
6565 self .ax2 = self .figplot .add_subplot (111 )
6666 self .line2 = FigureCanvasTkAgg (self .figplot , self .master )
6767 self .line2 .get_tk_widget ().pack (side = tk .TOP , fill = tk .BOTH , expand = 1 )
@@ -191,12 +191,12 @@ def send_pid_gains(self):
191191 'position PID controller: Kp: ' +
192192 str (self .pid_gui .scale_Kp .get ()) +
193193 ', Ki: ' + str (self .pid_gui .scale_Ki .get ()) +
194- ', Kd: ' + str (self .pid_gui .scale_Ki .get ()))
195- cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
194+ ', Kd: ' + str (self .pid_gui .scale_Kd .get ()))
195+ cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
196196 'Kp' , self .pid_gui .scale_Kp .get ())
197- cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
197+ cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
198198 'Ki' , self .pid_gui .scale_Ki .get ())
199- cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
199+ cf .param .set_value (self .unit_choice + 'CtlPid.' + self .axis_choice +
200200 'Kd' , self .pid_gui .scale_Kd .get ())
201201 cf .param .set_value ('posCtlPid.xVelMax' , self .pid_gui .scale_vMax .get ())
202202 cf .param .set_value ('posCtlPid.yVelMax' , self .pid_gui .scale_vMax .get ())
@@ -240,11 +240,11 @@ def do_step(self):
240240 # print(sp_history)
241241 self .pid_gui .draw_plot (time_history , pos_history , sp_history )
242242 if self .axis_choice == 'z' :
243- self .commander .go_to (0 , 0 , - 1 * STEP_SIZE , 0 , 1.0 , relative = True )
243+ self .commander .go_to (0 , 0 , - 1 * STEP_SIZE , 0 , 1.0 , relative = True )
244244 elif self .axis_choice == 'x' :
245- self .commander .go_to (- 1 * STEP_SIZE , 0 , 0 , 0 , 1.0 , relative = True )
245+ self .commander .go_to (- 1 * STEP_SIZE , 0 , 0 , 0 , 1.0 , relative = True )
246246 elif self .axis_choice == 'y' :
247- self .commander .go_to (0 , - 1 * STEP_SIZE , 0 , 0 , 1.0 , relative = True )
247+ self .commander .go_to (0 , - 1 * STEP_SIZE , 0 , 0 , 1.0 , relative = True )
248248 else :
249249 print ('WRONG CHOICE?!?!' )
250250 self .stop_gui ()
@@ -256,7 +256,7 @@ def stop_gui(self):
256256 # parameter update
257257 def change_param_axis_callback (self , value_axis ):
258258 #
259- print (self .unit_choice + 'CtlPid.' + value_axis )
259+ print (self .unit_choice + 'CtlPid.' + value_axis )
260260
261261 groupname = self .unit_choice + 'CtlPid'
262262 self .cf .param .remove_update_callback (
@@ -277,9 +277,9 @@ def change_param_axis_callback(self, value_axis):
277277 group = groupname , name = value_axis +
278278 'Kd' , cb = self .param_updated_callback_Kd )
279279
280- self .cf .param .request_param_update (groupname + '.' + value_axis + 'Kp' )
281- self .cf .param .request_param_update (groupname + '.' + value_axis + 'Ki' )
282- self .cf .param .request_param_update (groupname + '.' + value_axis + 'Kd' )
280+ self .cf .param .request_param_update (groupname + '.' + value_axis + 'Kp' )
281+ self .cf .param .request_param_update (groupname + '.' + value_axis + 'Ki' )
282+ self .cf .param .request_param_update (groupname + '.' + value_axis + 'Kd' )
283283 time .sleep (0.1 )
284284
285285 self .update_scale_info ()
@@ -311,13 +311,13 @@ def change_param_unit_callback(self, value_unit):
311311 group = groupname_new , name = self .axis_choice +
312312 'Kd' , cb = self .param_updated_callback_Kd )
313313
314- print (groupname_new + '.' + self .axis_choice + 'Kp' )
314+ print (groupname_new + '.' + self .axis_choice + 'Kp' )
315315 self .cf .param .request_param_update (
316- groupname_new + '.' + self .axis_choice + 'Kp' )
316+ groupname_new + '.' + self .axis_choice + 'Kp' )
317317 self .cf .param .request_param_update (
318- groupname_new + '.' + self .axis_choice + 'Ki' )
318+ groupname_new + '.' + self .axis_choice + 'Ki' )
319319 self .cf .param .request_param_update (
320- groupname_new + '.' + self .axis_choice + 'Kd' )
320+ groupname_new + '.' + self .axis_choice + 'Kd' )
321321 time .sleep (0.1 )
322322
323323 self .update_scale_info ()
0 commit comments