Simulation and Control of NAO ankle kit with SimMechanics and Serial IO blocks

Model and simulate a complicated ankle joint using Simulink and SimMechanics.
Updated 1 Sep 2016

View License

The Aldebaran Nao Ankle Kit lets users explore, design, and test behavior of this complex joint. The roll and pitch joints are controlled over a USB connection, enabling motor commands to be sent at high data rates (921.6 kbps), and motor encoder values to be returned back to Simulink. You can use this system in teaching and research to explore the behavior of closed/open loop systems, review mechanical concepts, simulate systems, and much more.
The zipped folder contains two Simulink models.

Model 1: Ankle in SimMechanigs 2G - R2012b\Tibia_gauche_leger.slx

A simplified CAD model of NAO ankle was imported into Simulink. You can run this model without a real Nao ankle.

- This simulation relies on an automatic import of a CAD model from SolidWorks. Double-click on the "Left_Ankle_Kit" subsystem for more information
- This model leverages Simulink capabilities related to the design control systems. Two PIDs compute the needed torque to reach a given target position.
- Each PID is tuned automatically using Simulink Control Design. Double-click a PID block and choose "Tune..." in the dialog box for more information.
- Press Ctrl+D or choose "Simulation/Update Diagram" to visualize the system at rest
- Run the simulation to visualize a moving ankle

Model 2: nao_ankle_simulink_com.mdl

Send the movement command to the real NAO ankle kit to see the movement. You need to have a NAO ankle (mechatronics version) to run this model. You also need to do the following setup:

(1): Choose the compiler for MATLAB/Simulink by running "mex –setup" at MATLAB command prompt. You can use the MATLAB built-in compiler for 32 bits MATLAB, otherwise you will need a compiler such as Visual Studio 2010.

(2): Remember to reduce the latency of your serial port in the advanced settings of your COM port (Control Panel -> Device Manager -> Right-click the Serial Port used for Ankle Kit).

Cite As

MathWorks Robotics and Autonomous Systems Team (2024). Simulation and Control of NAO ankle kit with SimMechanics and Serial IO blocks (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Multibody Modeling in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Ankle in SimMechanigs 2G - R2012b/

Version Published Release Notes

Updated license