27 lines
782 B
Python
27 lines
782 B
Python
|
|
from pybricks.hubs import PrimeHub
|
||
|
|
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
|
||
|
|
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
|
||
|
|
from pybricks.robotics import DriveBase
|
||
|
|
from pybricks.tools import wait, StopWatch
|
||
|
|
from pybricks.tools import run_task,multitask
|
||
|
|
|
||
|
|
hub = PrimeHub()
|
||
|
|
|
||
|
|
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
|
||
|
|
right_motor = Motor(Port.B)
|
||
|
|
left_arm = Motor(Port.C, Direction.COUNTERCLOCKWISE)
|
||
|
|
right_arm = Motor(Port.D)
|
||
|
|
|
||
|
|
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=68.8, axle_track=180)
|
||
|
|
|
||
|
|
drive_base.settings(880,850,700,700)
|
||
|
|
|
||
|
|
drive_base.use_gyro(True)
|
||
|
|
|
||
|
|
first_run = True
|
||
|
|
|
||
|
|
async def main():
|
||
|
|
await drive_base.straight(750)
|
||
|
|
await drive_base.straight(-650)
|
||
|
|
|
||
|
|
run_task(main())
|