extra motor
This commit is contained in:
parent
a287a451f1
commit
a8ad88b7a3
3 changed files with 23 additions and 3 deletions
|
|
@ -45,6 +45,8 @@ class Robot:
|
|||
left: Motor
|
||||
right: Motor
|
||||
db: DriveBase
|
||||
extra_L: Motor
|
||||
extra_R: Motor
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -55,6 +57,10 @@ class Robot:
|
|||
right_port: Port,
|
||||
left_direction: Direction,
|
||||
right_direction: Direction,
|
||||
extra_L_port: Port,
|
||||
extra_R_port: Port,
|
||||
extra_L_direction: Direction,
|
||||
extra_R_direction: Direction,
|
||||
wheel_diameter: float,
|
||||
axle_track: int,
|
||||
use_gyro: bool,
|
||||
|
|
@ -70,6 +76,8 @@ class Robot:
|
|||
|
||||
self.left = Motor(left_port, left_direction)
|
||||
self.right = Motor(right_port, right_direction)
|
||||
self.extra_L = Motor(extra_L_port, extra_L_direction)
|
||||
self.extra_R = Motor(extra_R_port, extra_R_direction)
|
||||
|
||||
self.db = DriveBase(
|
||||
self.left,
|
||||
|
|
|
|||
12
robots.py
12
robots.py
|
|
@ -34,6 +34,10 @@ leorobot = LazyRobot(
|
|||
turn_rate=DEFAULT_TURN_RATE,
|
||||
turn_acceleration=DEFAULT_TURN_ACCELERATION,
|
||||
settle_ms=DEFAULT_GYRO_SETTLE_MS,
|
||||
extra_R_port=Port.E,
|
||||
extra_R_direction=Direction.CLOCKWISE,
|
||||
extra_L_port=Port.D,
|
||||
extra_L_direction=Direction.CLOCKWISE,
|
||||
)
|
||||
|
||||
cbrobot = LazyRobot(
|
||||
|
|
@ -52,6 +56,10 @@ cbrobot = LazyRobot(
|
|||
turn_rate=DEFAULT_TURN_RATE,
|
||||
turn_acceleration=DEFAULT_TURN_ACCELERATION,
|
||||
settle_ms=DEFAULT_GYRO_SETTLE_MS,
|
||||
extra_R_port=Port.E,
|
||||
extra_R_direction=Direction.CLOCKWISE,
|
||||
extra_L_port=Port.D,
|
||||
extra_L_direction=Direction.CLOCKWISE,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -71,4 +79,8 @@ giorobot = LazyRobot(
|
|||
turn_rate=DEFAULT_TURN_RATE,
|
||||
turn_acceleration=DEFAULT_TURN_ACCELERATION,
|
||||
settle_ms=DEFAULT_GYRO_SETTLE_MS,
|
||||
extra_R_port=Port.E,
|
||||
extra_R_direction=Direction.CLOCKWISE,
|
||||
extra_L_port=Port.D,
|
||||
extra_L_direction=Direction.CLOCKWISE,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ from pybricks.robotics import DriveBase
|
|||
from assi import A
|
||||
from robot_class import LazyRobot, Robot
|
||||
|
||||
msu_R = Motor(Port.E)
|
||||
msu_L = Motor(Port.D)
|
||||
|
||||
|
||||
def main(robot: LazyRobot):
|
||||
hub = robot.hub
|
||||
db = robot.db
|
||||
|
||||
msu_R = robot.extra_R
|
||||
msu_L = robot.extra_L
|
||||
|
||||
db.settings(864, 300, 100, 50)
|
||||
|
||||
db.straight(610) # mission 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue