<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=17&amp;t=6825" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2010-12-14T17:22:15+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=17&amp;t=6825</id>
<entry>
<author><name><![CDATA[Ernif]]></name></author>
<updated>2010-12-14T17:22:15+01:00</updated>
<published>2010-12-14T17:22:15+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29335#p29335</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29335#p29335"/>
<title type="html"><![CDATA[Help with PWM servo slow moving function]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29335#p29335"><![CDATA[
Thanks a lot for the reply, it sure helped me a lot. I'm currently working on a servo class. I'll post the result/code when it's done.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2396">Ernif</a> — Tue Dec 14, 2010 5:22 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[PaulL]]></name></author>
<updated>2010-12-11T15:29:46+01:00</updated>
<published>2010-12-11T15:29:46+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29287#p29287</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29287#p29287"/>
<title type="html"><![CDATA[Help with PWM servo slow moving function]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29287#p29287"><![CDATA[
To get dynamic movement (not point-to-point as is done in the frame capture of the demo, but programatically controlled), you need to update the servo position gradually (and frequently to get smoothness) over time. There are a number of posts in my &quot;Roboard Experience&quot; thread regarding servo movement. My efforts are in VB.Net, but the methods are the same.<br /><br />When you tell a typical servo to move to a position, it knows nothing of speed, and just moves immediately to the position, as you have witnessed. So, you need to give it MANY positions to transition smoothly from one position to another.<br /><br />My method:<br /><br />I use PWM in &quot;continuous&quot; mode on the servos, and set the position using a Windows Multimedia Timer event (4mS interval seems to work fine), but I use RDTSC to calculate actual time elapsed and set the position accordingly. Distance = Speed / Time, so there's that. <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><br /><br />You need:<br /><br />* Start Position<br />* End Position<br />* Duration<br /><br />From there, you just interpolate the position of the move based on time elapsed since start of move:<br /><br />Position = (Fraction of Move * (EndPosition - StartPosition)) + StartPosition<br /><br />That's the basic method in a nutshell.<br /><br />You could even redo my accel / decel code from the &quot;Roboard Experience&quot; thread in C++, it will work the same way.<br /><br />Paul<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=741">PaulL</a> — Sat Dec 11, 2010 3:29 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Ernif]]></name></author>
<updated>2010-12-09T16:57:35+01:00</updated>
<published>2010-12-09T16:57:35+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29255#p29255</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29255#p29255"/>
<title type="html"><![CDATA[Help with PWM servo slow moving function]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6825&amp;p=29255#p29255"><![CDATA[
I've been trying to write a function that moves slowly a HITEC servo for some cam tracking business. Unfortunately, the best functions that I've been able to write is moving jerkily. My function consists of sending PWM pulses then to put a little sleep. Since servos are sometime fragiles, it's hard to do lots of test.<br /><br />Here is my function:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>if &#40;destination_position != current_position &amp;&amp; rcservo_IsPWMCompleted&#40;0&#41;&#41;<br />      &#123;<br />         int steps = &#40;destination_position - current_position&#41;/speed;<br />         rcservo_SendPWMPulses&#40;0, 20000L, current_position, 10&#41;;<br />         usleep&#40;&#40;1/speed&#41;*1000&#41;;<br />         current_position += steps;<br />      &#125;</code></dd></dl><br /><br />The speed value I set is from 0 to 1000. If I use the 20000L value I feel like the servo is moving like Robocop attending to a pistol duel contest: it's way too fast. Changing it though has made some pretty weird results.<br /><br />Anyone know a way to make it move slow and unjerky (smooth movement)?<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2396">Ernif</a> — Thu Dec 09, 2010 4:57 pm</p><hr />
]]></content>
</entry>
</feed>