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

<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>2011-10-08T21:34:20+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=5&amp;t=7511</id>
<entry>
<author><name><![CDATA[animaniac]]></name></author>
<updated>2011-10-08T21:34:20+01:00</updated>
<published>2011-10-08T21:34:20+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32446#p32446</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32446#p32446"/>
<title type="html"><![CDATA[king spider leg: my first IK program!]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32446#p32446"><![CDATA[
hi, I managed to compute the relations and assemble a program to move the leg. zqsd (azerty keyboard) moves the leg tip and ae moves it up and down by 10mm increments:<br /><br />void moveto(int moveto_ID, double moveto_TARGET, double moveto_SPEED)<br />{<br />int TARGET = 511 + floor(moveto_TARGET*195.6+0.5);;//511 is position 0 of dynamixel for the angle computation<br />int SPEED = min(1023, floor(moveto_SPEED*85.693+0.5));//1023 is the dynamixel maximum speed<br />dxl_write_word( moveto_ID, 32, SPEED );<br />dxl_write_word( moveto_ID, 30, TARGET );<br />}<br /><br />int main()<br />{<br />int CommStatus;<br />double position[3] = {188.5, 36, -115};//spider leg tip position from CM5 center<br />double angle[3] = {0, 0, 0};//corresponding values of the 3 dynamixel<br />double x = 64.5;//internal parameter (horizontal distance between the second dynamixel axis and the leg tip)<br />char c = 0;<br /><br />// Open device<br />if( dxl_initialize(DEFAULT_PORTNUM, DEFAULT_BAUDNUM) == 0 )<br />{<br />printf( &quot;Failed to open USB2Dynamixel!\n&quot; );<br />printf( &quot;Press any key to terminate...\n&quot; );<br />getch();<br />return 0;<br />}<br />else<br />printf( &quot;Succeed to open USB2Dynamixel!\n&quot; );<br /><br />while(1)<br />{<br />printf( &quot;Press any key to continue!(press ESC to quit)\n&quot; );<br />c = getch();<br />//printf( &quot;%d\n&quot;, c);<br />if(c == 27)<br />break;<br /><br />switch (c)<br />{<br />case 122:<br />position[0] = position[0]+10;<br />break;<br />case 115:<br />position[0] = position[0]-10;<br />break;<br />case 113:<br />position[1] = position[1]+10;<br />break;<br />case 100:<br />position[1] = position[1]-10;<br />break;<br />case 97:<br />position[2] = position[2]+10;<br />break;<br />case 101:<br />position[2] = position[2]-10;<br />break;<br /><br /><br />}<br />// Compute angles<br />if (position[0]&gt;73.5)//the first dynamixel needs a specific case if the tip goes &quot;behind&quot; the axis<br />angle[0] = atan2(position[1]-36, position[0]-73.5);<br />else<br />angle[0] = atan2(36-position[1], 73.5-position[0]);<br /><br />x = ( position[0]-73.5)/ cos( angle[0])-44;<br />angle[2] = asin(( x*x+position[2]*position[2]-12902)/12061);<br />angle[1] = -atan2(position[2], x)+ atan2( -93.5*cos (angle[2]), 64.5+93.5*sin (angle[2]));<br />//printf( &quot;%f   %f   %f   %f\n&quot;, x, angle[0], angle[1], angle[2]);<br /><br />moveto ( 1, angle[0], 0.5);<br />moveto ( 2, angle[1]-0.356, 0.5);//the offsets are the set angles between the dynamixel 0 positions and the kinematic lines<br />moveto ( 3, angle[2]-0.471, 0.5);<br />CommStatus = dxl_get_result();<br /><br />if( CommStatus != COMM_RXSUCCESS )<br />{<br />PrintCommStatus(CommStatus);<br />break;<br />}<br /><br />}<br /><br />maybe it's obvious from this, but I'm kinda new from C++ so I have a few questions:<br /><br />how do I start a new project? to do this I just copied the example and modified it. I tried to create a new project, but I missed something and it never worked.<br /><br />is there an easy way to control the speed instead of the position, for example the leg tip moving left continuously if I keep q pressed?<br /><br />do you know a good resource to learn C++ applied to robotics, book or website? books dedicated to robotics seem to focus mainly on building the robot, and I couldn't find C++ tutorials on robotics.<br /><br />thanks! this is a great forum!<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2296">animaniac</a> — Sat Oct 08, 2011 9:34 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[limor]]></name></author>
<updated>2011-10-05T00:07:35+01:00</updated>
<published>2011-10-05T00:07:35+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32431#p32431</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32431#p32431"/>
<title type="html"><![CDATA[king spider leg: my first IK program!]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32431#p32431"><![CDATA[
and here for example are some code examples: <!-- m --><a class="postlink" href="http://hexapodrobot.com/forum/viewforum.php?f=25">http://hexapodrobot.com/forum/viewforum.php?f=25</a><!-- m --><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2">limor</a> — Wed Oct 05, 2011 12:07 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[limor]]></name></author>
<updated>2011-10-04T23:56:56+01:00</updated>
<published>2011-10-04T23:56:56+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32429#p32429</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32429#p32429"/>
<title type="html"><![CDATA[king spider leg: my first IK program!]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32429#p32429"><![CDATA[
There are many hexapod IK codes around google land.<br />Check out <a href="http://forums.trossenrobotics.com/showthread.php?1352-Phoenix-a-multilegged-creature/page9" class="postlink">Zenta's hexapod</a> for some inspiration.<br /><div class='bbmedia' data-url='http://www.youtube.com/watch?v=_2Jc44GLTcU&amp;hl=en_US&amp;feature=player_embedded&amp;version=3' style='margin: 1px; display: inline-block; vertical-align: bottom;'><div style='width: 200px; height: 40px; border: 1px solid #999; display: table-cell; text-align: center; vertical-align: middle; font: 10px/10px Verdana; color: #555; opacity: 0.5;'><a style='color: #105289; text-decoration: none;' href='http://phpbbex.com/' target='_blank'>phpBB</a> &#91;media&#93;</div><script>if (typeof bbmedia == 'undefined') { bbmedia = true; var e = document.createElement('script'); e.async = true; e.src = 'js/bbmedia.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s); }</script></div><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2">limor</a> — Tue Oct 04, 2011 11:56 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[animaniac]]></name></author>
<updated>2011-10-08T21:10:45+01:00</updated>
<published>2011-10-04T10:04:08+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32428#p32428</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32428#p32428"/>
<title type="html"><![CDATA[king spider leg: my first IK program!]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=7511&amp;p=32428#p32428"><![CDATA[
hi, I wrote the equations for the end position of the king spider leg, but they too complex for me to invert them, do you know if the formula that gives the ax12 positions according to the leg position has been done before, or if a resource to compute the formula is available on the internet?<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2296">animaniac</a> — Tue Oct 04, 2011 10:04 am</p><hr />
]]></content>
</entry>
</feed>