mirror of
https://github.com/pybricks/pybricks-projects.git
synced 2026-09-15 11:03:15 +00:00
sets/inventor: Add MVP basic program.
rename MVP Basic program fix MVP Basic program
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# Example LEGO® MINDSTORMS® Robot Inventor programs for M.V.P.
|
||||
|
||||
This program requires PyBricks v3.0 firmware installed on the Inventor Hub.
|
||||
|
||||
Building instructions can be found at https://www.lego.com/en-us/service/buildinginstructions/51515.
|
||||
|
||||
The playing instructions for each robot variant are in the docstrings of the corresponding file.
|
||||
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
This program is for MVP's basic "Buggy" mode.
|
||||
|
||||
Follow the corresponding building instructions in the LEGO® MINDSTORMS®
|
||||
Robot Inventor App.
|
||||
"""
|
||||
|
||||
from pybricks.pupdevices import Motor
|
||||
from pybricks.parameters import Direction, Port
|
||||
|
||||
|
||||
class MVP:
|
||||
def __init__(self):
|
||||
self.steer_motor = Motor(Port.A)
|
||||
self.drive_motor = Motor(Port.B,
|
||||
positive_direction=Direction.COUNTERCLOCKWISE)
|
||||
|
||||
def calibrate(self):
|
||||
self.steer_motor.run_target(speed=1000, target_angle=0)
|
||||
|
||||
|
||||
# Initialize mvp and straighten its steering.
|
||||
mvp = MVP()
|
||||
mvp.calibrate()
|
||||
|
||||
# Make mvp drive in a circle.
|
||||
mvp.steer_motor.run_angle(speed=350, rotation_angle=50)
|
||||
mvp.drive_motor.run_angle(speed=800, rotation_angle=16 * 360)
|
||||
Reference in New Issue
Block a user