File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ def stop(self) -> None:
84
84
self .right_motor .set_speed ()
85
85
self .set_effort (0 ,0 )
86
86
87
+ def arcade (self , straight :float , turn :float ):
88
+ """
89
+ Sets the raw effort of both motors based on the arcade drive scheme
90
+
91
+ :param straight: The base effort (Bounded from -1 to 1) used to drive forwards or backwards.
92
+ :type straight: float
93
+ :param turn: The modifier effort (Bounded from -1 to 1) used to skew robot left (positive) or right (negative).
94
+ :type turn: float
95
+ """
96
+ scale = max (abs (straight ), abs (turn ))/ (abs (straight ) + abs (turn ))
97
+ left_speed = (straight - turn )* scale
98
+ right_speed = (straight + turn )* scale
99
+ self .set_speed (left_speed , right_speed )
100
+
87
101
def reset_encoder_position (self ) -> None :
88
102
"""
89
103
Resets the position of both motors' encoders to 0
Original file line number Diff line number Diff line change 17
17
[" XRPLib/resetbot.py" , " github:Open-STEM/XRP_Micropython/XRPLib/resetbot.py" ],
18
18
[" XRPLib/servo.py" , " github:Open-STEM/XRP_Micropython/XRPLib/servo.py" ],
19
19
[" XRPLib/timeout.py" , " github:Open-STEM/XRP_Micropython/XRPLib/timeout.py" ],
20
- [" XRPLib/version.py" , " github:Open-STEM/XRP_Micropython/XRPLib/version.py" ],
21
20
[" XRPLib/webserver.py" , " github:Open-STEM/XRP_Micropython/XRPLib/webserver.py" ],
22
21
[" XRPExamples/__init__.py" , " github:Open-STEM/XRP_Micropython/Examples/__init__.py" ],
23
22
[" XRPExamples/drive_examples.py" , " github:Open-STEM/XRP_Micropython/Examples/drive_examples.py" ],
You can’t perform that action at this time.
0 commit comments