GithubHelp home page GithubHelp logo

zq32 / getting-started-ros Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mathworks-robotics/getting-started-ros

0.0 1.0 0.0 997 KB

Resources for getting started with MATLAB and Simulink and the Robot Operating System (ROS).

MATLAB 98.98% CMake 1.02%

getting-started-ros's Introduction

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 and the following videos.

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

getting-started-ros's People

Contributors

sea-bass avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.