{"id":2188,"date":"2018-12-05T11:49:39","date_gmt":"2018-12-05T10:49:39","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=2188"},"modified":"2020-12-18T15:53:21","modified_gmt":"2020-12-18T14:53:21","slug":"using-simscape-multibody-to-throw-an-object-at-a-target","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2018\/12\/05\/using-simscape-multibody-to-throw-an-object-at-a-target\/","title":{"rendered":"Using Simscape Multibody to Throw an Object at a Target"},"content":{"rendered":"<p>Today\u2019s guest post is by <a href=\"https:\/\/www.linkedin.com\/in\/veer-alakshendra-b5324222\/\">Veer Alakshendra<\/a>. Veer will be sharing a Simscape &#8211; Simulink modeling and controls workflow for pneumatic actuators throwing a ball at a target.<\/p>\n<p>&#8211; &#8212;<\/p>\n<p>For last few years, I have been following <a href=\"http:\/\/aburobocon2019.mnb.mn\/en\">RoboCon<\/a> very closely. Fortunately, this year I got a chance to watch the live action at National Robotic Contest RoboCon 2018. Like every year, this year also the theme had an object and a target. Students came up with new innovative designs to complete the task, and most of the teams used pneumatic actuators for throwing the ball at the target. However, it\u2019s a challenge to select appropriate pneumatic components and design the throwing mechanism. Also, it\u2019s impossible to directly control the trajectory of the object because once it\u2019s in the air there are no actuators to direct object\u2019s projectile motion to the target. Hence, motivated by the students and to answer few underlying questions we thought to build a simulation environment which would help the students to complete the task.<\/p>\n<p>Find all models described here on <strong>MATLAB Central File Exchange &#8220;<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/69331-modeling-pneumatic-robot-actuators\"><span id=\"titleText\">Modeling Pneumatic Robot Actuators<\/span><\/a>&#8220;<\/strong>. Additionally we have created instructional videos that are linked at the end of the post.<\/p>\n<h1>Throwing Mechanism Implemented Using Simscape Multibody<\/h1>\n<p>We came back to our workplace and just like an undergraduate RoboCon participant, we first drew a simple throwing mechanism on a piece of paper. Next, the complete design was built in <a href=\"https:\/\/www.mathworks.com\/products\/simmechanics.html\">Simscape Multibody<\/a> which provides a multibody simulation environment for 3D mechanical systems.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/concept_design-e1542366604653.png\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"458\" class=\"size-large wp-image-2196 aligncenter\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/concept_design-1024x458.png\" alt=\"\" \/><\/a><\/p>\n<p>Having built that, we tried some cool stuff in the simulation environment:<\/p>\n<ul>\n<li><strong>Play with dimensions:<\/strong> We tried multiple simulations by changing the dimensions of the design. For example, increasing the density of the ball inside the box proved that the lower surface of the box is unable to withstand the load of the ball.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2326 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Ball_density-2.gif\" alt=\"\" width=\"303\" height=\"184\" \/><\/p>\n<ul>\n<li><strong>Visualize our imaginations:<\/strong> We tried all our imaginations in the simulation environment. For example, what would happen if the sinusoidal signal is given as a motion input to the prismatic joint?<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2328 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Sinusoidal_input-1.gif\" alt=\"\" width=\"305\" height=\"180\" \/><\/p>\n<ul>\n<li><strong>Incorporate dynamics:<\/strong> The best part that Simscape Multibody lets you is to understand the dynamics of the system. One can change the internal mechanics, input motion, input torque or input force to understand the system operation. For example, what would happen if you provide zero value to the damping coefficient of the revolute joint?<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2340 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Zero_damping-2.gif\" alt=\"\" width=\"285\" height=\"181\" \/><\/p>\n<ul>\n<li><strong>Reference input signal:<\/strong> With a liberty to fail multiple times, we tried numerous simulations to throw the ball in the yellow box. After failing several times, we finally found a few input signals for the motion of the piston which made the ball land in the yellow box.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2332 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Target_yellowbox-1.gif\" alt=\"\" width=\"285\" height=\"147\" \/><\/p>\n<p>Now, the next question was the possibility to directly provide the desired input signal to the piston. Of course, No! We can\u2019t because the motion of the piston is generated by the pressure difference at two sides of the double acting actuator. Hence, it was necessary to build and simulate a model which could give information about the pressure difference.<\/p>\n<h1><span lang=\"EN-US\">Pneumatic Actuation Circuit Implemented using Simscape<\/span><\/h1>\n<p>We went back to our hand-written notes which we took during the National Robotic Contest RoboCon 2018 where we drew a basic pneumatic schematic diagram consisting of a plastic bottle, supply pipes, a directional control valve (DCV) and a double acting actuator. Without making any changes, we simply replicated the complete schematic diagram from a piece of paper to <a href=\"https:\/\/www.mathworks.com\/products\/simscape.html\">Simscape<\/a> using physical blocks and the simulations gave us some interesting information:<a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/first_simscape-e1542367042794.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-2208 size-full aligncenter\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/first_simscape-e1542367042794.png\" alt=\"\" width=\"800\" height=\"431\" \/><\/a><\/p>\n<ul>\n<li><strong>Spool movement:<\/strong> When the spool of the DCV is moved, there is a delay in the movement of the load attached to the piston. This is because it takes some time for the fluid to develop the pressure difference on both sides of the double acting actuator.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/spool_movement-e1542367104257.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-2210 size-full aligncenter\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/spool_movement-e1542367104257.png\" alt=\"\" width=\"800\" height=\"428\" \/><\/a><\/p>\n<ul>\n<li><strong>Bottle pressure:<\/strong> When the piston starts moving, pressure drops in the plastic bottle.<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2306 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/RoboconPneumatic_PressureDecrease.png\" alt=\"\" width=\"541\" height=\"246\" \/><\/p>\n<ul>\n<li><strong>Size of DCV:<\/strong> The dimensions of a DCV are important to decide the flow direction and pressure developed in the pneumatic system. Even a small change in the valve diameter can bring a drastic change in the pipe pressure.<\/li>\n<\/ul>\n<h1>Implementation of PID Controller<\/h1>\n<p>Once the Simscape model was ready, we interfaced it with the throwing mechanism model built as seen in the figure below:<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/simscape_simscape_multibody-e1542367223305.png\"><img decoding=\"async\" loading=\"lazy\" width=\"801\" height=\"304\" class=\"size-full wp-image-2214 aligncenter\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/simscape_simscape_multibody-e1542367223305.png\" alt=\"\" \/><\/a><\/p>\n<p>Please note that the linear interface block is available in <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37636-simscape-multibody-multiphysics-library\">Simscape Multibody Multiphysics Library<\/a>.<\/p>\n<p>However, when we ran the simulation, we realized that it\u2019s not an easy task to find the required amount of DCV\u2019s spool movement which can throw the ball in the target because the piston movement doesn\u2019t change linearly with DCV\u2019s spool movement. Here is an animation which shows that for 30% spool movement, the link is unable to throw the ball.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2334 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Spoolinput_output-1.gif\" alt=\"\" width=\"285\" height=\"151\" \/><\/p>\n<p>Hence, we used a PID controller where the goal was to track the reference piston position and find the appropriate DCV\u2019s spool position.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2310 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/RoboconPneumatic_PID.png\" alt=\"\" width=\"880\" height=\"251\" \/><\/p>\n<p>Note: The reference piston position is the signal which was obtained by the throwing mechanism model.<\/p>\n<p>Here is what we got from the results once we ran the simulation with the PID controller.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2336 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/Trajectory_withcontroller-1.gif\" alt=\"\" width=\"285\" height=\"151\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2312 size-full\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2018\/12\/RoboconPneumatic_PIDPlots.png\" alt=\"\" width=\"488\" height=\"465\" \/><\/p>\n<p>From the animation and the results, it was evident that the controller successfully tracks the reference trajectory so that the ball successfully lands in the yellow box.<\/p>\n<p><strong>What next?<\/strong><\/p>\n<p>We have a 3-part video series of Modeling Pneumatic Robot Actuators where you can find a detailed explanation of the applied approach.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.mathworks.com\/videos\/matlab-and-simulink-robotics-arena-modeling-pneumatic-robot-actuators-part-1-1542190287608.html\">Modeling Pneumatic Robot Actuators &#8211; Part 1<\/a><\/li>\n<li><a href=\"https:\/\/www.mathworks.com\/videos\/matlab-and-simulink-robotics-arena-modeling-pneumatic-robot-actuators-part-2-1542191915263.html\">Modeling Pneumatic Robot Actuators &#8211; Part 2<\/a><\/li>\n<li><a href=\"https:\/\/www.mathworks.com\/videos\/matlab-and-simulink-robotics-arena-modeling-pneumatic-robot-actuators-part-3-1542794959663.html\">Modeling Pneumatic Robot Actuators &#8211; Part 3<\/a><\/li>\n<\/ul>\n<p>You can find the example models used in this video on <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/69331-modeling-pneumatic-robot-actuators\">MATLAB Central File Exchange<\/a>.<\/p>\n<p>Please feel free to download the models, try to throw the ball in the target, and post your comments or questions below.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2018\/12\/Trajectory_withcontroller.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>Today\u2019s guest post is by Veer Alakshendra. Veer will be sharing a Simscape &#8211; Simulink modeling and controls workflow for pneumatic actuators throwing a ball at a target.<br \/>\n&#8211; &#8212;<br \/>\nFor&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2018\/12\/05\/using-simscape-multibody-to-throw-an-object-at-a-target\/\">read more >><\/a><\/p>\n","protected":false},"author":151,"featured_media":2220,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,9,8,10,12],"tags":[23,232,234,230,117,220],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/2188"}],"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=2188"}],"version-history":[{"count":15,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/2188\/revisions"}],"predecessor-version":[{"id":4823,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/2188\/revisions\/4823"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/2220"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=2188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=2188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=2188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}