File Exchange

image thumbnail

Smart Manufacturing Robotics Cyber Physical System

version (1.49 MB) by

Distributed Towers of Hanoi where three blocks with local control emerge in a sorted order.



View License

A pick and place machine is modeled to provide services of moving blocks either one or two positions over. The objective is to move a stack of three colored blocks from one location to the next such that the final stack is ordered according to color and size. The ordering is an emerging behavior based on local control for each of the blocks. As such, this is a distributed version of the Towers of Hanoi puzzle which is an example of a cyber-physical system.
Stereoscopic vision of a video stream of the virtual world enables the machine to first locate where the stack of blocks is. Feedforward control allows a quick pick and place action. Feedback control is used to move the blocks between locations. A pneumatic airflow is modeled to enable the machine to pick and move the blocks.

Comments and Ratings (6)

hanchao liu

This software is citable:
author = "Pieter Mosterman and Justyna Zander",
title = "{TowersOfHanoiOnGitHub: Towers of Hanoi in MATLAB/Simulink}",
month = "Jan",
year = "2015",
doi = "{10.5281/zenodo.13977}",
url = "{}",}

Carlos Moran

This model was the subject of my presentation at the <i>IEEE Real-Time and Embedded Technology and Applications Symposium</i> (RTAS) Industrial Session.
The video of my talk is available on YouTube at

A video of one scenario where a stack of blocks is sorted is available on YouTube at:

Excellent complete example for Model-Based Design!


Updated license


Added a link to the YouTube video that shows an animation of the sorting of an initial stack of blocks.


This version is extended to now include a third block being sorted.

MATLAB Release
MATLAB 8.0 (R2012b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video