@@ -148,7 +148,7 @@ def straight(self, distance: float, max_effort: float = 0.5, timeout: float = No
148148 # Secondary controller to keep encoder values in sync
149149 if secondary_controller is None :
150150 secondary_controller = PID (
151- kp = 0.25 , kd = 0.0025 ,
151+ kp = 0.025 , kd = 0.0025 ,
152152 )
153153
154154 if self .imu is not None :
@@ -166,7 +166,7 @@ def straight(self, distance: float, max_effort: float = 0.5, timeout: float = No
166166
167167 # PID for distance
168168 distanceError = distance - distTraveled
169- effort = main_controller .tick (distanceError )
169+ effort = main_controller .update (distanceError )
170170
171171 if main_controller .is_done () or time_out .is_done ():
172172 break
@@ -178,8 +178,8 @@ def straight(self, distance: float, max_effort: float = 0.5, timeout: float = No
178178 else :
179179 current_heading = ((rightDelta - leftDelta )/ 2 )* 360 / (self .track_width * math .pi )
180180
181- headingCorrection = secondary_controller .tick (initial_heading - current_heading )
182-
181+ headingCorrection = secondary_controller .update (initial_heading - current_heading )
182+
183183 self .set_effort (effort - headingCorrection , effort + headingCorrection )
184184
185185 time .sleep (0.01 )
@@ -243,7 +243,7 @@ def turn(self, turn_degrees: float, max_effort: float = 0.5, timeout: float = No
243243 # calculate encoder correction to minimize drift
244244 leftDelta = self .get_left_encoder_position () - startingLeft
245245 rightDelta = self .get_right_encoder_position () - startingRight
246- encoderCorrection = secondary_controller .tick (leftDelta + rightDelta )
246+ encoderCorrection = secondary_controller .update (leftDelta + rightDelta )
247247
248248 if use_imu and (self .imu is not None ):
249249 # calculate turn error (in degrees) from the imu
@@ -253,7 +253,7 @@ def turn(self, turn_degrees: float, max_effort: float = 0.5, timeout: float = No
253253 turnError = turn_degrees - ((rightDelta - leftDelta )/ 2 )* 360 / (self .track_width * math .pi )
254254
255255 # Pass the turn error to the main controller to get a turn speed
256- turnSpeed = main_controller .tick (turnError )
256+ turnSpeed = main_controller .update (turnError )
257257
258258 # exit if timeout or tolerance reached
259259 if main_controller .is_done () or time_out .is_done ():
0 commit comments