To support the Maker democratization spirit, MATLAB and Simulink now include direct deployment to low-cost boards like Arduino Due and Raspberry Pi. A MATLAB home license allows access to tools that previously lived only in the commercial and academic spaces. With Model-Based Design, makers can now use MATLAB and Simulink with their low-cost hardware projects, finding bugs with simulation on their desktop, and avoiding having to spend so much time debugging on target.
To celebrate this capability, MathWorks kicked off an open project that included everything necessary to simulate and build a little autonomous 3D printed Mars Rover. The simulation model demystifies numerical simulation, as it shows concretely how design can become more intuitive using the graphical approach provided with Simulink. Here, the state machine guides the discovery of waypoints based on what the simulated camera finds in the scene.
Implementing such a state machine in a text-based approach would be much less direct. Without simulation, each debug iteration would require compilation and download, so it would be more time consuming. To industry veterans using model-based design to create highly complex control systems, there may be no surprise apart from seeing how their secret design tool is now the backbone of a simplified low-cost tool for the rest of the world.
The 3D-printed Mars Rover
Built around a simple 3D-printed chassis, the Rover is based on two very common and low-cost embedded systems: Arduino Due and Raspberry Pi. The ARM Cortex-M-powered Arduino Due and its peripherals allow for future sensor payloads, while the 700 MHz CPU and 512 MB of RAM on Raspberry Pi offer the power of embedded Linux and its community of support. The robot’s current incarnation is limited to a sensor payload of just a webcam and wheel encoders, but this is nevertheless enough for basic navigation and mapping.
At a competition organized by MathWorks at the Paris Maker Faire almost 300 people used the platform to try making the Rover, each getting access to the full design environment and simulation models, and submitting their improvements to qualify for the final event. Twelve teams qualified for the event, with one team coming from as far as India. Each team was provided a robot by MathWorks, which it used the entire day to find and navigate its Martian waypoints faster than the other teams. The Martian waypoints were green dots in a red environment seen by the camera and analyzed by a computer-vision algorithm that detects their locations relative to the robot. A control algorithm then uses these distance and bearing measurements for the robot’s motors to travel from one dot to another. Since then, 3D printers around the world have been replicating the design, and the Maker spirit of democracy rolls on.
3D-printed Mars Rover.
The algorithms designed in the simulation phase are deployed to the Rover’s two processors, at which point the environment allows graphical monitoring and debugging. There’s no need for IDEs, compilers, JTAG emulators, mutexes, communication middleware, or driver stacks. The mantra here is algorithms and hardware. If you like that, model-based design is for you. We invite you to reuse the project as is or do your own thing – innovate, put your twist on it, add sensors or intelligence, build a swarm, and share back to the repository.
Visit MATLAB Central for documentation and MATLAB and Simulink files to power a robot competition/workshop designed around a Mars Rover theme. I hope to see you at this year’s competition just announced on MakerZone.
Paul Cox is an Application Engineer at MathWorks. He received a BSEE degree from the University of Texas at Austin and a Masters in control from Institut National des Sciences Appliquées de Toulouse in France. At MathWorks, he supports embedded customers with deploying control design to 32-bit and other processors. Outside of work, he has built a robot and an autonomous UAV.