@@ -203,16 +203,16 @@ def straight(self, distance: float, max_effort: float = 0.5, timeout: float = No
203
203
return not time_out .is_done ()
204
204
205
205
206
- def turn (self , turn_degrees : float , max_effort : float = 0.5 , timeout : float = None , main_controller : Controller = None , secondary_controller : Controller = None , use_imu :bool = True ) -> bool :
206
+ def turn (self , turn_degrees : float , max_speed : float = 40 , timeout : float = None , main_controller : Controller = None , secondary_controller : Controller = None , use_imu :bool = True ) -> bool :
207
207
"""
208
208
Turn the robot some relative heading given in turnDegrees, and exit function when the robot has reached that heading.
209
209
Speed is bounded from -1 (turn counterclockwise the relative heading at full speed) to 1 (turn clockwise the relative heading at full speed)
210
210
Uses the IMU to determine the heading of the robot and P control for the motor controller.
211
211
212
212
:param turnDegrees: The number of angle for the robot to turn (In Degrees)
213
213
:type turnDegrees: float
214
- :param max_effort : The max effort for which the robot to travel (Bounded from -1 to 1) . Default is half effort forward .
215
- :type max_effort : float
214
+ :param max_speed : The max speed for each wheel of the robot to spin, in cm/s . Default is 40 cm/s .
215
+ :type max_speed : float
216
216
:param timeout: The amount of time before the robot stops trying to turn and continues to the next step (In Seconds)
217
217
:type timeout: float
218
218
:param main_controller: The main controller, for handling the angle turned
@@ -225,8 +225,8 @@ def turn(self, turn_degrees: float, max_effort: float = 0.5, timeout: float = No
225
225
:rtype: bool
226
226
"""
227
227
228
- if max_effort < 0 :
229
- max_effort *= - 1
228
+ if max_speed < 0 :
229
+ max_speed *= - 1
230
230
turn_degrees *= - 1
231
231
232
232
time_out = Timeout (timeout )
@@ -238,7 +238,7 @@ def turn(self, turn_degrees: float, max_effort: float = 0.5, timeout: float = No
238
238
kp = .015 ,
239
239
kd = 0.0012 ,
240
240
minOutput = 0.25 ,
241
- maxOutput = max_effort ,
241
+ maxOutput = max_speed ,
242
242
tolerance = 0.5 ,
243
243
toleranceCount = 3
244
244
)
@@ -273,7 +273,7 @@ def turn(self, turn_degrees: float, max_effort: float = 0.5, timeout: float = No
273
273
if main_controller .is_done () or time_out .is_done ():
274
274
break
275
275
276
- self .set_effort (- turnSpeed - encoderCorrection , turnSpeed - encoderCorrection )
276
+ self .set_speed (- turnSpeed - encoderCorrection , turnSpeed - encoderCorrection )
277
277
278
278
time .sleep (0.01 )
279
279
0 commit comments