<?xml version="1.0" encoding="ISO-8859-1" ?><rss version="2.0">
<channel>
    <title>RoboRealm Forum</title>
    <link>http://www.RoboRealm.com/</link>
    <description>The newest forum threads.</description>
    <lastBuildDate>Tue, 30 Nov 1999 00:11:00 EST</lastBuildDate>
    <language>en-us</language>
    <copyright>Copyright: (C) RoboRealm, http://www.RoboRealm.com/</copyright>
    <docs>http://www.RoboRealm.com/</docs>

    <item>
        <title>No Title</title>
        <description>
        STeven,&lt;br&gt;&lt;br&gt;It looks like it&apos;s working now.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;&lt;br&gt;Dave        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>No Title</title>
        <description>
        Dave,&lt;br&gt;&lt;br&gt;Yes, we were able to determine what may be going wrong. The filter variable was changing the type of the variable (i.e. char to float) and this was not being recognized by the serial module. This has now been fixed (as of 2 days ago) but I&apos;m a little behind in getting back to emails!&lt;br&gt;&lt;br&gt;Can you download 2.20, install over your current system and give things a try again?&lt;br&gt;&lt;br&gt;STeven.        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>No Title</title>
        <description>
        STeven,&lt;br&gt;&lt;br&gt;Any luck in recreating my problem?&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;&lt;br&gt;Dave        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>No Title</title>
        <description>
        STeven,&lt;br&gt;&lt;br&gt;Thanks. Filter Variable seems to be what I&apos;m looking for, but when I place it in my RR file, the serial module stops sending the variables.&lt;br&gt;        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>No Title</title>
        <description>
        Dave,&lt;br&gt;&lt;br&gt;The above python code from mmason is much more flexible and a great example of python code ... but just in case you want to experiment a bit check out the variable filter module like&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.roborealm.com/help/Filter_Variables.php&quot; target=&quot;_blank&quot;&gt;http://www.roborealm.com/&lt;wbr&gt;help/&lt;wbr&gt;Filter_&lt;wbr&gt;Variables.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;which basically does what you want. We often use that to smooth out noisy data to reduce motor jitter. See if this helps.&lt;br&gt;&lt;br&gt;Martin,&lt;br&gt;&lt;br&gt;Yea, I would not recommend using the embedded editor ... it is just for simple scripts but for anything more advanced using a better editor certainly helps quite a bit! Besides, we&apos;re too busy creating modules than creating &quot;yet another text editor&quot;! :-)&lt;br&gt;&lt;br&gt;STeven.        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>No Title</title>
        <description>
        This is a great chance for me to play with the new python module.&amp;nbsp;&amp;nbsp;RR now lets you call python inline which means we don&apos;t have to fight with the @#$@#$ VB_Script anymore.&amp;nbsp;&amp;nbsp;I don&apos;t know if anyone has written any examples with the new python module, so here goes.&amp;nbsp;&amp;nbsp;&lt;br&gt;&lt;br&gt;Attached is a simple robo_file that tracks a red image and displays a marker at the average of the last five positions of that marker.&amp;nbsp;&amp;nbsp;The image processing is terrible, but the purpose is to illustrate the use of inline python.&lt;br&gt;&lt;br&gt;Here are the routinues that are used:&lt;br&gt;1. Set Variable (Set NUM_AVERAGE controls the number of averages to use, setting this to 0 will create divide by zero errors (Gee I should have thought of that earlier!) &lt;br&gt;2. Color_Filter (Find the red object in the image)&amp;nbsp;&amp;nbsp;You need to change this for your red.&lt;br&gt;3. Blob Size 50 A blog size cut to eliminate small objects, again might need adjustment.&lt;br&gt;4. Center of Gravity.&amp;nbsp;&amp;nbsp;Call the center of gravity calculation from RR.&lt;br&gt;5. Python Program.&amp;nbsp;&amp;nbsp;See below for detail.&lt;br&gt;6. Display Point.&amp;nbsp;&amp;nbsp;Display a point at the coordinates calculated by the Python Program.&lt;br&gt;&lt;br&gt;Python Program:&lt;br&gt;#Running Average in Python for RR by mmason April 2010&lt;br&gt;import rr&amp;nbsp;&amp;nbsp;#Import our beloved RR API&lt;br&gt;averageX = []&amp;nbsp;&amp;nbsp;#define a list of average values for x and y. &lt;br&gt;averageY = [] &lt;br&gt;cogX = rr.GetVariable(&quot;COG_X&quot;)&lt;br&gt;cogY = rr.GetVariable(&quot;COG_Y&quot;)&lt;br&gt;&lt;br&gt;#This variable contains the number of times to average the COG and is set from the interface.&lt;br&gt;numAverage = rr.GetVariable(&quot;NUM_AVERAGE&quot;)&lt;br&gt;&lt;br&gt;#Read in the previously stored average values. &lt;br&gt;for i in range(0,numAverage):&lt;br&gt;&amp;nbsp;&amp;nbsp;averageStorX = &quot;AVERAGEX_&quot;+str(i)&lt;br&gt;&amp;nbsp;&amp;nbsp;averageStorY = &quot;AVERAGEY_&quot;+str(i)&lt;br&gt;&amp;nbsp;&amp;nbsp;averageX.append(rr.GetVariable(averageStorX))&lt;br&gt;&amp;nbsp;&amp;nbsp;averageY.append(rr.GetVariable(averageStorY))&lt;br&gt;&lt;br&gt;#print averageX,averageY&lt;br&gt;&lt;br&gt;#remove the first value from the list:&lt;br&gt;averageX.pop(0)&lt;br&gt;averageY.pop(0)&lt;br&gt;#Add the newest value to the list:&lt;br&gt;averageX.append(cogX)&lt;br&gt;averageY.append(cogY)&lt;br&gt;&lt;br&gt;#Since I don&apos;t want to import numpy, I will quickly calculate the average.&lt;br&gt;totalX = 0&lt;br&gt;totalY = 0&lt;br&gt;for i in range(0,numAverage):&lt;br&gt; totalX += averageX[i]&lt;br&gt; totalY += averageY[i]&lt;br&gt;&lt;br&gt;cogx_average = totalX / numAverage&lt;br&gt;cogy_average = totalY / numAverage&lt;br&gt;#print cogx_average,cogy_average&lt;br&gt;&lt;br&gt;#write out the average values back to the roborealm api. &lt;br&gt;rr.SetVariable(&quot;COG_AVERAGE_X&quot;,cogx_average)&lt;br&gt;rr.SetVariable(&quot;COG_AVERAGE_Y&quot;,cogy_average)&lt;br&gt;for i in range(0,numAverage):&lt;br&gt;&amp;nbsp;&amp;nbsp;averageStorX = &quot;AVERAGEX_&quot;+str(i)&lt;br&gt;&amp;nbsp;&amp;nbsp;averageStorY = &quot;AVERAGEY_&quot;+str(i)&lt;br&gt;&amp;nbsp;&amp;nbsp;rr.SetVariable(averageStorX,averageX[i])&lt;br&gt;&amp;nbsp;&amp;nbsp;rr.SetVariable(averageStorY,averageY[i])&lt;br&gt;&lt;br&gt;I would recommend pasting back and forth from a better editor like notepad++. (Sorry STeven)&amp;nbsp;&amp;nbsp;Still the inline python is AWESOME!!! &lt;br&gt;&lt;br&gt;Let me know when you have the Kalman filter done.&lt;br&gt;&lt;br&gt;have fun!&lt;br&gt;mmason&lt;p&gt;&lt;a target=_blank href=&quot;http://www.roborealm.com/uploads/20930_1.JPG&quot;&gt;&lt;img border=1 src=&quot;http://www.roborealm.com/uploads/20930_thumb_1.jpg&quot;&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;        </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
    <item>
        <title>Smoothing Data</title>
        <description>
        I&apos;m sending COG_X and COG_BOX_SIZE serially to an arduino to run some motors. I&apos;d like to have a VR script to smooth or do a running average of the data before it gets sent to the serial module, but I&apos;m not sure of the VR syntax to do this.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;&lt;br&gt;Dave         </description>
        <link>http://www.roborealm.com/forum/index.php?thread_id=3677</link>
        <guid>http://www.roborealm.com/forum/index.php?thread_id=3677</guid>
        <pubDate>Tue, 30 Nov 1999 00:11:00 EST</pubDate>
    </item>
</channel>
</rss>
