Merge pull request 'Pull from Johannes_Dev to dev' (#3) from Johannes_Dev into dev
Reviewed-on: #3
This commit is contained in:
27
missions/Boat.py
Normal file
27
missions/Boat.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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(550,700,100,100)
|
||||||
|
|
||||||
|
drive_base.use_gyro(True)
|
||||||
|
|
||||||
|
first_run = False
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
await drive_base.straight(750)
|
||||||
|
await drive_base.straight(-650)
|
||||||
|
|
||||||
|
run_task(main())
|
||||||
29
missions/Sand Mission.py
Normal file
29
missions/Sand Mission.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
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(400,500,100,100)
|
||||||
|
|
||||||
|
drive_base.use_gyro(True)
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
await drive_base.straight(420)
|
||||||
|
await right_arm.run_angle(300,-100)
|
||||||
|
await drive_base.straight(-100)
|
||||||
|
await right_arm.run_angle(300, 100)
|
||||||
|
await drive_base.straight(-350)
|
||||||
|
|
||||||
|
run_task(main())
|
||||||
@@ -13,22 +13,19 @@ right_motor = Motor(Port.B)
|
|||||||
left_arm = Motor(Port.C, Direction.COUNTERCLOCKWISE)
|
left_arm = Motor(Port.C, Direction.COUNTERCLOCKWISE)
|
||||||
right_arm = Motor(Port.D)
|
right_arm = Motor(Port.D)
|
||||||
|
|
||||||
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=64.8, axle_track=180)
|
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=68.8, axle_track=180)
|
||||||
|
|
||||||
drive_base.settings(600,500,300,200)
|
drive_base.settings(600,500,300,200)
|
||||||
drive_base.use_gyro(True)
|
drive_base.use_gyro(True)
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
await drive_base.straight(855)
|
await drive_base.straight(915)
|
||||||
await drive_base.turn(-90)
|
await drive_base.turn(-90)
|
||||||
await drive_base.straight(50)
|
await drive_base.straight(60)
|
||||||
await left_arm.run_angle(10000,-15000)
|
await left_arm.run_angle(10000,-15000)
|
||||||
await drive_base.straight(-50)
|
await drive_base.straight(-60)
|
||||||
await drive_base.turn(90)
|
await drive_base.turn(85)
|
||||||
await drive_base.straight(2000)
|
await drive_base.straight(2000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
run_task(main())
|
run_task(main())
|
||||||
Reference in New Issue
Block a user