<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Dynamic target position tracking</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/6155593149/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Motion/thread/6155593149/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Motion/thread/6155593149/</id><updated>2025-09-08T14:42:52.843000Z</updated><subtitle>Recent posts to Dynamic target position tracking</subtitle><entry><title>Dynamic target position tracking</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/6155593149/?limit=25#9696" rel="alternate"/><published>2025-09-08T14:42:52.843000Z</published><updated>2025-09-08T14:42:52.843000Z</updated><author><name>gseidel</name><uri>https://forge.codesys.com/u/gseidel/</uri></author><id>https://forge.codesys.com245f3fd139a193f04dbca7f5f7c878216faff6b5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi kporter,&lt;/p&gt;
&lt;p&gt;a more direct way would be to use SMC_FollowPosition to write the set positions directly to the servo drive.&lt;/p&gt;
&lt;p&gt;This FB has reacts on changes of the fSetPosition on each call, without a need for a rising edge on Execute.&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://content.helpme-codesys.com/en/libs/SM3_Basic/Current/SM3_Basic/POUs/Movement/Direct/SMC_FollowPosition.html." rel="nofollow"&gt;https://content.helpme-codesys.com/en/libs/SM3_Basic/Current/SM3_Basic/POUs/Movement/Direct/SMC_FollowPosition.html.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Georg&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Dynamic target position tracking</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/6155593149/?limit=25#2783" rel="alternate"/><published>2025-09-05T13:25:40.243000Z</published><updated>2025-09-05T13:25:40.243000Z</updated><author><name>serwis</name><uri>https://forge.codesys.com/u/serwis/</uri></author><id>https://forge.codesys.com60a04d5324eb458bf618b4a074251282e3a05c6a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I am trying to control a servo drive and dynamically set its position. I control the drive via EtherCAT with a cycle time of 500us. I use the MC_MoveAbsolute block for this. The problem is that when using a PID controller, I generate the positions I want the drive to move to on an ongoing basis, and I would like the position to be set immediately. The MC_MoveAbsolute block must receive a rising edge to execute, and I would like the movement to be performed without waiting for this edge. I have created a function that generates a rising edge every 1 ms, but I am unable to change this time to 500 µs because the TON function does not support times shorter than 1 ms. Below is the code to call the rising edge:&lt;/p&gt;
&lt;p&gt;IF Exe = TRUE THEN&lt;br/&gt;
        delay1(IN:=TRUE, PT:=T#1MS);&lt;br/&gt;
        IF delay1.Q = TRUE THEN&lt;br/&gt;
            Exe := FALSE;&lt;br/&gt;
            delay1(IN:=FALSE);&lt;br/&gt;
        END_IF&lt;br/&gt;
    END_IF &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;Exe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;THEN&lt;/span&gt;
&lt;span class="nt"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;PT&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;T&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;1MS&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Q&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;Exe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;IN&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;END_IF&lt;/span&gt;
&lt;span class="nt"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;Here is the code for calling the MC_MoveAbsolute function:&lt;br/&gt;
MoveDegree(&lt;br/&gt;
    Axis:= Tilt,&lt;br/&gt;
    Execute:= Exe, &lt;br/&gt;
    Position:= position_target - (base_angle_real * feedforward_turn),&lt;br/&gt;
    Velocity:= vel, &lt;br/&gt;
    Acceleration:= acc, &lt;br/&gt;
    Deceleration:= dec, &lt;br/&gt;
    Jerk:= jerk, &lt;br/&gt;
    Direction:= MC_DIRECTION.shortest, &lt;br/&gt;
    BufferMode:= MC_BUFFER_MODE.Aborting, &lt;br/&gt;
    Done=&amp;gt; , &lt;br/&gt;
    Busy=&amp;gt; , &lt;br/&gt;
    Active=&amp;gt; , &lt;br/&gt;
    CommandAborted=&amp;gt; , &lt;br/&gt;
    Error=&amp;gt; , &lt;br/&gt;
    ErrorID=&amp;gt; );&lt;/p&gt;
&lt;p&gt;I realize that there are probably better methods for performing this type of task. How can I implement motion with a dynamically changing setpoint?&lt;/p&gt;
&lt;p&gt;THANKS&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>