# Getting Started with MATLAB, Simulink, and ROS
Copyright 2017-2019 The MathWorks, Inc.
## Getting Started
This repository contains resources for getting started with MATLAB and Simulink
and the Robot Operating System (ROS). This functionality is provided by ROS Toolbox.
To learn more, refer to our [blog post](https://blogs.mathworks.com/racing-lounge/2017/11/08/matlab-simulink-ros/) and the following videos.
* [Getting Started with MATLAB and ROS](https://www.mathworks.com/videos/matlab-and-simulink-robotics-arena-getting-started-with-matlab-and-ros-1508263034047.html)
* [Getting Started with Simulink and ROS](https://www.mathworks.com/videos/matlab-and-simulink-robotics-arena-getting-started-with-simulink-and-ros-1509397202143.html)
* [Deploying Standalone ROS Nodes from Simulink](https://www.mathworks.com/videos/matlab-and-simulink-robotics-arena-deploying-algorithms-to-ros-1510659362460.html)
* [Distributed Computing with MATLAB, Simulink, and ROS](https://www.mathworks.com/videos/matlab-and-simulink-robotics-arena-designing-distributed-systems-with-ros-1514584072926.html)
## templateFiles Folder
Contains files provide a basic structure for creating your own MATLAB and Simulink files.
### MATLAB Templates
* **loopTemplate:** Algorithm runs in a simple loop, with an optional pause between iterations
* **rateTemplate:** Algorithm runs in a simple loop, which runs at a fixed rate dictated by either the wall clock or the global ROS node clock
* **async/asyncTemplate:** Algorithm runs asynchronously, whenever a new ROS message is received
* **timer/timerTemplate:** Algorithm is scheduled to run on a timer in the background
### Simulink Templates
* **simulationTemplate:** Model is slowed down using the wall clock, to run approximately in real time
* **codeGenerationTemplate:** Model is configured to generate a standalone C++ ROS node using Embedded Coder
* **multirateTemplate:** Model contains multiple subscribe and algorithm rates, as well as displays the color-coded rates in the model
* **architecture/mdlArchTemplate:** Model contains MATLAB, Simulink, and Stateflow elements. Links to reusable MATLAB files and Simulink block library in the **architecture** folder
* **paramServerGetterTemplate + paramServerSetterTemplate**: The "getter" model can run on the desktop or deployed standalone, and receives parameters from the ROS parameter server. To modify the parameter value, you can either run the "setter" model, or use **rosparam** in MATLAB or a Terminal window.
## demoFiles Folder
Contains filled out versions of the templates above, that will run on several platforms.
### Algorithms
#### Object Detection
* Uses camera information to detect a blue object and return its position and size
* MATLAB code can be found in **Algorithms\detectCircle.m**
* The same function is called in the Simulink examples using a MATLAB Function block
#### Object Tracking
* Uses the output of the object detection algorithm to assign linear and angular velocities such that the object is centered in the field of vision and has a certain pixel size (or distance)
* MATLAB code can be found in **Algorithms\trackCircle.m**
* Simulink and Stateflow versions of the same algorithm can be found in **Algorithms\controlLib.slx**
### Target Platforms
#### Webcam
These examples have been tested on Windows using the MATLAB Support Package for USB Webcams at https://www.mathworks.com/matlabcentral/fileexchange/45182-matlab-support-package-for-usb-webcams
#### Gazebo Examples
These examples have been tested using the Linux virtual machine at https://www.mathworks.com/support/product/robotics/v3-installation-instructions.html.
When you open the virtual machine, you can track blue objects in either the **Gazebo Playground** or **Gazebo TurtleBot World** worlds. To test the tracking algorithm, you can use Gazebo to move the robot and/or the blue objects in the world.
#### TurtleBot
These examples have been tested using the TurtleBot 2.
You can find a printable blue circle in the **Images** folder.
### MATLAB Examples
The **MATLAB** subfolder contains loop examples, as well as a **timer** subfolder showing the timer object and handle class approach.
### Simulink Examples
The **Simulink** subfolder contains examples with Simulink blocks, with Simulink blocks and a Stateflow chart, and using External Mode and the ROS Parameter Server (see the **paramServer** subfolder).
In addition, the **distributed** subfolder contains examples of the perception, control, and visualization components broken into multiple tasks and separate models. The models can communicate with each other with a standard ROS message or with a custom message which can be found in the **custom_robot_msgs** folder. To get the latter example working, you will need to use the ROS Toolbox Interface for ROS Custom Messages add-on and follow the steps shown at https://www.mathworks.com/help/ros/ug/ros-custom-message-support.html
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计&课设-用于开始使用MATLAB和Simulink以及机器人操作系统(ROS)的资源。.zip (64个子文件)
getting-started-ros-master
templateFiles
startupTemplates.m 284B
work
dummy.txt 51B
MATLAB
rateTemplate.m 2KB
RobotTemplateClass.m 2KB
myPerceptionAlgorithm.m 195B
timer
myTimerFcn.m 599B
timerTemplate.m 1KB
myControlAlgorithm.m 185B
loopTemplate.m 2KB
async
asyncTemplate.m 1KB
mySubCallback.m 435B
Simulink
paramServerSetterTemplate.slx 24KB
codeGenerationTemplate.slx 29KB
architecture
myPerceptionFcn.m 207B
mdlArchTemplate.slx 32KB
myAlgorithmLib.slx 27KB
myPreloadScript.m 380B
multirateTemplate.slx 30KB
paramServerGetterTemplate.slx 29KB
simulationTemplate.slx 29KB
demoFiles
startupDemo.m 306B
work
dummy.txt 51B
Algorithms
controlParams.m 1KB
detectCircle.m 2KB
trackCircle.m 2KB
controlLib.slx 38KB
controlParamsGazebo.m 1KB
MATLAB
turtleBotExampleMATLAB.m 1KB
webcamExampleMATLAB.m 1KB
timer
gazeboExampleTimer.m 639B
MyRobot.m 3KB
robotTimerFcn.m 276B
turtlebotExampleTimer.m 647B
gazeboExampleMATLAB.m 1KB
Images
printableCircleBlue.jpg 70KB
Simulink
webcamExampleStateflow.slx 35KB
gazeboExampleSimulink.slx 36KB
paramServer
turtleBotParamSetter.slx 26KB
turtleBotExampleParamServer.slx 32KB
gazeboExampleParamServer.slx 32KB
gazeboParamSetter.slx 25KB
webcamExampleSimulink.slx 33KB
gazeboExampleExternal.slx 32KB
turtleBotExampleStateflow.slx 38KB
distributed
custom_robot_msgs
CMakeLists.txt 259B
package.xml 582B
msg
circle_detection.msg 109B
gazeboExampleMultitasking.slx 38KB
gazeboExamplePerceptionCustom.slx 30KB
gazeboExampleVisualizer.slx 31KB
turtlebotExampleVisualizer.slx 31KB
gazeboExampleControl.slx 33KB
turtlebotExamplePerceptionCustom.slx 29KB
gazeboExamplePerception.slx 31KB
turtlebotExampleControl.slx 33KB
gazeboExampleControlCustom.slx 36KB
turtlebotExampleControlCustom.slx 36KB
turtlebotExampleMultitasking.slx 38KB
turtlebotExamplePerception.slx 31KB
gazeboExampleStateflow.slx 38KB
turtleBotExampleExternal.slx 32KB
turtleBotExampleSimulink.slx 36KB
loadIpAddresses.m 218B
README.md 5KB
共 64 条
- 1
资源评论
毕业小助手
- 粉丝: 2752
- 资源: 5583
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功