sets/inventor: Add MVP basic program.

rename MVP Basic program

fix MVP Basic program
This commit is contained in:
Antoni Luong Pham
2021-04-13 12:41:41 +02:00
committed by Laurens Valk
parent 6caea025e3
commit db0caad282
2 changed files with 35 additions and 0 deletions
+7
View File
@@ -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.
+28
View 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)