2020-01-30 15:10:45 +01:00
<?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 08:53:16 +01:00
<!-- 2020 - 11 - 12 jeu. 08:53 -->
2020-01-30 15:10:45 +01:00
< 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" / >
2020-11-12 08:53:16 +01:00
< link rel = "stylesheet" type = "text/css" href = "./css/custom.css" / >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< script > M a t h J a x = {
tex: {
tags: 'ams',
macros: {bm: ["\\boldsymbol{#1}",1],}
2020-01-30 15:10:45 +01:00
}
2020-11-12 08:53:16 +01:00
};
< / script >
< script type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" > < / script >
2020-01-30 15:10:45 +01:00
< / head >
< body >
< div id = "org-div-home-and-up" >
2020-11-12 08:53:16 +01:00
< a accesskey = "h" href = "../index.html" > UP < / a >
2020-01-30 15:10:45 +01:00
|
2020-11-12 08:53:16 +01:00
< a accesskey = "H" href = "../index.html" > HOME < / a >
2020-01-30 15:10:45 +01:00
< / 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 >
2020-11-12 08:53:16 +01:00
< li > < a href = "#orgda17389" > 1. Simulink< / a > < / li >
< li > < a href = "#org926dcda" > 2. Initial Simulation< / a > < / li >
< li > < a href = "#org37a8a81" > 3. Change the equilibrium position< / a > < / li >
< li > < a href = "#org542e71a" > 4. Add external force< / a > < / li >
< li > < a href = "#org28c0d05" > 5. Change initial position< / a > < / li >
< li > < a href = "#orgc1f6457" > 6. Conclusion< / a > < / li >
2020-01-30 15:10:45 +01:00
< / 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 >
2020-11-12 08:53:16 +01:00
< div class = "note" id = "orgaf7b6a0" >
2020-01-30 15:24:24 +01:00
< p >
All the files (data and Matlab scripts) are accessible < a href = "data/simscape_gravity.zip" > here< / a > .
< / p >
< / div >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-orgda17389" class = "outline-2" >
< h2 id = "orgda17389" > < span class = "section-number-2" > 1< / span > Simulink< / h2 >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "orgda6de48" class = "figure" >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-org926dcda" class = "outline-2" >
< h2 id = "org926dcda" > < span class = "section-number-2" > 2< / span > Initial Simulation< / h2 >
2020-01-30 15:10:45 +01:00
< 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 >
2020-01-30 15:24:24 +01:00
< 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 >
2020-01-30 15:10:45 +01:00
2020-11-12 08:53:16 +01:00
< div id = "orgcdd507b" class = "figure" >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-org37a8a81" class = "outline-2" >
< h2 id = "org37a8a81" > < span class = "section-number-2" > 3< / span > Change the equilibrium position< / h2 >
2020-01-30 15:10:45 +01:00
< 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 >
2020-01-30 15:24:24 +01:00
< 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 >
2020-01-30 15:10:45 +01:00
2020-01-30 15:24:24 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "orgc5782c2" class = "figure" >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-org542e71a" class = "outline-2" >
< h2 id = "org542e71a" > < span class = "section-number-2" > 4< / span > Add external force< / h2 >
2020-01-30 15:10:45 +01:00
< 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 >
2020-01-30 15:24:24 +01:00
< 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 > );
2020-01-30 15:10:45 +01:00
2020-01-30 15:24:24 +01:00
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 >
2020-11-12 08:53:16 +01:00
< div id = "org2d311aa" class = "figure" >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-org28c0d05" class = "outline-2" >
< h2 id = "org28c0d05" > < span class = "section-number-2" > 5< / span > Change initial position< / h2 >
2020-01-30 15:10:45 +01:00
< 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 >
2020-01-30 15:24:24 +01:00
< 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 >
2020-01-30 15:10:45 +01:00
2020-01-30 15:24:24 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "org80b8e3e" class = "figure" >
2020-01-30 15:10:45 +01:00
< 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 >
2020-11-12 08:53:16 +01:00
< div id = "outline-container-orgc1f6457" class = "outline-2" >
< h2 id = "orgc1f6457" > < span class = "section-number-2" > 6< / span > Conclusion< / h2 >
2020-01-30 15:10:45 +01:00
< div class = "outline-text-2" id = "text-6" >
< p >
2020-01-30 15:24:24 +01:00
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 >
2020-11-12 08:53:16 +01:00
< div class = "important" id = "org55dcf26" >
2020-01-30 15:24:24 +01:00
< p >
2020-01-30 15:10:45 +01:00
Changing the equilibrium position of each joint seem the most practical solution.
< / p >
2020-01-30 15:24:24 +01:00
< / div >
2020-01-30 15:10:45 +01:00
< / div >
< / div >
< / div >
< div id = "postamble" class = "status" >
< p class = "author" > Author: Dehaeze Thomas< / p >
2020-11-12 08:53:16 +01:00
< p class = "date" > Created: 2020-11-12 jeu. 08:53< / p >
2020-01-30 15:10:45 +01:00
< / div >
< / body >
< / html >