{"id":1713,"date":"2018-08-08T11:30:10","date_gmt":"2018-08-08T09:30:10","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=1713"},"modified":"2018-09-06T15:46:10","modified_gmt":"2018-09-06T13:46:10","slug":"no-robot-no-problem-program-robots-using-simulations","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2018\/08\/08\/no-robot-no-problem-program-robots-using-simulations\/","title":{"rendered":"No Robot? No Problem! &#8211; Program Robots Using Simulations"},"content":{"rendered":"<p>Today, \u00a0<a href=\"https:\/\/www.linkedin.com\/in\/josenicolasavendano\/\">Jose Avendano Arbelaez<\/a> shares another guest post with us. Make sure you let us know your thoughts in the comments section.<\/p>\n<p>\u2013 \u2013<\/p>\n<p>Robotics programmers have been putting more emphasis on simulation for both hardware and software design. Here are a few reasons why:<\/p>\n<ol>\n<li>You may not have available hardware, or selecting the right hardware depends on some initial analysis.<\/li>\n<li>You want to make sure your robot will behave as expected before testing on hardware. This will reduce the chances of putting unsafe code on your robots.<\/li>\n<\/ol>\n<p>Because of these benefits of simulation, we have created tools to develop and test robotics algorithms in simulation. This post will help you get familiar with some of our robot simulation libraries.<\/p>\n<h1>Virtual Worlds \u2013 Dynamic 3D Visualizations<\/h1>\n<p>For many beginner robotics programmers, it is important to get immediate and accurate feedback on a robot\u2019s behavior. The\u00a0<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/67157-robotics-playground\">Robotics Playground<\/a>\u00a0provides a set of configurable virtual worlds. This is particularly useful if you are trying to move to which is a leading environment for controls design and robotics integration. You can test\u00a0<a href=\"https:\/\/www.mathworks.com\/products\/stateflow.html\">Stateflow<\/a> charts for navigation and explore logic for moving objects. You can also close the loop and implement some robot perception by using multiple of the following available sensors:<\/p>\n<ul>\n<li>Encoder<\/li>\n<li>Distance sensor<\/li>\n<li>Object sensor<\/li>\n<li>Gyroscope<\/li>\n<li>Compass<\/li>\n<li>Contact switch<\/li>\n<li>Lidar sensor<\/li>\n<\/ul>\n<p>The environments can also be modified by changing the size, location and other properties of the 3D components directly from the Simulink blocks for any of the available environments.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/RP_toolbox-e1533118087296.png\"><img decoding=\"async\" loading=\"lazy\" width=\"599\" height=\"256\" class=\"alignnone size-full wp-image-1719\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/RP_toolbox-e1533118087296.png\" alt=\"\" \/><\/a><\/p>\n<p>If you are looking for a simple simulation environment in Simulink that includes physics, sensors, and rich visuals; the\u00a0<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/67157-robotics-playground\">Robotics Playground<\/a>\u00a0is a great place to begin your journey. This library is also a great place to get started if you are planning to move your algorithms to Simulink-supported hardware like\u00a0<a href=\"https:\/\/www.mathworks.com\/hardware-support\/lego-mindstorms-ev3-matlab.html\">LEGO<\/a>,\u00a0<a href=\"https:\/\/www.mathworks.com\/hardware-support\/vex-arm-cortex.html\">VEX<\/a>, and\u00a0<a href=\"https:\/\/www.mathworks.com\/hardware-support\/arduino-matlab.html\">Arduino<\/a>. Simulink can automatically generate and deploy production-ready code to supported hardware providing an effortless transition from simulation to hardware testing. These environments are built using\u00a0<a href=\"https:\/\/www.mathworks.com\/products\/simmechanics.html\">Simscape Multibody<\/a>, if you are interested in physical modeling and simulation of 3D assemblies and environments, this library can also provide you with great reference examples.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/RP_Toolbox_50percent-1.gif\"><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"360\" class=\"alignnone size-full wp-image-1741\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/RP_Toolbox_50percent-1.gif\" alt=\"\" \/><\/a><\/p>\n<h1>Use Real-World Maps with Lines and Obstacles<\/h1>\n<p>Do you know what your environment looks like? The\u00a0<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62961-mobile-robotics-training-toolbox\">Mobile Robotics Training Toolbox<\/a>\u00a0can create dedicated 2D maps for line following and obstacle avoidance from pictures of your actual robot field. This toolbox is the complement of our\u00a0<a href=\"https:\/\/www.mathworks.com\/academia\/student-competitions\/mobile-robotics-training.html\">Mobile Robotics Training<\/a>\u00a0and it is especially helpful for developing and testing path navigation algorithms. You can check out our earlier post on\u00a0<a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/2018\/05\/23\/robot-brains-and-an-online-training\/\">Autonomous Navigation and\u00a0Planning<\/a>\u00a0for information on the training, but you can also just use the toolbox independently to simulate 2-Dimensional robot dynamics and perform early prototyping of supervisory logic. This Simulink toolbox comes with:<\/p>\n<ul>\n<li>Robot visualizer<\/li>\n<li>Line sensor<\/li>\n<li>Encoder<\/li>\n<li>Distance sensor<\/li>\n<li>Kinematic utilities for differential drive robots<\/li>\n<li>Application to import maps from pictures<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRT_toolbox-e1533118533519.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-1727 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRT_toolbox-e1533119305392.png\" alt=\"\" width=\"399\" height=\"255\" \/><\/a><\/p>\n<p>Before you get started with this toolbox, we encourage you to explore the <a href=\"https:\/\/www.mathworks.com\/academia\/student-competitions\/mobile-robotics-training.html\">training videos<\/a> which have detailed lessons to follow along implementing all the toolbox functionality.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRT_Toolbox.gif\"><img decoding=\"async\" loading=\"lazy\" width=\"387\" height=\"351\" class=\"alignnone size-full wp-image-1729\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRT_Toolbox.gif\" alt=\"\" \/><\/a><\/p>\n<h1>\u00a0Prefer Working in MATLAB? Need Kinematic Models?<\/h1>\n<p>The\u00a0<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/66586-mobile-robotics-simulation-toolbox\">Mobile Robotics Simulation Toolbox<\/a>\u00a0was designed with MATLAB algorithm developers in mind. This toolbox includes:<\/p>\n<ul>\n<li>Lidar sensor<\/li>\n<li>Object detector<\/li>\n<li>Robot Visualizer<\/li>\n<li>Detailed examples<\/li>\n<li>Kinematic models for:\n<ul>\n<li>Differential drive robot<\/li>\n<li>Omnidirectional wheel robots<\/li>\n<li>Mecanum\u00a0wheel robots<\/li>\n<li>4-wheeled vehicles with steering<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/mrs_Toolbox.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-1731 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/mrs_Toolbox-e1533118653653.png\" alt=\"\" width=\"600\" height=\"272\" \/><\/a><\/p>\n<p>In this case, you also get important global measurements like the position and orientation of your robot and objects, and customizable 2D maps. Some of the examples in this toolbox include closed-loop waypoint tracking, object detection and following, and lidar navigation using several kinematic models. Our video on <a href=\"https:\/\/www.mathworks.com\/videos\/matlab-and-simulink-robotics-arena-getting-started-with-the-mobile-robotics-simulation-toolbox-1523443253912.html\">Getting Started with the Mobile Robotics Simulation Toolbox<\/a> will show you how install and use this toolbox. Additionally, all the contents of this toolbox have equivalent MATLAB and Simulink functionality so you can choose the programming approach you are most comfortable with, and get access to a rich library of models, sensors, and visualizations. The\u00a0<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/66586-mobile-robotics-simulation-toolbox\">Mobile Robotics Simulation Toolbox<\/a>\u00a0is also well integrated with the\u00a0<a href=\"https:\/\/www.mathworks.com\/products\/robotics.html\">Robotics Systems Toolbox<\/a>. So, you can implement the complete suite of\u00a0ground\u00a0vehicle and mapping algorithms contained within your installed MATLAB libraries.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRS_Toolbox-1.gif\"><img decoding=\"async\" loading=\"lazy\" width=\"387\" height=\"347\" class=\"alignnone size-full wp-image-1777\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/08\/MRS_Toolbox-1.gif\" alt=\"\" \/><\/a><\/p>\n<h1>Need More? Use ROS-Based Simulators<\/h1>\n<p>Once you move on to more advanced robotics applications you might need more detailed physics, higher customization, and likely faster execution. Many commercially available simulation environments have support for the Robot Operating System (ROS). If you are already working with a simulator such as Gazebo or V-REP you might consider developing your robot logic with MATLAB and\/or Simulink. We have a lot of content demonstrating how to use model-based design to interact with both ROS-enabled robots and simulators. Check out our blog post on\u00a0<a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/2017\/11\/08\/matlab-simulink-ros\/\">Getting Started with MATLAB, Simulink, and ROS<\/a>\u00a0which has anything you need to prototype, execute and deploy robot control algorithms and transport them to you preferred ROS platforms.<\/p>\n<h1>Conclusion<\/h1>\n<p>If you are at early development stages of your robot algorithms, need a way to test algorithms while your robots are being built, or simply just don\u2019t have a robot to program; pre-built simulation libraries for MATLAB and Simulink for any experience level. Use the table below to match your simulation requirements to our available tools.<strong>\u00a0<\/strong><\/p>\n<table style=\"width: 100%;\">\n<tbody>\n<tr>\n<th><strong><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/67157-robotics-playground\">Robotics Playground<\/a>\u00a0<\/strong><\/p>\n<p>&nbsp;<\/th>\n<th><strong><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62961-mobile-robotics-training-toolbox\">Mobile Robotics Training Toolbox<\/a><\/strong><\/p>\n<p>&nbsp;<\/th>\n<th><strong><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/66586-mobile-robotics-simulation-toolbox\">Mobile Robotics Simulation Toolbox<\/a><\/strong><\/p>\n<p>&nbsp;<\/th>\n<\/tr>\n<tr>\n<td>\n<ul>\n<li>3D Visuals<\/li>\n<li>Customizable obstacle and object maps<\/li>\n<li>Common robot sensors<\/li>\n<li>Simulink library and MATLAB API<\/li>\n<\/ul>\n<\/td>\n<td>\n<ul>\n<li>2D Visuals<\/li>\n<li>Maps imported from pictures<\/li>\n<li>Line following and obstacle maps<\/li>\n<li>Common robot sensors<\/li>\n<li><a href=\"https:\/\/www.mathworks.com\/academia\/student-competitions\/mobile-robotics-training.html\">Complimentary Mobile Robotics Training<\/a><\/li>\n<\/ul>\n<\/td>\n<td>\n<ul>\n<li>2D Visuals<\/li>\n<li>Common kinematic models<\/li>\n<li>MATLAB and Simulink Libraries<\/li>\n<li>Integrated with Robotics System Toolbox<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\" colspan=\"3\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center;\"><strong style=\"text-align: center; font-family: inherit; font-size: inherit;\">More detailed environments, physics and robots?\u00a0<\/strong><a style=\"font-family: inherit; font-size: inherit;\" href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/2017\/11\/08\/matlab-simulink-ros\/\">Getting Started with MATLAB, Simulink, and ROS<\/a><\/p>\n<p>Testing your algorithms in simulation environments can help you get results faster and maybe even prevent potentially dangerous robot behavior. If you get a chance to try any of these toolboxes, let us know how they help you by writing to\u00a0<a href=\"mailto:studentcompetitions@mathworks.com\">studentcompetitions@mathworks.com<\/a> or in the comments files below.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2018\/08\/RP_Toolbox_50percent-1.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>Today, \u00a0Jose Avendano Arbelaez shares another guest post with us. Make sure you let us know your thoughts in the comments section.<br \/>\n\u2013 \u2013<br \/>\nRobotics programmers have been putting more emphasis on&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2018\/08\/08\/no-robot-no-problem-program-robots-using-simulations\/\">read more >><\/a><\/p>\n","protected":false},"author":151,"featured_media":1741,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[145,52,14,8,10,11,12],"tags":[159,94,161,157],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/1713"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/users\/151"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/comments?post=1713"}],"version-history":[{"count":26,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/1713\/revisions"}],"predecessor-version":[{"id":1845,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/1713\/revisions\/1845"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/1741"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=1713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=1713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=1713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}