Python code and building instructions for the LEGO MINDSTORMS Robot Inventor Main Models (51515).

Image credit: LEGO

The Modular Vehicle Platform gets the job done. Create and code your own remote control and build the M.V.P. into a buggy, a crane, a shooter turret or even a brick-eating truck to pick up LEGO bricks left by the other robots.


The playing instructions for each robot variant are in the docstrings of the corresponding file.

The code for M.V.P.’s basic drive is in mvp-basic.py as follows:

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,

    def calibrate(self):
        self.steer_motor.run_target(speed=1000, target_angle=0)

# Initialize mvp and straighten its steering.
mvp = MVP()

# 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)

This project was submitted by The Lương-Phạm Family.