30 lines
539 B
Python
30 lines
539 B
Python
from pybricks.hubs import PrimeHub
|
|
from pybricks.parameters import Axis, Direction, Port
|
|
from pybricks.pupdevices import Motor
|
|
from pybricks.robotics import DriveBase
|
|
from pybricks.tools import wait
|
|
|
|
from robot import CBHUB as HUB
|
|
|
|
# import batteria
|
|
|
|
hub = HUB.hub
|
|
db = HUB.db
|
|
|
|
db.use_gyro(True)
|
|
# (mm/s, mm/s², deg/s, deg/s²)
|
|
db.settings(100, 100, 90, 50)
|
|
wait(300)
|
|
db.reset(angle=0)
|
|
|
|
|
|
db.straight(100)
|
|
db.turn(90)
|
|
db.straight(100)
|
|
db.turn(90)
|
|
db.straight(100)
|
|
db.turn(90)
|
|
db.straight(100)
|
|
db.turn(90)
|
|
|
|
print(f"drived {db.distance()}")
|