<?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=5&amp;t=3744" />

<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>2009-07-28T13:53:27+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=5&amp;t=3744</id>
<entry>
<author><name><![CDATA[sprince09]]></name></author>
<updated>2009-07-28T13:53:27+01:00</updated>
<published>2009-07-28T13:53:27+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20916#p20916</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20916#p20916"/>
<title type="html"><![CDATA[Home made motion sensor for AX/RX servos]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20916#p20916"><![CDATA[
Perfect, that's exactly the kind of thing I was looking for. Thanks!<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1583">sprince09</a> — Tue Jul 28, 2009 1:53 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bullit]]></name></author>
<updated>2009-07-28T03:20:59+01:00</updated>
<published>2009-07-28T03:20:59+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20909#p20909</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20909#p20909"/>
<title type="html"><![CDATA[Home made motion sensor for AX/RX servos]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20909#p20909"><![CDATA[
Some good reference code is<br /><a href="http://websvn.hylands.org/listing.php?repname=Projects&amp;path=%2F&amp;rev=0&amp;sc=0" class="postlink">Dave Hylands stuff</a><br /><br />Look under AVR and IMU<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=173">Bullit</a> — Tue Jul 28, 2009 3:20 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[sprince09]]></name></author>
<updated>2009-07-27T19:01:48+01:00</updated>
<published>2009-07-27T19:01:48+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20892#p20892</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20892#p20892"/>
<title type="html"><![CDATA[Home made motion sensor for AX/RX servos]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3744&amp;p=20892#p20892"><![CDATA[
Hey all,<br /><br />I'm working on creating a motion sensor for the Robotis  AX/RX servos for one of my projects, and I've run up against a wall with how to set up my communications. I would like to emulate the communication protocol that the AX/RX servos use so that I can run the sensor from the same communication bus as the rest of the servo network, but I can't seem to get my AVR (atmega 168 @ 20.0 MHz) to behave properly. For testing purposes, I currently have the AVR hooked up to my computer over a serial port, and I've been dancing around with it  trying to send and receive packets of data. I'm using an interrupt based receive function on the AVR, and right now I'm just trying to have it echo back data packets to me as I send them. The code I have seems to work properly for single characters, but fails with multiple characters. Here's the relevant code:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code><br />volatile unsigned char packet&#91;255&#93; = &#123;0&#125;;<br />volatile unsigned char p_index = 0;<br /><br />int main&#40;void&#41;&#123;<br />    initialize&#40;&#41;;<br />    <br />    //main loop<br />    //do nothing, just wait for incoming packets to be handled by interrupt vector<br />    for&#40;;;&#41;;<br />&#125;<br /><br />ISR&#40;USART_RX_vect&#41;<br />&#123;<br />    //interrupt based UART reciever<br />    //store recieved value in packet&#91;&#93; and increment packet index<br />    cli&#40;&#41;;<br />    TCNT2 = 0;<br />    packet&#91;p_index++&#93; = UDR0;<br />    sei&#40;&#41;;<br />&#125;<br /><br />ISR&#40;TIMER2_COMPA_vect&#41;&#123;<br />   //called when TNCT2 &gt; timeout, indicating that a packet has finished<br />   //being recieved, and now needs to be parsed<br />   cli&#40;&#41;;<br />   if&#40;p_index &gt; 0&#41; read_packet&#40;&#41;;<br />   sei&#40;&#41;;<br />&#125;<br /><br />void read_packet&#40;void&#41;&#123;<br />        //echos back a data packet received on UART0<br />       int i;<br />      for&#40;i = 0; i &lt; p_index; i++&#41; uart_tx&#40;packet&#91;i&#93;&#41;;<br /><br />    //clear old packet and reset index<br />    p_index = 0;<br />    for&#40;i = 0; i &lt; 255; i++&#41; packet&#91;i&#93; = 0;<br />&#125;<br /><br /></code></dd></dl><br /><br />To summarize, what I've tried to do with this code is:<br />         - Wait for a character to arrive in the RX buffer of the AVR<br />         - Store the received character in global array and reset a timer<br />         - If the timer count exceeds a timeout value (set by me), the packet[] array<br />               gets echoed back to the computer from the AVR (this only works for 1<br />               character at a time)<br />        - Reset packet[] array and p_index after an echo has been sent<br /><br /><br />I guess what I'm really asking is if anyone has tried to implement their own sensors or anything that are compatible with the AX/RX series of servos, and if they have, could they explain how they managed their communications?<br /><br />*EDIT* <br />I get the proper number of characters echoed back to me from the AVR, but their values are incorrect. That's my main problem.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1583">sprince09</a> — Mon Jul 27, 2009 7:01 pm</p><hr />
]]></content>
</entry>
</feed>