<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">FYI option 2 is the default method for TwinCAT.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Either method is fine, as long as you take care to reduce timing errors. You should call ecrt_master_application_time() just before the ecrt_master_send() to reduce the amount of time variation between telling the master the PC's time
and that time going on the wire.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">If you are using distributed clocks you care about drift. If you are doing coordinated motion on your robot you should probably be using distributed clocks. If "all the clocks are drifting, as long as they are synchronized with respect
to each other" then that is actually what you are trying to achieve anyway. You choose one clock as the master for the system and sync the rest to it. The main thing you need to achieve is make sure the master always sends out its frame so that it reaches
all of the slaves before the slaves distributed clock SYNC0 events fire.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I use option 2 for a few reasons:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">- Linux calculates a Timebase Frequency on startup. It is only a quick calculation so that it does not hold up booting Linux for too long, but that also means it is not particularly accurate, and can be different each time you reboot
Linux. This affects the speed of your PC's clock so, if you use option 1, each time you reboot Linux your system may run at a different speed. (Note, I use RTAI and the time base can be calibrated and set so that it is the same each time, however I auto
calibrate my PC to my reference slave clock.)<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">- I use Yaskawa axes that do not like too great a drift compensation. If the timebase calculation above is too far out my axes can have issues and lose their sync.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">- I figure a slaves clock is most likely to more similar to the rest of the slaves clocks, so there will be minimal drift compensation (opinion, not confirmed).<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">- If you use option 1 you rely on the time between calling ecrt_master_application_time() and the frame going on the wire and the position of the message in that frame being as constant as possible otherwise the slaves will get a lot
of jitter in their drift compensations. The Etherlab master has multiple code paths which take various amounts of time each cycle so you cannot control this jitter. Using option 2 often means that the slaves have a much more stable drift compensation and
all you need to really care about in your application code is that you keep waking up in time to process the datagrams, do your calculation and send out the new data before the slaves need it. You don't really care too much about jitter here.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Lastly, if you are getting timing error's using option 2 then your master time compensation method is probably wrong. I don't use the timing method from the rtai_rtdm_dc example so I don't know what might be wrong there.<span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Regards,<o:p></o:p></p>
<p class="MsoPlainText">Graeme<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span lang="EN-US" style="mso-fareast-language:EN-NZ">-----Original Message-----<br>
From: etherlab-users <etherlab-users-bounces@etherlab.org> On Behalf Of Mohsen Alizadeh Noghani<br>
Sent: Saturday, 17 November 2018 9:46 PM<br>
To: etherlab-users@etherlab.org<br>
Subject: [etherlab-users] Syncing master to the reference slave: should I care?</span></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Hello everyone.<o:p></o:p></p>
<p class="MsoPlainText">In terms of choosing the reference clock in the network, there are two options. In the first method, PC clock is chosen as the reference and in the second one, slave 0's clock is the reference.<o:p></o:p></p>
<p class="MsoPlainText">1- Syncing slave 0's clock to the master (application) time: this is the method used by default by the EtherLab master.<o:p></o:p></p>
<p class="MsoPlainText">2- Syncing master (application) time to slave 0: requires implementing the synchronization algorithm by the user, as seen in "rtai_rtdm_dc"<o:p></o:p></p>
<p class="MsoPlainText">example. This method boasts lower drift, as the slave's clock is more stable.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">However, in my experience, the latter method is more prone to master's jitter, and thus less reliable during a long-term run (e.g. a 24h test under stress).<o:p></o:p></p>
<p class="MsoPlainText">My area of application is robot motion control.<o:p></o:p></p>
<p class="MsoPlainText">The question is, using the first method, should I care about clock drift? I feel that, even if all the clocks are drifting, as long as they are synchronized with respect to each other, there shouldn't be any issues.<o:p></o:p></p>
<p class="MsoPlainText">Best,<o:p></o:p></p>
<p class="MsoPlainText">Mohsen<o:p></o:p></p>
<p class="MsoPlainText">_______________________________________________<o:p></o:p></p>
<p class="MsoPlainText">etherlab-users mailing list<o:p></o:p></p>
<p class="MsoPlainText"><a href="mailto:etherlab-users@etherlab.org"><span style="color:windowtext;text-decoration:none">etherlab-users@etherlab.org</span></a><o:p></o:p></p>
<p class="MsoPlainText"><a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users"><span style="color:windowtext;text-decoration:none">http://lists.etherlab.org/mailman/listinfo/etherlab-users</span></a><o:p></o:p></p>
</div>
</body>
</html>