File Exchange

image thumbnail

Getting Started with MATLAB, Simulink, and ROS

version 1.3.0 (1000 KB) by MathWorks Student Competitions Team
Resources for getting started with MATLAB and Simulink and the Robot Operating System (ROS).


Updated 16 Oct 2019

From GitHub

View Version History

View license on GitHub

This entry contains files for the "Getting Started with MATLAB and ROS", "Getting Started with Simulink and ROS", "Deploying Algorithms to ROS", and "Designing Distributed Systems with ROS" episodes of the MATLAB and Simulink Robotics Arena.
You will find MATLAB and Simulink templates to help you get started with common programming and modeling practices for connecting MATLAB and Simulink to the Robot Operating System (ROS).
In addition, this entry contains an object tracking example implemented using several of the templates above. You can try this example with your webcam, the Gazebo simulator, or ROS enabled robot hardware.
For more information, refer to the file included.

To try ROS and Gazebo, download a virtual machine at

Cite As

MathWorks Student Competitions Team (2021). Getting Started with MATLAB, Simulink, and ROS (, GitHub. Retrieved .

Comments and Ratings (6)

Robert Corby

Hey guys, great video! Just a quick question, I have the files downloaded and everything running in MATlab and Gazebo, however my robot in gazebo doesn't move or follow the detected circle. It highlights the detected blue cube with a yellow circle as demonstrated but the robot does not change velocity at any point to follow it once moved? Any idea? Thanks




I'm having issue with the "Designing Distributed Systems with ROS" examples. I already registered custom messages within MATLAB and they are showing up all right but when I'm trying to deploy gazeboExamplePerceptionCustom and gazeboExampleControlCustom to my virtual machine i get errors:

"The following error occurred during deployment to your hardware board:
Build unsuccessful for model 'gazeboExampleStateflow'. Check the build log in the diagnostics viewer for error messages."


"CMake Warning at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
Could not find a package configuration file provided by "custom_robot_msgs"
with any of the following names:

In ROS custom message documentation i found this:
"Code Generation with Custom messages

Custom message and service types can be used with ROS Simulink blocks for generating C++ code for a standalone ROS node. The generated code (.tgz archive) will include Simulink definitions for the custom messages, but it will not include the ROS custom message packages. When the generated code is built in the destination Linux System, it expects the custom message packages to be available in the catkin workspace or on the ROS_PACKAGE_PATH. Please ensure that you either install or copy the custom message package to your Linux system before building the generated code."

So, apparently there is an extra step to be done here and the "Designing Distributed Systems with ROS" episode completely skipped it over. So here is my question. What else do i have to do on my virtual machine so that I'll be able to deploy code with custom messages on it? What should i copy and where?

Danial Waleed

Christoph Hahn


MATLAB Release Compatibility
Created with R2017b
Compatible with R2017b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!