308 lines
11 KiB
HTML
308 lines
11 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<!-- 2020-11-12 jeu. 09:21 -->
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
<title>Gravity with Simscape Models</title>
|
|
<meta name="generator" content="Org mode" />
|
|
<meta name="author" content="Dehaeze Thomas" />
|
|
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
|
|
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
|
|
<link rel="stylesheet" type="text/css" href="./css/custom.css"/>
|
|
<script type="text/javascript" src="./js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="./js/readtheorg.js"></script>
|
|
<script>MathJax = {
|
|
tex: {
|
|
tags: 'ams',
|
|
macros: {bm: ["\\boldsymbol{#1}",1],}
|
|
}
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="org-div-home-and-up">
|
|
<a accesskey="h" href="../index.html"> UP </a>
|
|
|
|
|
<a accesskey="H" href="../index.html"> HOME </a>
|
|
</div><div id="content">
|
|
<h1 class="title">Gravity with Simscape Models</h1>
|
|
<div id="table-of-contents">
|
|
<h2>Table of Contents</h2>
|
|
<div id="text-table-of-contents">
|
|
<ul>
|
|
<li><a href="#org951825b">1. Simulink</a></li>
|
|
<li><a href="#org498d7ed">2. Initial Simulation</a></li>
|
|
<li><a href="#orgb1186cb">3. Change the equilibrium position</a></li>
|
|
<li><a href="#org93e0199">4. Add external force</a></li>
|
|
<li><a href="#org61f107b">5. Change initial position</a></li>
|
|
<li><a href="#org84200cd">6. Conclusion</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<p>
|
|
We would like to include gravity in a Simscape multi-body model while starting the simulation at the equilibrium.
|
|
</p>
|
|
|
|
<p>
|
|
The basic idea is to first perform a simulation of the system until it goes at it rest position and save the rest position forces and deflection in each joint.
|
|
</p>
|
|
|
|
<p>
|
|
We can then think of three solutions to start a new simulation directly at the steady state position:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>Change the equilibrium position \(l_0\) of each joint such that at \(t=0\), \(k \times l_0\) is equal to the previously measured force in the joint.
|
|
Here, it is suppose that we constrain the initial position of the joint to be equal to zero.
|
|
Then, these forces cancel each other and the simulation starts at equilibrium.</li>
|
|
<li>Add an External force (or maybe the “Internal Force”) in the direction of the joint (the “resolution frame” is fixed to the solids) equal to the opposite of the previously measured force.</li>
|
|
<li>After the first simulation, measure the final change of position of each joint, then set the initial position to be the measured static position.
|
|
Then, the simulation will start at equilibrium, but all the elements will be “deflected”.</li>
|
|
</ul>
|
|
|
|
<p>
|
|
The three solutions are tested below.
|
|
</p>
|
|
|
|
<div id="outline-container-org951825b" class="outline-2">
|
|
<h2 id="org951825b"><span class="section-number-2">1</span> Simulink</h2>
|
|
<div class="outline-text-2" id="text-1">
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">open <span class="org-string">'gravity_test.slx'</span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<div id="orgd333d11" class="figure">
|
|
<p><img src="figs/simscape_model.png" alt="simscape_model.png" />
|
|
</p>
|
|
<p><span class="figure-number">Figure 1: </span>Simscape model used for the simulations</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org498d7ed" class="outline-2">
|
|
<h2 id="org498d7ed"><span class="section-number-2">2</span> Initial Simulation</h2>
|
|
<div class="outline-text-2" id="text-2">
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">g = <span class="org-type">-</span>10; <span class="org-comment">% [m/s^2]</span>
|
|
|
|
k = 1e3; <span class="org-comment">% Stiffness [N/m]</span>
|
|
c = 10; <span class="org-comment">% Damping [N/(m/s)]</span>
|
|
|
|
l0 = 0; <span class="org-comment">% Initial wanted position [m]</span>
|
|
leq = 0; <span class="org-comment">% equilibrium position [m]</span>
|
|
|
|
F_ext = 0; <span class="org-comment">% External force [N]</span>
|
|
F_act = 0; <span class="org-comment">% Actuator force [N]</span>
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">out_init = <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'gravity_test.slx'</span>)
|
|
|
|
out_init.d.Name = <span class="org-string">'Displacement'</span>;
|
|
out_init.Fm.Name = <span class="org-string">'Force Sensor'</span>;
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
|
subplot(1,2,1)
|
|
plot(out_init.d)
|
|
title(<span class="org-string">''</span>);
|
|
subplot(1,2,2)
|
|
plot(out_init.Fm)
|
|
title(<span class="org-string">''</span>);
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type"><<</span>plt<span class="org-type">-</span>matlab<span class="org-type">>></span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<div id="org521ff41" class="figure">
|
|
<p><img src="figs/sim_init.png" alt="sim_init.png" />
|
|
</p>
|
|
<p><span class="figure-number">Figure 2: </span>Initial Simulation (<a href="./figs/sim_init.png">png</a>, <a href="./figs/sim_init.pdf">pdf</a>)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgb1186cb" class="outline-2">
|
|
<h2 id="orgb1186cb"><span class="section-number-2">3</span> Change the equilibrium position</h2>
|
|
<div class="outline-text-2" id="text-3">
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">l0 = 0; <span class="org-comment">% Initial wanted position [m]</span>
|
|
leq = <span class="org-type">-</span>out_init.Fm.Data(end)<span class="org-type">/</span>k; <span class="org-comment">% equilibrium position [m]</span>
|
|
|
|
F_ext = 0; <span class="org-comment">% External force [N]</span>
|
|
F_act = 0; <span class="org-comment">% Actuator force [N]</span>
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">out = <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'gravity_test.slx'</span>);
|
|
|
|
out.d.Name = <span class="org-string">'Displacement'</span>;
|
|
out.Fm.Name = <span class="org-string">'Force Sensor'</span>;
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
|
subplot(1,2,1)
|
|
plot(out.d)
|
|
title(<span class="org-string">''</span>);
|
|
subplot(1,2,2)
|
|
plot(out.Fm)
|
|
title(<span class="org-string">''</span>);
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type"><<</span>plt<span class="org-type">-</span>matlab<span class="org-type">>></span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<div id="org585d417" class="figure">
|
|
<p><img src="figs/sim_change_eq_position.png" alt="sim_change_eq_position.png" />
|
|
</p>
|
|
<p><span class="figure-number">Figure 3: </span>Simulation after changing the equilibrium position of the joint (<a href="./figs/sim_change_eq_position.png">png</a>, <a href="./figs/sim_change_eq_position.pdf">pdf</a>)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org93e0199" class="outline-2">
|
|
<h2 id="org93e0199"><span class="section-number-2">4</span> Add external force</h2>
|
|
<div class="outline-text-2" id="text-4">
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">l0 = 0; <span class="org-comment">% Initial wanted position [m]</span>
|
|
leq = 0; <span class="org-comment">% equilibrium position [m]</span>
|
|
|
|
F_ext = <span class="org-type">-</span>out_init.Fm.Data(end); <span class="org-comment">% External force [N]</span>
|
|
F_act = 0; <span class="org-comment">% Actuator force [N]</span>
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">out = <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'gravity_test.slx'</span>);
|
|
|
|
out.d.Name = <span class="org-string">'Displacement'</span>;
|
|
out.Fm.Name = <span class="org-string">'Force Sensor'</span>;
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
|
subplot(1,2,1)
|
|
plot(out.d)
|
|
title(<span class="org-string">''</span>);
|
|
subplot(1,2,2)
|
|
plot(out.Fm)
|
|
title(<span class="org-string">''</span>);
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type"><<</span>plt<span class="org-type">-</span>matlab<span class="org-type">>></span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<div id="orge5eaa59" class="figure">
|
|
<p><img src="figs/sim_add_external_force.png" alt="sim_add_external_force.png" />
|
|
</p>
|
|
<p><span class="figure-number">Figure 4: </span>Simulater after adding an external force applied to the solid (<a href="./figs/sim_add_external_force.png">png</a>, <a href="./figs/sim_add_external_force.pdf">pdf</a>)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-org61f107b" class="outline-2">
|
|
<h2 id="org61f107b"><span class="section-number-2">5</span> Change initial position</h2>
|
|
<div class="outline-text-2" id="text-5">
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">l0 = out_init.d.Data(end); <span class="org-comment">% Initial wanted position [m]</span>
|
|
leq = 0; <span class="org-comment">% equilibrium position [m]</span>
|
|
|
|
F_ext = 0; <span class="org-comment">% External force [N]</span>
|
|
F_act = 0; <span class="org-comment">% Actuator force [N]</span>
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab">out = <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'gravity_test.slx'</span>);
|
|
|
|
out.d.Name = <span class="org-string">'Displacement'</span>;
|
|
out.Fm.Name = <span class="org-string">'Force Sensor'</span>;
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
|
subplot(1,2,1)
|
|
plot(out.d)
|
|
title(<span class="org-string">''</span>);
|
|
subplot(1,2,2)
|
|
plot(out.Fm)
|
|
title(<span class="org-string">''</span>);
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-matlab"><span class="org-type"><<</span>plt<span class="org-type">-</span>matlab<span class="org-type">>></span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<div id="orgc7e04f4" class="figure">
|
|
<p><img src="figs/sim_change_initial_position.png" alt="sim_change_initial_position.png" />
|
|
</p>
|
|
<p><span class="figure-number">Figure 5: </span>Simulation after changing the initial position of the joint (<a href="./figs/sim_change_initial_position.png">png</a>, <a href="./figs/sim_change_initial_position.pdf">pdf</a>)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-org84200cd" class="outline-2">
|
|
<h2 id="org84200cd"><span class="section-number-2">6</span> Conclusion</h2>
|
|
<div class="outline-text-2" id="text-6">
|
|
<p>
|
|
Three techniques:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>Change the equilibrium position
|
|
<ul class="org-ul">
|
|
<li>This does not change the equilibrium position of the system</li>
|
|
</ul></li>
|
|
<li>Add external force
|
|
<ul class="org-ul">
|
|
<li>May not be physical</li>
|
|
</ul></li>
|
|
<li>Change the initial position
|
|
<ul class="org-ul">
|
|
<li>The static position is not the same as the static position without gravity</li>
|
|
<li>Very easy to implement</li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
<div class="important" id="orgdb2539b">
|
|
<p>
|
|
Changing the equilibrium position of each joint seem the most practical solution.
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="postamble" class="status">
|
|
<p class="author">Author: Dehaeze Thomas</p>
|
|
<p class="date">Created: 2020-11-12 jeu. 09:21</p>
|
|
</div>
|
|
</body>
|
|
</html>
|