<?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=3612" />

<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-06-19T12:26:44+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=5&amp;t=3612</id>
<entry>
<author><name><![CDATA[limor]]></name></author>
<updated>2009-06-19T12:26:44+01:00</updated>
<published>2009-06-19T12:26:44+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20282#p20282</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20282#p20282"/>
<title type="html"><![CDATA[AX-12 + usb2dynamixel + libftdi (Linux)]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20282#p20282"><![CDATA[
63 packet round-trips is not very good. In the past we have seen 10 or even 20 times better performance.<br />You can change the response delay register in the servo using your code <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><br />just change the outbound packet from PING to set the relevant register(s) on the servo.<br /><br />The robot terminal firmware on the CM5 sends packets like you do to the servos, on demand, allowing users to interactively send these packets and get the response interpreted as text. (one serial port talks to the servos, the other talks to the PC).<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2">limor</a> — Fri Jun 19, 2009 12:26 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Mandor]]></name></author>
<updated>2009-06-18T21:11:10+01:00</updated>
<published>2009-06-18T21:11:10+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20268#p20268</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20268#p20268"/>
<title type="html"><![CDATA[AX-12 + usb2dynamixel + libftdi (Linux)]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20268#p20268"><![CDATA[
Hi Limor,<br />Here is a working code :<br /><dl class="codebox"><dt>Code: </dt><dd><code><br />#include &lt;stdio&gt;<br />#include &lt;ftdi&gt;<br />#include &lt;sys&gt;<br /><br />int main&#40;int argc, char **argv&#41;<br />&#123;<br />  int ret;<br />  struct ftdi_context ftdic;<br />  ftdi_init&#40;&amp;ftdic&#41;;<br />  // reset everything in case we messed everything up with a control-c..<br />  if&#40;&#40;ret = ftdi_usb_open&#40;&amp;ftdic, 0x0403, 0x6001&#41;&#41; &lt; 0&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;unable to open ftdi device: %d &#40;%s&#41;\n&quot;, ret, ftdi_get_error_string&#40;&amp;ftdic&#41;&#41;;<br />      return EXIT_FAILURE;<br />    &#125;<br />  ftdi_usb_purge_buffers&#40;&amp;ftdic&#41;;<br />  usb_reset&#40;ftdic.usb_dev&#41;;<br /><br />  ftdi_usb_close&#40;&amp;ftdic&#41;;<br />  <br />  // real code starts here<br />  if&#40;&#40;ret = ftdi_usb_open&#40;&amp;ftdic, 0x0403, 0x6001&#41;&#41; &lt; 0&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;unable to open ftdi device: %d &#40;%s&#41;\n&quot;, ret, ftdi_get_error_string&#40;&amp;ftdic&#41;&#41;;<br />      return EXIT_FAILURE;<br />    &#125;<br /><br /><br />  // Read out FTDIChip-ID of R type chips<br />  if &#40;ftdic.type == TYPE_R&#41;<br />    &#123;<br />      unsigned int chipid;<br />      printf&#40;&quot;ftdi_read_chipid: %d\n&quot;, ftdi_read_chipid&#40;&amp;ftdic, &amp;chipid&#41;&#41;;<br />      printf&#40;&quot;FTDI chipid: %X\n&quot;, chipid&#41;;<br />    &#125;<br /><br />  // 1 Mb<br />  if &#40;&#40;ret = ftdi_set_baudrate&#40;&amp;ftdic, 1000000&#41;&#41; != 0&#41;<br />    fprintf&#40;stderr, &quot;error setting baudrate, ret=%d\n&quot;, ret&#41;;      <br />  if &#40;ftdi_set_line_property&#40;&amp;ftdic, BITS_8, STOP_BIT_1, NONE&#41; == -1&#41;<br />    fprintf&#40;stderr, &quot;error setting properties&quot;&#41;;<br />  if &#40;ftdi_setflowctrl&#40;&amp;ftdic, SIO_DISABLE_FLOW_CTRL&#41; == -1&#41;<br />      fprintf&#40;stderr, &quot;error setting flow control&quot;&#41;;<br />  <br />  ftdi_write_data_set_chunksize&#40;&amp;ftdic, 3&#41;;<br />  ftdi_read_data_set_chunksize&#40;&amp;ftdic, 256&#41;;<br /><br />  struct timeval tv;<br />  gettimeofday&#40;&amp;tv, 0x0&#41;;<br /><br />  for &#40;size_t k = 0; k &lt; 100; ++k&#41;<br />    &#123;<br />      ret = 0;<br />      // ping servos<br />      unsigned char buf&#91;&#93; = &#123; 0xff, 0xff, 17, 0x02, 0x1, 0xf3 &#125;;<br />      unsigned char checksum = 0;<br />      int len = 6;<br />      for&#40;size_t i = 2; i &lt; len - 1; i++&#41;<br />   checksum += buf&#91;i&#93;;      <br />      buf&#91;5&#93; = ~checksum;<br />      <br />      int ret = ftdi_write_data&#40;&amp;ftdic, buf, len&#41;;<br /><br />      unsigned char b;<br />      int ret2 = 0; <br />      unsigned char buffer&#91;20&#93;;<br />      do <br />   &#123;<br />     ret2 += ftdi_read_data&#40;&amp;ftdic, buffer, 1&#41;;<br />   &#125;<br />      while &#40;ret2 != ret&#41;;<br />    &#125;<br />  struct timeval tv2;<br />  gettimeofday&#40;&amp;tv2, 0x0&#41;;<br />  long sec = tv2.tv_sec - tv.tv_sec;<br />  long us = tv2.tv_usec - tv.tv_usec;  <br />  float t = &#40;sec + us * 1e-6&#41; / 100;<br />  printf&#40;&quot;time: %f\n&quot;, t&#41;;<br />  ftdi_usb_close&#40;&amp;ftdic&#41;;<br />  ftdi_deinit&#40;&amp;ftdic&#41;;<br />  <br />  return EXIT_SUCCESS;<br />&#125;<br /></code></dd></dl><br />without changing the delay-response (I have no Windows machine to use the robot-terminal; and no CM-5...), I reliably get:<br />ftdi_read_chipid: 0<br />FTDI chipid: E35BFCF9<br />time: 0.015821<br /><br />That's sounds good <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><br /><br />I will try to change the delay asap.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1175">Mandor</a> — Thu Jun 18, 2009 9:11 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[limor]]></name></author>
<updated>2009-06-18T17:08:16+01:00</updated>
<published>2009-06-18T17:08:16+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20262#p20262</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20262#p20262"/>
<title type="html"><![CDATA[AX-12 + usb2dynamixel + libftdi (Linux)]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20262#p20262"><![CDATA[
Hi Mandor, <br />thanks for posting the code.<br />can you please measure the latecy?<br />you can use gettimeofday and run the ping few hundred times<br /><br />Also, please set with robot terminal the delay-response time of servos. The value can go as low as 0. (see the servo dynamixel documentation)<br /><br />thanks<br />Limor<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2">limor</a> — Thu Jun 18, 2009 5:08 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Mandor]]></name></author>
<updated>2009-06-17T21:35:46+01:00</updated>
<published>2009-06-17T21:35:46+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20245#p20245</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20245#p20245"/>
<title type="html"><![CDATA[AX-12 + usb2dynamixel + libftdi (Linux)]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20245#p20245"><![CDATA[
Actually, I get a reply when I change the chunck size to 6...<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1175">Mandor</a> — Wed Jun 17, 2009 9:35 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Mandor]]></name></author>
<updated>2009-06-17T21:17:27+01:00</updated>
<published>2009-06-17T21:17:27+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20244#p20244</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20244#p20244"/>
<title type="html"><![CDATA[AX-12 + usb2dynamixel + libftdi (Linux)]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=3612&amp;p=20244#p20244"><![CDATA[
Hi<br /><br />I'm trying to use my brand new usb2dynamixel. I 've read here that the best way to go was to use libftdi (low latency). I'm trying to ping my dynamixel but I don't see any answer... Here is my current code:<br /><dl class="codebox"><dt>Code: </dt><dd><code><br />#include &lt;stdio&gt;<br />#include &lt;ftdi&gt;<br />#include &quot;ax12.h&quot;<br /><br />int main&#40;int argc, char **argv&#41;<br />&#123;<br />  int ret;<br />  struct ftdi_context ftdic;<br />  ftdi_init&#40;&amp;ftdic&#41;;<br />  <br />  if&#40;&#40;ret = ftdi_usb_open&#40;&amp;ftdic, 0x0403, 0x6001&#41;&#41; &lt; 0&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;unable to open ftdi device: %d &#40;%s&#41;\n&quot;, ret, ftdi_get_error_string&#40;&amp;ftdic&#41;&#41;;<br />      return EXIT_FAILURE;<br />    &#125;<br />  <br />  // Read out FTDIChip-ID of R type chips<br />  if &#40;ftdic.type == TYPE_R&#41;<br />    &#123;<br />      unsigned int chipid;<br />      printf&#40;&quot;ftdi_read_chipid: %d\n&quot;, ftdi_read_chipid&#40;&amp;ftdic, &amp;chipid&#41;&#41;;<br />      printf&#40;&quot;FTDI chipid: %X\n&quot;, chipid&#41;;<br />    &#125;<br />  <br />  if &#40;&#40;ret = ftdi_set_baudrate&#40;&amp;ftdic, 1000000&#41;&#41; != 0&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;error setting baudrate, ret=%d\n&quot;, ret&#41;;      <br />    &#125;<br />  if &#40;ftdi_set_line_property&#40;&amp;ftdic, BITS_8, STOP_BIT_1, NONE&#41; == -1&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;error setting properties&quot;&#41;;<br />    &#125;<br />  if &#40;ftdi_setflowctrl&#40;&amp;ftdic, SIO_DISABLE_FLOW_CTRL&#41; == -1&#41;<br />    &#123;<br />      fprintf&#40;stderr, &quot;error setting flow control&quot;&#41;;<br />    &#125;<br /><br />  ftdi_write_data_set_chunksize&#40;&amp;ftdic, 1&#41;;<br />  ftdi_read_data_set_chunksize&#40;&amp;ftdic, 1&#41;;<br />  // ping servos<br />  for &#40;unsigned char i = 0; i &lt; 30; ++i&#41;<br />    &#123;<br />      unsigned char buf&#91;&#93; = &#123; 0xff, 0xff, i, 0x02, 0x01, 0xf3 &#125;;<br />      printf&#40;&quot;id=%d\n&quot;, i&#41;;<br />      unsigned char checksum = 0;<br />      int len = 6;<br />      for&#40;size_t i = 2; i &lt; len - 1; i++&#41;<br />   checksum += buf&#91;i&#93;;<br />      <br />      buf&#91;5&#93; = ~checksum;<br />      <br />      <br />      ret = ftdi_write_data&#40;&amp;ftdic, buf, len&#41;;<br />      printf&#40;&quot;ret=%d\n&quot;, ret&#41;;<br />    &#125;<br />  unsigned char b;<br />  ret = 0;<br />  do <br />    &#123;<br />      ret = ftdi_read_data&#40;&amp;ftdic, &amp;b, 1&#41;;<br />    &#125;<br />  while &#40;ret == 0&#41;;<br />  printf &#40;&quot;ret = %d\n&quot;, ret&#41;;<br />  <br />  ftdi_usb_close&#40;&amp;ftdic&#41;;<br />  ftdi_deinit&#40;&amp;ftdic&#41;;<br />  <br />  return EXIT_SUCCESS;<br />&#125;<br /></code></dd></dl><br /><br />ret is 0 and consequently the code never ends. Any idea ? does anybody here use usb2dynamixel and Linux ?<br /><br />Thanks.<br /><br />-- <br />Mandor<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1175">Mandor</a> — Wed Jun 17, 2009 9:17 pm</p><hr />
]]></content>
</entry>
</feed>