dev #33
42
missions/tip the scale.py
Normal file
42
missions/tip the scale.py
Normal file
@@ -0,0 +1,42 @@
|
||||
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(300,1000,300,200)
|
||||
|
||||
#drive_base.use_gyro(True)
|
||||
|
||||
async def main():
|
||||
left_arm.run_angle(500,200)
|
||||
right_arm.run_angle(500,200)
|
||||
await drive_base.straight(70)
|
||||
|
||||
await drive_base.turn(-55)
|
||||
await drive_base.straight(900)
|
||||
await drive_base.turn(92.5)
|
||||
|
||||
await drive_base.straight(75)
|
||||
await drive_base.straight(21)
|
||||
await right_arm.run_angle(500,-250)
|
||||
await right_arm.run_angle(500,250)
|
||||
await drive_base.turn(55)
|
||||
|
||||
await left_arm.run_angle(300,-400)
|
||||
|
||||
await drive_base.turn(46.5)
|
||||
await drive_base.turn(-40)
|
||||
await drive_base.straight(900)
|
||||
run_task(main())
|
||||
Reference in New Issue
Block a user