@@ -75,7 +75,7 @@ def get_right_encoder_position(self) -> float:
75
75
return self .right_motor .get_position ()
76
76
77
77
78
- def straight (self , distance : float , speed : float = 0.5 , timeout : float = None , main_controller : Controller = None , secondary_controller : Controller = None ) -> bool :
78
+ def straight (self , distance : float , max_effort : float = 0.5 , timeout : float = None , main_controller : Controller = None , secondary_controller : Controller = None ) -> bool :
79
79
"""
80
80
Go forward the specified distance in centimeters, and exit function when distance has been reached.
81
81
Speed is bounded from -1 (reverse at full speed) to 1 (forward at full speed)
@@ -95,7 +95,7 @@ def straight(self, distance: float, speed: float = 0.5, timeout: float = None, m
95
95
"""
96
96
# ensure distance is always positive while speed could be either positive or negative
97
97
if distance < 0 :
98
- speed *= - 1
98
+ max_effort *= - 1
99
99
distance *= - 1
100
100
101
101
time_out = Timeout (timeout )
@@ -107,7 +107,7 @@ def straight(self, distance: float, speed: float = 0.5, timeout: float = None, m
107
107
main_controller = PID (
108
108
kp = 0.5 ,
109
109
minOutput = 0.12 ,
110
- maxOutput = speed ,
110
+ maxOutput = max_effort ,
111
111
tolerance = 0.1 ,
112
112
toleranceCount = 3 ,
113
113
)
@@ -159,7 +159,7 @@ def straight(self, distance: float, speed: float = 0.5, timeout: float = None, m
159
159
return not time_out .is_done ()
160
160
161
161
162
- def turn (self , turn_degrees : float , speed : float = 0.5 , timeout : float = None , main_controller : Controller = None , secondary_controller : Controller = None , use_imu :bool = True ) -> bool :
162
+ 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 :
163
163
"""
164
164
Turn the robot some relative heading given in turnDegrees, and exit function when the robot has reached that heading.
165
165
Speed is bounded from -1 (turn counterclockwise the relative heading at full speed) to 1 (turn clockwise the relative heading at full speed)
@@ -180,8 +180,8 @@ def turn(self, turn_degrees: float, speed: float = 0.5, timeout: float = None, m
180
180
: rtype: bool
181
181
"""
182
182
183
- if speed < 0 :
184
- speed *= - 1
183
+ if max_effort < 0 :
184
+ max_effort *= - 1
185
185
turn_degrees *= - 1
186
186
187
187
time_out = Timeout (timeout )
@@ -193,7 +193,7 @@ def turn(self, turn_degrees: float, speed: float = 0.5, timeout: float = None, m
193
193
kp = .015 ,
194
194
kd = 0.0012 ,
195
195
minOutput = 0.25 ,
196
- maxOutput = speed ,
196
+ maxOutput = max_effort ,
197
197
tolerance = 0.5 ,
198
198
toleranceCount = 3
199
199
)
0 commit comments