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:
8484 self .right_motor .set_speed ()
8585 self .set_effort (0 ,0 )
8686
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+
87101 def reset_encoder_position (self ) -> None :
88102 """
89103 Resets the position of both motors' encoders to 0
Original file line number Diff line number Diff line change 1717 [" XRPLib/resetbot.py" , " github:Open-STEM/XRP_Micropython/XRPLib/resetbot.py" ],
1818 [" XRPLib/servo.py" , " github:Open-STEM/XRP_Micropython/XRPLib/servo.py" ],
1919 [" XRPLib/timeout.py" , " github:Open-STEM/XRP_Micropython/XRPLib/timeout.py" ],
20- [" XRPLib/version.py" , " github:Open-STEM/XRP_Micropython/XRPLib/version.py" ],
2120 [" XRPLib/webserver.py" , " github:Open-STEM/XRP_Micropython/XRPLib/webserver.py" ],
2221 [" XRPExamples/__init__.py" , " github:Open-STEM/XRP_Micropython/Examples/__init__.py" ],
2322 [" 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