{"id":48,"date":"2009-03-06T03:07:11","date_gmt":"2009-03-06T03:07:11","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/2009\/03\/06\/models-inspired-by-real-life\/"},"modified":"2016-08-29T14:18:46","modified_gmt":"2016-08-29T19:18:46","slug":"models-inspired-by-real-life","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2009\/03\/06\/models-inspired-by-real-life\/","title":{"rendered":"Models Inspired by Real Life"},"content":{"rendered":"<p>Often models are the predecessor to a real-life device; however, sometimes a device inspires the model. In the 1980s, there was a group known as the Leg Lab at CMU who researched running robots.\u00a0 In 1986 the Leg Lab moved to MIT.\u00a0 Some of their robots are now on display at the <a\nhref=\"http:\/\/web.mit.edu\/museum\/\">MIT Museum<\/a>, and they still inspire wonder in visitors today.\u00a0 One of those robots is a <a href=\"http:\/\/www.ai.mit.edu\/projects\/leglab\/robots\/3D_hopper\/3D_hopper.html\">3-D One-Legged Hopper<\/a> which inspired my colleague, <a\nhref=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/31651\">Guy Rouleau<\/a>.<\/p>\n<p><quote>I saw this robot at the MIT Museum last winter and after discussing with few colleagues at The MathWorks we decided that it would be cool to have a Simulink model of this robot.<\/quote><\/p>\n<p>Read on to learn about how Guy constructed and controlled this <a\nhref=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/21439-simulation-of-a-one-legged-hopping-robot\">one-legged hopper<\/a> (download from the file exchange).<\/p>\n<p><img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/2DHopper.gif\" alt=\"2-D hopping robot animation\"><\/p>\n<p><strong>Simulation and Control of a One-Legged Hopping Robot<\/strong><\/p>\n<p>By Guy Rouleau<\/p>\n<p><img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/guy_rouleau.png\" alt=\"Robot modeler, Guy Rouleau\"><\/p>\n<p>Here is the description of a one-legged hopping robot Simulink model I completed recently. I will explain how I prepared and implemented this simulation.<\/p>\n<p><strong>Preparation<\/strong><\/p>\n<p>Before modeling any system in Simulink, it is always good to have a plan. To begin I always like to draw a simple representation of the system I want to model. In this picture we see two bodies (let\u2019s call them <strong>body<\/strong> and <strong>leg<\/strong>) connected together at the hip. The robot has two actuated degrees of freedom (DoF) in his configuration space, the angle between the body and the leg, and the length of the leg. These 2 DoF will be used to control the 3 DoF motion of the body in space (height, distance and angle).\u00a0<\/p>\n<p><img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/robotHopperDiagram.png\" alt=\"Hopping robot diagram\"><\/p>\n<p>Now that the robot is described, it is time to think about how to control it. The robot control can be divided into three independent controllers:<\/p>\n<ol>\n<li><strong>Attitude Control - <\/strong>The length of the leg is controlled by a pneumatic actuator. This actuator behaves like a spring. It gives a smooth<br \/>\n    landing and injects force to keep the robot bouncing.<\/li>\n<li><strong>Velocity Control \u2013 <\/strong>As when a person walks, the leg is brought in front of the body while it is in the air. While the leg touches the ground, then the body is brought in front.<\/li>\n<li><strong>Orientation Control - <\/strong>During the stance, the leg is in contact with the ground. A torque is applied at the hip to control the angle of the body.<\/li>\n<\/ol>\n<p>The following picture shows the three controllers graphically:<\/p>\n<p><img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/robotHopper3Controlers.png\" alt=\"The Three hopping robot controllers\"><\/p>\n<p>Now I have a good idea of what to implement, it is time to have fun and play with Simulink. For this model, SimMechanics is the most appropriate Blockset to<br \/>\nmodel the robot.<\/p>\n<p><strong>Implementation<\/strong><\/p>\n<p>When I begin a SimMechanics model for a moving robot, I like fixing the position of the body in space. By doing so, I can verify if the configuration of the<br \/>\nactuators behaves as expected. This SimMechanics model looks like this:<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/fixedBodyRobot1SimMech_large.png\"><br \/>\n        <img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/fixedBodyRobot1SimMech_small.png\" alt=\"SimMechanics model of a hopping robot\"><br \/>\n<\/a><\/p>\n<p>Using this model I can test different inputs and see the resulting motion at the tip of the leg. Once I am satisfied with this motion, I can think about the interaction with the ground. <\/p>\n<p>My new goal is now to see the robot falling from a certain initial eight, bouncing a few times and fall. To model the ground, I use the Bouncing Ball demo provided with SimMechanics. After grouping components within subsystems, the model now looks like the following picture.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/RobotSystems2SimMech_large.png\"><br \/>\n    <img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/RobotSystems2SimMech_small.png\"><br \/>\n<\/a><\/p>\n<p>Once the contact forces and robot motion are validated, it is time to implement the control architecture. <\/p>\n<p>Typically, when I implement a controller I like to divide the model in the following subsystems:<\/p>\n<p><strong>Sensor modeling<\/strong><\/p>\n<p>This subsystem extracts and processes the information from the SimMechanics model to generate signals that could be provided by real sensors. For the hopping robot, I will measure the following:<\/p>\n<ul>\n<li>Angle between leg and body<\/li>\n<li>Angle of the body relative to the ground<\/li>\n<li>An on\/off contact sensor.<\/li>\n<\/ul>\n<p><strong>Motion Analysis<\/strong><\/p>\n<p>Based on the sensors, the information necessary for the controllers is computed. The contact switch is used to compute the duration of the flight and stance period. These durations, along with the hip and body angles can be used to estimate the robot velocity and displacement.<\/p>\n<p><strong>Controllers<\/strong><\/p>\n<p>With all the necessary information available, it is time to generate the actuator signals for the 3 control modes.<\/p>\n<ul>\n<li><strong>Attitude<\/strong><br \/>\n     \u2013 The same amount of force is injected by the pneumatic actuator at each jump. This generates jumps of constant eight and duration. The amount of force injected can be adjusted to obtain the desired jump eight, but for now, it will be kept constant.<\/li>\n<\/ul>\n<ul>\n<li><strong>Velocity \u2013 <\/strong>This is the most complex controller in this robot. First, we look at the displacement during the previous jump. While in<br \/>\n     flight, the tip of the leg is positioned in front of the robot body to prepare a motion similar to the previous jump. Also during flight, the leg<br \/>\n     tip position is modified depending if the robot must accelerate or decelerate. Landing with the leg farther in front of the body will<br \/>\n     accelerate the robot, while a leg tip closer to the body will decelerate it. A simple trajectory generation is also implemented to move the leg<br \/>\n     smoothly during the flight.<\/li>\n<\/ul>\n<ul>\n<li><strong>Orientation \u2013 <\/strong>In this phase, a hip torque is computed to keep the angle of the body with the ground close to zero. Combined with the<br \/>\n     Velocity controller, the Orientation controller pushes the robot in the right direction.<\/li>\n<\/ul>\n<p>After implementing the 3 controllers, it is time to visualize what the resulting motion looks like.<\/p>\n<p><img decoding=\"async\" border=0 src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2009Q1\/3DHopper.gif\" alt=\"Animation of a 3-D Hopping robot VR scene\"><\/p>\n<p>The description above contains the main steps I followed to create the hopping robot simulation. For more details, I suggest visiting the MATLAB Central  file Exchange to download the Simulink model of this <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/21439-simulation-of-a-one-legged-hopping-robot\">one-legged hopping robot<\/a>.<\/p>\n<p>When looking at the model, you will see that I omitted many details to make a short story. But the main process I use to create most of Simulink models is described here. <\/p>\n<p>Have you ever built a robot?\u00a0 What do you think about this model?\u00a0 Please leave a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=48&amp;#comment\">comment here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often models are the predecessor to a real-life device; however, sometimes a device inspires the model. In the 1980s, there was a group known as the Leg Lab at CMU who researched running robots.\u00a0 In... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2009\/03\/06\/models-inspired-by-real-life\/\">read more >><\/a><\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[65,30,39],"tags":[81,79,441],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/48"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":5881,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/48\/revisions\/5881"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}