Lego Mindstorms Minimalist Matlab Library for mobile robot simulation

LM3LT is a minimalist class written entirely in Matlab that simulates, with certain degree of physical realism, a Lego Mindstorms robot with its basic sensors and actuators:

  • Two independent motors (left and right) with simulated first-order rotation speeds.
  • Ultrasonic sensor with longitudinal noise of similar magnitude to the real one and also with the possibility of adding angular noise and beam thickness.
  • Reflected light sensor with measurement noise and with modifiable area of measurement. Picture files (e.g., png) can be used as light map on the floor.
  • Gyro sensor that mimics the behaviour (angle + velocity) of the EV3 gyro sensor.
  • Collision detection with obstacles (walls).
  • Physical parameters of the configuration (position of the sensors, radii of the wheels, etc.) can be defined at will.

This class is intended to provide an alternative to the use of the real robot in engineering contexts, for instance in university courses. It has been used intensively in a Robotics undergraduate course starting from the academic year 2019/2020 and in a Mobile Robotics master course starting in the academic year 2020/2021 (both due to the COVID-19 pandemic).

Its documentation is quite self-explanatory. A script skeleton is included in the downloadable.

You can download the latest version of the library here.