http://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&feed=atom&action=historyOctaveMATLAB - Revision history2024-03-29T04:42:46ZRevision history for this page on the wikiMediaWiki 1.24.4http://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=217&oldid=prevRdiankov at 03:06, 16 May 20122012-05-16T03:06:18Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 03:06, 16 May 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 216:</td>
<td colspan="2" class="diff-lineno">Line 216:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>logid = orEnvCreateProblem('logging')</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>logid = orEnvCreateProblem('logging')</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('savescene filename myscene.env.xml',logid)</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('savescene filename myscene.env.xml',logid)</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></source></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">=== Loading IKFast Solvers ===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Most robots when loaded at first, do not have any IK solvers set. Use the following code to load a Transform6D IK solver to the currently set active manipulator:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><source lang="matlab"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">probid = orEnvCreateProblem('ikfast');</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">s = orProblemSendCommand(['LoadIKFastSolver ' robotname ' Transform6D'],probid)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></source></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Set the active manipulator with:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><source lang="matlab"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">manips = orRobotGetManipulators(robotid);</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">manipname = manips{1}.name;</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">orRobotSetActiveManipulator(robotid,manipname);</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=208&oldid=prevRdiankov at 11:46, 6 February 20122012-02-06T11:46:42Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 11:46, 6 February 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 136:</td>
<td colspan="2" class="diff-lineno">Line 136:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Executing planners - A Grasping Example ===</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Executing planners - A Grasping Example ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[image:Openrave_dishwasher.jpg<del class="diffchange diffchange-inline">|right</del>|350px]]  </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[image:Openrave_dishwasher.jpg|350px]]  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>In this part, we'll be loading the manipulation plugin and using its various features to plan in the lab1.env.xml workspace with the BarrettWAM. The manipulation plugin exposes a Manipulation ProblemInstance and the Inverse Kinematics functions for the Barrett WAM arm.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>In this part, we'll be loading the manipulation plugin and using its various features to plan in the lab1.env.xml workspace with the BarrettWAM. The manipulation plugin exposes a Manipulation ProblemInstance and the Inverse Kinematics functions for the Barrett WAM arm.</div></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=207&oldid=prevRdiankov at 11:45, 6 February 20122012-02-06T11:45:51Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 11:45, 6 February 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 165:</td>
<td colspan="2" class="diff-lineno">Line 165:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To plan for a configuration space goal for the arm joints of the robot, type:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To plan for a configuration space goal for the arm joints of the robot, type:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="matlab"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="matlab"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('MoveManipulator <del class="diffchange diffchange-inline">armvals </del>-0.005617 1.07 0.233 2.096 -4.194 -0.235 1.302520',manipid)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('MoveManipulator <ins class="diffchange diffchange-inline">goal </ins>-0.005617 1.07 0.233 2.096 -4.194 -0.235 1.302520',manipid)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 199:</td>
<td colspan="2" class="diff-lineno">Line 199:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Can now plan to original position:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Can now plan to original position:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="matlab"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><source lang="matlab"></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('MoveManipulator <del class="diffchange diffchange-inline">armvals </del>0 0 0 0 0 0 0',manipid);</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>orProblemSendCommand('MoveManipulator <ins class="diffchange diffchange-inline">goal </ins>0 0 0 0 0 0 0',manipid);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=206&oldid=prevRdiankov at 11:42, 6 February 20122012-02-06T11:42:53Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 11:42, 6 February 2012</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Installation ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Installation ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Unfortunately, MATLAB mex file binaries cannot be re-distributed with OpenRAVE since there are many versions of the tool and the compilers are non-free. Therefore, starting with OpenRAVE 0.4, the mex source files are distributed in the '''share/openrave-*/matlab''' directory. In order to use MATLAB, will need to compile each of the '''cpp''' files into '''mex''' files and add that directory to your MATLAB path. Windows users have a special '''runmex.bat''' file to help them with this.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Unfortunately, MATLAB mex file binaries cannot be re-distributed with OpenRAVE since there are many versions of the tool and the compilers are non-free. Therefore, starting with OpenRAVE 0.4, the mex source files are distributed in the '''share/openrave-*/matlab''' directory. In order to use MATLAB, will need to compile each of the '''cpp''' files into '''mex''' files and add that directory to your MATLAB path. <ins class="diffchange diffchange-inline">The files are:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">- orcreate.cpp</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">- orread.cpp</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">- orwrite.cpp</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Windows users have a special '''runmex.bat''' file to help them with this.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=91&oldid=prevRdiankov at 18:20, 20 June 20112011-06-20T18:20:54Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 18:20, 20 June 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 47:</td>
<td colspan="2" class="diff-lineno">Line 47:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Basic commands ===</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Basic commands ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>First start '''openrave''' and leave it in the background. Then start an Octave or Matlab instance and make sure the paths to the Octave/Matlab scripts are added to the path <del class="diffchange diffchange-inline">([[Installation:OpenRAVE|Install OpenRAVE]])</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>First start '''openrave''' and leave it in the background. Then start an Octave or Matlab instance and make sure the paths to the Octave/Matlab scripts are added to the path<ins class="diffchange diffchange-inline">.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To load a simple scene with the Barrett WAM and Hand:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To load a simple scene with the Barrett WAM and Hand:</div></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=90&oldid=prevRdiankov at 15:07, 20 June 20112011-06-20T15:07:50Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 15:07, 20 June 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>__NOTITLE__</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>__NOTITLE__</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">== Installation ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Unfortunately, MATLAB mex file binaries cannot be re-distributed with OpenRAVE since there are many versions of the tool and the compilers are non-free. Therefore, starting with OpenRAVE 0.4, the mex source files are distributed in the '''share/openrave-*/matlab''' directory. In order to use MATLAB, will need to compile each of the '''cpp''' files into '''mex''' files and add that directory to your MATLAB path. Windows users have a special '''runmex.bat''' file to help them with this.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=25&oldid=prevRdiankov at 07:42, 16 March 20112011-03-16T07:42:39Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 07:42, 16 March 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">{{Languages}}</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">__NOTITLE__</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Introduction to Scripting ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Rdiankovhttp://openrave.programmingvision.com/wiki/index.php?title=OctaveMATLAB&diff=22&oldid=prevRdiankov: Created page with "{{Languages}} == Introduction to Scripting == One of the biggest features that separates OpenRAVE from other simulation/planning environments is that it supports scripting over ..."2011-03-16T07:39:56Z<p>Created page with "{{Languages}} == Introduction to Scripting == One of the biggest features that separates OpenRAVE from other simulation/planning environments is that it supports scripting over ..."</p>
<p><b>New page</b></p><div>{{Languages}}<br />
== Introduction to Scripting ==<br />
<br />
One of the biggest features that separates OpenRAVE from other simulation/planning environments is that it supports scripting over the network. This makes it possible to free OpenRAVE of complex GUIs. At initialization, OpenRAVE starts listening on specific ports for the commands. This allows any computer to open a socket connection with OpenRAVE, which can be running on a different computer, and communicate with it. The official release supports Matlab and Octave as the scripting engines. Note that all script commands are sent as text across the network; therefore, it is possible to do everything in Python or Perl.<br />
<br />
The rest of this document is written using the Matlab/Octave functions found in the '''matlab/''' directory. For any function, type 'help functionname' to get a help message describing its parameters and usage. Some formatting rules:<br />
<br />
* All OpenRAVE functions start with '''or'''.<br />
* All KinBody specific functions start with '''orBody'''.<br />
* All Robot specific functions start with '''orRobot'''. Every robot can use all '''orBody''' functions.<br />
* All general environment functions start with '''orEnv'''.<br />
* All problem instance specific functions start with '''orProblem'''<br />
<br />
Check out the RaveServer constructor in '''src/server.cpp''' for a complete list of commands supported.<br />
<br />
== Examples ==<br />
<br />
All examples can be found in '''$INSTALL/share/openrave/octave'''<br />
<br />
To run '''MATLAB/Octave''' examples, first start openrave and then in a separate terminal execute the '''*.m''' files.<br />
<br />
== Communicating with OpenRAVE ==<br />
<br />
Usually communicating with an OpenRAVE instance running on the same computer as the scripting environment is simple. Just call the methods in the <b>matlab</b> folder directly without having to worry about setting ip address. If OpenRAVE is running on a different computer, the IP address will have to be set manually through a global variable '''orConnectionParams'''. To set the address of the remote OpenRAVE in Octave/Matlab instance type<br />
'''global orConnectionParams'''<br />
'''orConnectionParams.ip = 'myopenrave_ip'; '''<br />
'''orConnectionParams.port = 4765; '''<br />
<br />
The scripting environment can communicate with multiple OpenRAVE instances at once, just set orConnectionParams to the appropriate instance. Also, OpenRAVE can handle multiple scripting environments talking to the same instance simultaneously.<br />
<br />
[[image:Openrave_network.png|600px]]<br />
<br />
The default port openrave starts is 4765, use the '''-server''' option to change the port. For example,<br />
'''./openrave -server 3000'''<br />
<br />
starts openrave to listen for connections on port 3000.<br />
<br />
== Tutorial ==<br />
<br />
'''NOTE:''' Remember that warnings and responses can appear both in the Matlab/Octave window and the console window where openrave is started from.<br />
<br />
=== Basic commands ===<br />
<br />
First start '''openrave''' and leave it in the background. Then start an Octave or Matlab instance and make sure the paths to the Octave/Matlab scripts are added to the path ([[Installation:OpenRAVE|Install OpenRAVE]])<br />
<br />
To load a simple scene with the Barrett WAM and Hand:<br />
<source lang="matlab"><br />
orEnvLoadScene('data/lab1.env.xml', 1)<br />
</source><br />
<br />
The 1 is a flag to reset the whole OpenRAVE scene before loading '''lab1.env.xml'''. If it wasn't there, lab1.env.xml would get appended to the current OpenRAVE scene. Now let's query and display all the objects in the scene<br />
<source lang="matlab"><br />
bodies = orEnvGetBodies()<br />
celldisp(bodies)<br />
</source><br />
<br />
Every object has a unique id. Use this id for any function that performs an operation on the object. We can move the first joint of the robot 0.5 radians by<br />
<source lang="matlab"><br />
orRobotSetDOFValues(1,0.5,0)<br />
</source><br />
<br />
or the first 10 joints:<br />
<source lang="matlab"><br />
orRobotSetDOFValues(1,0.5*ones(1,10),0:9)<br />
</source><br />
<br />
Here '1' is the unique id of the robot.<br />
<br />
If the third argument is not specified, then the default degrees of fredom (joints) used will be the '''active DOFs'''. The default '''active DOFs''' are all the joints of the robot. To make only the first 7 joints active type:<br />
<source lang="matlab"><br />
orRobotSetActiveDOFs(1,0:6,0)<br />
</source><br />
<br />
To get the number of active dofs type:<br />
<source lang="matlab"><br />
orRobotGetActiveDOF(1)<br />
</source><br />
<br />
The concept of '''active DOFs''' is very powerful. All planners search only in the '''active DOFs''' when planning. In this example, the robot is a combination of an arm and a hand. Most of the time, we would only want to plan and move the arm while ignoring the hand. To do this, set the '''active DOFs''' to the joint indices of the arm only before calling the planner. '''Active DOFs''' are not limited to just joints, they can also be the translation or rotation components of the robot itself. For example, to plan for the robot arm while it is moving on the '''xy''' plane type:<br />
<source lang="matlab"><br />
orRobotSetActiveDOFs(1,0:6,3)<br />
</source><br />
<br />
To have it rotate around the '''z'''-axis at the same time, type:<br />
<source lang="matlab"><br />
orRobotSetActiveDOFs(1,0:6,11,[0 0 1])<br />
</source><br />
<br />
Now,<br />
<source lang="matlab"><br />
orRobotGetActiveDOF(1)<br />
</source><br />
<br />
returns 10: 7 for the arm, 2 for '''xy''' planar translation, and 1 for the rotation around '''z'''.<br />
<br />
To query the transformations of all the links of the robot type:<br />
<source lang="matlab"><br />
L = orBodyGetLinks(1)<br />
</source><br />
<br />
This will return a 12xN matrix for N links, where each column is a 3x4 transformation matrix (left 3x3 is a rotation, and last column is the translation component). For example, to extract the tranformation matrix of the second link, type:<br />
<source lang="matlab"><br />
T = reshape(L(:,2),[3 4])<br />
</source><br />
<br />
To set the transformation of the base robot do<br />
<source lang="matlab"><br />
orBodySetTransform(1,[0 0 1],[0.707 0.707 0 0])<br />
</source><br />
<br />
This will set the translation to (0,0,1). The third parameter is a rotation around the X axis by 90 degrees in quaternion form. It is also possible to directly input a 3x4 transformation matrix T by:<br />
<source lang="matlab"><br />
orBodySetTransform(1,reshape(T,[1 12]))<br />
</source><br />
<br />
To add a cup on top of the table named 'table' type:<br />
<source lang="matlab"><br />
destTransform = orBodyGetTransform(orEnvGetBody('table'));<br />
destPosition = destTransform(10:12);<br />
cupPosition = destPosition + [0;0;0.1];<br />
cupid = orEnvCreateKinBody('MyCup','data/mug1.kinbody.xml');<br />
orBodySetTransform(cupid, cupPosition,[0.707 0.707 0 0]);<br />
</source><br />
<br />
=== Executing planners - A Grasping Example ===<br />
<br />
[[image:Openrave_dishwasher.jpg|right|350px]] <br />
<br />
In this part, we'll be loading the manipulation plugin and using its various features to plan in the lab1.env.xml workspace with the BarrettWAM. The manipulation plugin exposes a Manipulation ProblemInstance and the Inverse Kinematics functions for the Barrett WAM arm.<br />
<br />
First load<br />
<source lang="matlab"><br />
orEnvLoadScene('data/lab1.env.xml', 1)<br />
robotid = orEnvGetBody('BarrettWAM')<br />
manipid = orEnvCreateProblem('BaseManipulation', 'BarrettWAM')<br />
</source><br />
<br />
Each ProblemInstance supports a 'SendCommand' function that is used to receive commands from the script server and send back responses. Matlab can communicate with this function by the 'orProblemSendCommand' function.<br />
<br />
To move the hand safely to a particular preshape do:<br />
<source lang="matlab"><br />
manips = orRobotGetManipulators(robotid);<br />
orBodySetJointValues(robotid,[0 0 0 pi/2],manips{1}.handjoints);<br />
</source><br />
<br />
'''Alternative: ''' Can move the robot safely to a preshape using planners by:<br />
<source lang="matlab"><br />
orRobotSetActiveDOFs(robotid,manips{1}.armjoints);<br />
handjoints = sprintf('%d ',manips{1}.handjoints);<br />
orProblemSendCommand(['MoveUnsyncJoints handjoints 4 0 0 0 1.57 ' handjoints],manipid);<br />
orBodySetJointValues(robotid,[0 0 0 pi/2],manips{1}.handjoints);<br />
</source><br />
<br />
To plan for a configuration space goal for the arm joints of the robot, type:<br />
<source lang="matlab"><br />
orProblemSendCommand('MoveManipulator armvals -0.005617 1.07 0.233 2.096 -4.194 -0.235 1.302520',manipid)<br />
</source><br />
<br />
Can squeeze the fingers of the hand by:<br />
<source lang="matlab"><br />
orProblemSendCommand('CloseFingers',manipid)<br />
</source><br />
<br />
Grab the body by:<br />
<source lang="matlab"><br />
orProblemSendCommand('GrabBody name mug6',manipid)<br />
</source><br />
<br />
Move to the table:<br />
<source lang="matlab"><br />
tableTrans = [ -0.035588 -0.995502 -0.087805 -0.466866<br />
-0.994116 0.026269 0.105090 0.869644<br />
-0.102311 0.091028 -0.990579 1.000000 ];<br />
orProblemSendCommand(['MoveToHandPosition matrix ' sprintf('%f ',tableTrans(1:3,1:4))],manipid)<br />
</source><br />
<br />
Move the hand down a little:<br />
<source lang="matlab"><br />
orProblemSendCommand(['MoveHandStraight direction 0 0 -1 maxdist 0.3 matrix ' sprintf('%f ',tableTrans(1:3,1:4))],manipid)<br />
</source><br />
<br />
Finally, to release the fingers use the ReleaseFingers command. ReleaseFingers is a little more general than CloseFingers because the fingers to move and the direction of movement can be specified.<br />
<source lang="matlab"><br />
orRobotSetActiveDOFs(1,[7 8 9]); % want to move 3 joints<br />
orProblemSendCommand('releasefingers target mug6',manipid);<br />
</source><br />
<br />
Can now plan to original position:<br />
<source lang="matlab"><br />
orProblemSendCommand('MoveManipulator armvals 0 0 0 0 0 0 0',manipid);<br />
</source><br />
<br />
Can also test if an IK solution exists by giving the transformation matrix T of the wrist:<br />
<source lang="matlab"><br />
s = orProblemSendCommand(['IKtest trans ', num2str(T(:,4)'), ' rot ', num2str(T(1:9))],manipid)<br />
if( ~isempty(s) )<br />
orRobotSetDOFValues(1, sscanf(s, '%f'),0:6)<br />
end<br />
</source><br />
<br />
=== Logging ===<br />
<br />
A scene can be easily saved by using the '''logging''' plugin. Once a scene is loaded and all the objects are in place, do the following commands:<br />
<source lang="matlab"><br />
logid = orEnvCreateProblem('logging')<br />
orProblemSendCommand('savescene filename myscene.env.xml',logid)<br />
</source><br />
<br />
== Matlab/Octave Partial Reference ==<br />
<br />
This is '''not''' a complete list and use this only to introduce yourself to the functions, the real reference and usages can be found in the help files of each function by typing '''help function_name'''.<br />
<br />
* '''orBodyDestroy(bodyid)'''<br />
Destroys a body of id bodyid. bodyid can also be a robot.<br />
<br />
* '''success = orBodyEnable(bodyid, enable)'''<br />
Enables or disables the body. If a body is disabled, <br />
collision detection and physics will will be turned off for it.<br />
<br />
* '''aabb = orBodyGetAABB(bodyid)'''<br />
Returns an axis-aligned boudning box of the body in world coordinates<br />
aabb is a 3x2 vector where the first column is the position of the<br />
box and the second is the extents.<br />
<br />
* '''aabbs = orBodyGetAABBs(bodyid)'''<br />
<br />
returns the axis-aligned boudning boxes of all the links of the body in world coordinates<br />
aabbs is a 6xn vector where each column describes the box for all n links.<br />
The first 3 values in each column describe the position of the aabb, and the next<br />
3 values describe the extents (half width/length/height) on each of the axes.<br />
<br />
<br />
* '''dof = orBodyGetDOF(robotid)'''<br />
Returns the number of active joints of the body.<br />
<br />
* '''values = orBodyGetDOFValues(robotid, indices)'''<br />
Gets the body's dof values in a Nx1 vector where N is the DOF<br />
bodyid - unique id of the robot<br />
indices [optional]- The indices of the joints whose values should be returned.<br />
If not specified, all joints are returned<br />
<br />
* '''values = orBodyGetLinks(bodyid)'''<br />
Returns the transformations of all the body's links in a 12 x L matrix. Where L<br />
is the number of links and each column is a 3x4 transformation<br />
(use T=reshape(., [3 4]) to recover).<br />
T * [X;1] = Xnew<br />
<br />
* '''orBodySetJointValues(bodyid, values, indices)'''<br />
Set the raw joint values of a body. If bodyid is a robot, sets the robot's<br />
joints ignoring its current active degrees of freedom. If a controller on<br />
the robot is running, this function might not have any effect. Instead<br />
use orRobotSetDOFValues<br />
indices [optional] - array specifying the indices to control<br />
<br />
* '''orBodySetTransform'''<br />
orBodySetTransform(bodyid, translation, quaternion)<br />
orBodySetTransform(bodyid, [quaternion translation])<br />
orBodySetTransform(bodyid, transform matrix) (12x1, 1x12, or 3x4)<br />
Set the affine transformation of the body. The transformation actually<br />
describes the first link of the body. The rest of the links are derived by<br />
the joint angles. A quaternion is related to axis and angle via: [cos(theta/2);sin(theta/2)*axis]<br />
<br />
* '''[collision, colbody] = orEnvCheckCollision(bodyid,excludeid)'''<br />
Check collision of the robot with the environment. collision is 1 if the robot<br />
is colliding, colbodyid is the id of the object that body collided with<br />
<br />
* '''orEnvClose(figureids)'''<br />
closes the figures and plots<br />
figureids - array of ids returned from orEnvPlot or other plotting functions<br />
<br />
* '''bodyid = orEnvCreateKinBody(name, xmlfile)'''<br />
* '''plannerid = orEnvCreatePlanner(plannertype)'''<br />
* '''orEnvCreateProblem'''<br />
problemid = orEnvCreateProblem(problemname, args)<br />
problemid = orEnvCreateProblem([problemname, args])<br />
<br />
<br />
* '''problemid = orEnvCreateProblem(problemname, args, destroyduplicates)'''<br />
<br />
Creates an instance of a problem and returns its id for future communicate with it<br />
problemname - the problem name<br />
args - a string of arguments to send to the problem's main function<br />
destroyduplicates [optional] - if 1, will destroy any previous problems with the same problem name.<br />
If 0, will not destroy anything.<br />
The default value is 1. <br />
<br />
* '''robotid = orEnvCreateRobot(robotname, xmlfile, type)'''<br />
Creates a robot of the given type. If type is not specified, creates a generic robot<br />
<br />
* '''orEnvDestroyProblem(problemid)'''<br />
<br />
Destroys problem instance whose id is problemid.<br />
<br />
* '''bodies = orEnvGetBodies()'''<br />
bodies is a cell array of all body objects in the scene<br />
every cell contains a struct with the following parameters<br />
id - bodyid<br />
filename - filename used to initialize the body with<br />
name - human robot name<br />
type - xml type of body<br />
<br />
* '''id = orEnvGetBody(bodyname)'''<br />
returns the id of the body that corresponds to bodyname<br />
<br />
* '''robots = orEnvGetRobots()'''<br />
robots is a cell array of robots<br />
every cell contains a struct with the following parameters<br />
id - robotid<br />
filename - filename used to initialize the robot with<br />
name - human robot name<br />
type - type of robot<br />
<br />
* '''success = orEnvLoadPlugin(filename)'''<br />
<br />
Loads a plugin.<br />
filename - the relative path of the plugin to load. (*.so for linux, *.dll for windows)<br />
<br />
* '''orEnvLoadScene(filename, [ClearScene])'''<br />
Loads a new environment.<br />
filename - The filename of the scene to load. If a relative file<br />
is specified, note that it is relative to the current direction<br />
of the OpenRAVE executable.<br />
ClearScene - If 1, then clears the scene before loading. Else leaves the <br />
scene alone and loads in addition to it.<br />
<br />
* '''figureid = orEnvPlot(points,...)'''<br />
<br />
plots points or lines in the openrave viewer<br />
points - Nx3 vector of xyz positions<br />
optional arguments include 'size', 'color', and 'line'<br />
color - Nx3 vector of RGB values between 0 and 1<br />
size - Nx1 vector of the sizes in pixels of each point/line<br />
line (or linestrip) - if specified, then openrave renders a line strip<br />
linelist - if specified, openrave renders a line for every two points<br />
trilist - if specified, openrave renders a triangle for every three<br />
vertices should be specified in counter-clockwise order<br />
sphere - if specified, openrave renders each point as a sphere<br />
transparency - [0,1], set transparency of plotted objects (0 is opaque)<br />
<br />
* '''[collision, colinfo] = orEnvRayCollision(rays)'''<br />
performs ray collision checks and returns the position and normals<br />
where all the rays collide<br />
rays - a 6xN matrix where the first 3<br />
rows are the ray position and last 3 are the ray direction<br />
collision - N dim vector that is 1 for colliding rays and 0<br />
for non-colliding rays colinfo is a 6xN vector that describes <br />
where the ray hit and the normal to the surface of the hit point<br />
where the first 3 columns are position and last 3 are normals<br />
if bodyid is specified, only checks collisions with that body<br />
<br />
* '''orEnvSetOptions('publishanytime 1')'''<br />
<br />
Current options:<br />
- simulation [start/stop] [time_step] - toggles the internal simulation loop, ie all the calls to SimulationStep. <br />
If time_step is specified, will set the simulation time step for all objects.<br />
Note that this is not tied to real time at all, how fast the simulation goes in reality depends on complexity<br />
of the scene and the physics engine being used.<br />
- physics engine_name - switches the physics engine to another one with id 'engine_name'<br />
- gravity [x y z] - changes to gravity vector<br />
- publishanytime [1/0] - switch between publishing the body transformations<br />
to the GUI anytime or only between stepsimulation and server messsages.<br />
When publishing anytime, the GUI will reflect the body movements after every<br />
move. This is useful when visualizing internal C++ states. When off, the GUI<br />
will only reflect the state of robots after all calls to stepsimulation and<br />
server send messages have been done. The default is off.<br />
- debug [debug level] - toggles debugging messages by RAVELOG.<br />
0 - only RAVEPRINT statements show<br />
1+ - RAVELOG statements with various debug levels show<br />
- quit - closes the openrave instance<br />
<br />
* '''[tripoints, triindices] = orEnvTriangulate(inclusive, ids)'''<br />
<br />
Returns the triangulation of various objects in the scenes controlled by name and options<br />
Arguments:<br />
inclusive - if 1, will only triangulate the bodies pointed to by ids<br />
if 0, will triangulate all objects except the bodies pointed to by ids<br />
default value is 0.<br />
ids (optional) - the ids to include or exclude in the triangulation<br />
To triangulate everything, just do orEnvTriangulate(0,[]), or orEnvTriangulate()<br />
<br />
Output:<br />
tripoints - 3xN matrix of 3D points<br />
tripoints - 3xK matrix of indices into tripoints for every triangle.<br />
<br />
* '''success = orEnvWait(robotid, robot_timeout)'''<br />
wait until all previously sent commands to matlab are finished.<br />
Since problems are meant to last for a long time orEnvWait waits<br />
until the problem's main function finishes.<br />
<br />
robotid - optional argument. If a robot id is specified, will wait until<br />
the robot finishes with its trajectory.<br />
<br />
robot_timeout (s) - function will return with success set to 0 if robot<br />
did not finish its commands by robot_timeout ms. If not specified, orEnvWait<br />
will not return until robot completes.<br />
<br />
* '''success = orPlannerInit(planner, robot, parameters)'''<br />
Initialize a planner to plan for a robot and give some parameters<br />
<br />
* '''trajectory = orPlannerPlan(planner)'''<br />
Start planning. The planner returns a trajectory when successful (otherwise returns an empty matrix)<br />
trajectory - (DOF+1)xN matrix where N is the number of points in the trajectory.<br />
The first row are the time values of each trajectory point.<br />
<br />
* '''output = orProblemSendCommand(cmd, problemid, dosync)'''<br />
<br />
Sends a command to the problem. The function doesn't return until<br />
ProblemInstance::SendCommand returns.<br />
cmd - the string command to send the problem<br />
problemid [optional] - returned id of the problem, if not specified, then<br />
command is sent to all problems<br />
dosync [optional] - If 1, the SendCommand is called in the main thread, in sync<br />
with the rest of the primitives. If 0, called in a different thread.<br />
output - the concatenated output of all the problems that the command is sent to<br />
<br />
* '''orRender(cmd)'''<br />
<br />
Controls rendering properties. Cmd can be<br />
start - starts the GUI to update the internal openrave state<br />
stop - stops the GUI from updating the internal openrave state (can be used to speed up loading)<br />
<br />
* '''success = orRobotControllerSend(robotid, controllercmd)'''<br />
<br />
sends a command to the current controller the robot is connected to.<br />
OpenRAVE sends directly to ControllerBase::SendCmd,<br />
ControllerBase::SupportsCmd is also used to check for support.<br />
<br />
success - 1 if command was accepted, 0 if not<br />
<br />
* '''success = orRobotControllerSet(robotid, controllername, controllerargs)'''<br />
<br />
Sets a new robot controller and destroys the old.<br />
controllername - name used to query a controller<br />
controllerargs [optional] - the arguments to ControllerBase::Init<br />
<br />
* '''dof = orRobotGetActiveDOF(robotid)'''<br />
returns the robot's active degrees of freedom used for planning (not necessary corresponding to joints).<br />
<br />
* '''sensors = orRobotGetAttachedSensors(robotid)'''<br />
<br />
sensors is a cell array describing the attached sensors of the robot<br />
Each cell is a struct with fields:<br />
name - name of the attached sensor<br />
link - zero-based index of link sensor is attached to<br />
Trelative - 3x4 matrix of the relative transform of the camera with respect to the robot<br />
Tglobal - 3x4 matrix of the global transform of the sensor of the current robot<br />
Tglobal = Tlink * Trelative<br />
type - the xml id of the sensor that is attached<br />
<br />
* '''values = orRobotGetDOFLimits(robotid)'''<br />
Gets the robot's dof limits in a Nx2 vector where N is the DOF, the first column<br />
is the low limit and the second column is the upper limit.<br />
<br />
* '''values = orRobotGetDOFValues(robotid, indices)'''<br />
Gets the robot's dof values in a Nx1 vector where N is the DOF<br />
robotid - unique id of the robot<br />
indices [optional]- The indices of the joints whose values should be returned.<br />
If not specified, the active degreees of freedeom set by<br />
orRobotSetActiveDOFs will be used.<br />
<br />
* '''manipulators = orRobotGetManipulators(robotid)'''<br />
<br />
manipulators is a cell array describes the manipulators of the robot<br />
Each cell is a struct with fields<br />
baselink - zero-based index of base link manipulator is attached to<br />
eelink - zero-based index of link defining the end-effector<br />
Tgrasp - 3x4 matrix of the grasp frame relative to the end effector link,<br />
Tglobalgrasp = Tendeffector*Tgrasp<br />
joints - 1xK zero-based joint indices of the hand attached to the end effector<br />
armjoints - 1xN zero-based manipulator joint indices that have an<br />
effect on the end effector<br />
iksolvername - name of ik solver to use<br />
<br />
* '''data = orRobotSensorGetData(robotid, sensorindex)'''<br />
<br />
Gets the sensor data. The format returned is dependent on the type<br />
of sensor. Look at the different data SensorData implementations in rave.h.<br />
Although the data returned is not necessarily one of them.<br />
options [optional] - options that specify what type of data to request (0 is default)<br />
data.type - contains the id of the data type (see SensorBase::SensorType)<br />
For laser data<br />
data.laserrange - 3xN array where each column is the direction * distance<br />
data.laserpos - 3xN array where each column is the corresponding origin of each range measurement<br />
data.laserint - 1xN optional laser intensity array<br />
For image data<br />
data.KK - 3x3 intrinsic matrix<br />
data.T - 3x4 camera matrix (to project a point multiply by KK*inv(T))<br />
data.I - the rgb image size(I) = [height width 3]<br />
<br />
* '''out = orRobotSensorSend(robotid, sensorindex, controllercmd)'''<br />
<br />
sends a command to a sensor attached to the robot <br />
OpenRAVE sends directly to SensorBase::SendCmd,<br />
SensorBase::SupportsCmd is used to check for command support.<br />
<br />
robotid - unique id of the robot<br />
sensorindex - zero-based index of sensor into robot's attached sensor array<br />
out - the output of the command<br />
<br />
* '''orRobotSetActiveDOfs(robotid, indices, affinedofs, rotationaxis)'''<br />
robotid - unique id of the robot<br />
indices - zero based indices of the robot joints to activate<br />
affinedofs [optional] - is a mask of affine transformation for planning<br />
1 - X, 2 - Y, 4 - Z, 8 - RotationAxis (rotationaxis has to be avlid, 16 - full 3D rotation<br />
rotationaxis [optional] - the rotation axis (if the RotationAxis bit is set in affinedofs)<br />
<br />
* '''orRobotSetDofValues(robotid, values, indices)'''<br />
Sets the DOF values of the robot<br />
robotid - unique id of the robot<br />
values - the joint values of the robot<br />
indices [optional] - the indices of the dofs to set of the robot. <br />
If indices is not specified the active degrees of freedom<br />
set by previous calls to orRobotSetActiveDOFs will be used.<br />
Note that specifying indices will not change the active dofs of the robot.<br />
<br />
* '''orRobotStartActiveTrajectory(robotid, jointvalues, timestamps, transformations)'''<br />
<br />
Starts/Queues a robot trajectory of the robot where the size of<br />
each trajectory point is the current active degrees of freedom<br />
of the robot (others are held constants)<br />
D is the number of active degrees of freedom.<br />
N is the number of points of the trajectory<br />
robotid - unique id of the robot<br />
jointvalues - DxN matrix of the joint values of each point in the trajrectory.<br />
timestamps [optional] - the time stamps in seconds of each trajectory point.<br />
transformations [optional] - 12xN or 7xN matrix. The base link transformations of<br />
each trajectory point.<br />
If the column size is 12, then it is a 3x4 matrix<br />
in column first order<br />
If the column size is 7, then it is a quaterion and a translation.<br />
If active degrees of freedom contains a affine transformation component<br />
it is overwritten with the transformations matrices</div>Rdiankov