mk @msitstore c program files v-rep v-rep evaluation syste

Upload: fcompart

Post on 10-Apr-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    1/10

    Inverse kinematics tutorial

    This tutorial will try to explain how to use the inverse kinematics functionality, while building a 7 DoF redundantmanipulator. The V-REP CAD data related to this tutorial (redundantManipulator.stl) is located in V-REPs installation folders cadFiles folder. A V-REP model related to this tutorial can be found in V-REPs installation folders models folder. Click [Menu bar File Import Binary STL] then select the file to import. Please also

    refer to the section on how to import/export shapes. A dialog pops open asking about the import options. Keepcheckboxes unchecked, and the Scaling coefficientto 1.0. Then click Ok. A single simple shapewas imported and is located in the middle of the scene. The shapealso appears in the scene hierarchy view on the left hand side of the main window. Depending on how the original CAD data was exported, the imported CAD data could be at a different scale, different location, or even subdivided into several shapes. The assigned color of imported shapesis random. Following figure shows the imported shape:

    As you can see, the import operation has left us with a single shape, where we expected several shapes. This

    means that we will have to divide the manipulator objectourselves: select the object(just click on it in the scene or the scene hierarchy view), then click [Menu bar Edit Grouping/Merging Divide Selected Shapes].Following is what you should have:

    Page 1 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    2/10

    The original shapewas divided into several sub-shapes(see also the scene hierarchy view). The shapedivision algorithm operates by grouping all triangles that are linked by common vertices. Depending on how the original geometry was created or exported, such a division procedure cannot be performed. In that case you will have to manually extract shapesin the triangle edit mode.

    Next, we will change colors of the various objectsso as to have a nice visual appearance. First double-click a shapeicon in the scene hierarchy view. The shape properties dialog opens. While a shapeis selected, click onOutside facesin the dialog: this will allow you to adjust the various color components of the outside faces of the selected shape. For now, just adjust the ambient color component of your shapes. To transfer the color of one shapeto another shape, select both shapesand make sure the last selected shape(indicated with a white bounding box) is the one you want to take the color from, then simply click the Apply to selectionbutton in the Colorssection of the shape properties dialog. Feel free to adjust other visual parameters too, like the Shading angleparameter, the Edges widthor the Edges color. Once you finished coloring, you might have following sit

    uation:

    In next step, we will add the 7jointsof the manipulator. One way of doing this is to add thejointsinto the scene, then specify their appropriate position and orientation (through the coordinates/transformation dialog). This ishowever not possible, when you dont know the exact joint positions as in our case, and so we will have to extr

    act them from the shapesthat we have:

    Select all imported shapes and click [Menu bar Edit Bounding Box Alignment Align Selected ShapesCoordinate Frame with World]. This operation guarantees that our bounding boxes are aligned with the absolute reference frame, and given the current manipulator configuration, represents the smallest bounding boxes. Cl

    Page 2 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    3/10

    ick [Menu bar Add Joint Revolute] to insert a revolutejointinto the scene. The default position is at(0;0;0) and its default orientation is vertical, and so thejointis hidden by the manipulators base cylinder. Whilethejointis still selected, -select the base cylinder, then open the coordinates/transformations dialog with [Menu bar Tools Coordinates/Transformations] or by clicking the appropriate toolbar button. In that dialog, click the Apply to selectionbutton as in following figure:

    This just positioned thejointat the exact same coordinates as the base cylinder (this operation however only slightly adjusted the joints vertical position since it was already almost in position). Now repeat the procedure forall otherjointsin the manipulator (remember there should be a total of 7). Alljointsare in position now, however, some of them have the wrong orientation. Select alljointsthat should be aligned with the worlds Y-axis, thenenter (90,0,0) for the Alpha, Betaand Gammaitems in the coordinates/transformations dialog, then click the r

    elated Apply to selectionbutton (below the Alpha, Betaand Gammaitems). Next, select thejointthat shouldbe aligned with the worlds X-axis, then enter (0,90,0) for the Alpha, Betaand Gammaitems in the coordinates/transformations dialog. Alljointshave the right position and orientation now.

    You can now adjust thejointsizes (check the Joint lengthand Joint diameteritems) in thejoint properties dialog (that you can open by double-clicking ajointicon in the scene hierarchy view). Make sure that alljointsareclearly visible. This is what you should have:

    The next step in this tutorial is to group shapesthat belong to the same rigid entity. Select the 5 shapesthat are part of link 1 (the base cylinder being link 0), then click [Menu bar Edit Grouping/Merging Group Sel

    Page 3 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    4/10

    ected Shapes]. Remember that once grouped, a shapesvisual attributes cannot be changed anymore, unlessit is again ungrouped. Once the shapesare grouped in a grouped shape, you could re-align its bounding box with the world, but this step is not required (and has only a visual effect). Repeat the same procedure with all shapesthat logically belong together. In this tutorial we will not actuate the grippers fingers, and so simply rigidly group them with the last link. When all shapesthat are meant to be grouped share the same visual attributes, trymerging them together instead ([Menu bar Edit Grouping/Merging Merge Selected Shapes]).

    At this point you can rename all objectsin the scene in following way, when going from base to tip: redundant

    Rob_link0 redundantRob_joint1 redundantRob_link1 redundantRob_joint2, etc. Just double-click anobjectsname in the scene hierarchy view to edit its name.

    Now we can build the kinematic chain, going from tip to base: select objectredundantRob_link7, then -select objectredundantRob_joint7 and click [Menu bar Edit Make Last Selected Object Parent]. Nextdo the same for objectredundantRob_joint7 and objectredundantRob_link6. Continue in a same way until the whole kinematic chain of the manipulator was built. This is what you should have (notice the scene hierarchy views structure):

    Select alljoints, then open the object common properties dialog with [Menu bar Tools Object Common Properties], or by pressing the appropriate toolbar button. In the Visibility layerssection, disable layer 2 and enable layer 10, then click the related Apply to selectionbutton. This just sent alljointsto the visibility layer 10, effectively making them invisible. Have a look at the layer selection dialog if you wish to temporarily enable/disable some layers.

    Next, add a dummy objectwith [Menu bar Add Dummy]. Rename it to redundantRobot, then make it parent of objectredundantRob_link0. This will be the real base of our manipulator.

    Now we will define an inverse kinematics task for the manipulator. In V-REP, an IK task requires specification of at least following elements:1) A kinematic chain described with a tip dummyand a base object.2) A target dummythat the tip dummywill be constrained to follow.

    We already have the base object(objectredundantRobot). Lets add another dummy, rename it to redundantRob_tip and set its position to (0.324,0,0.62) using the coordinates/transformations dialog. Next, attach the dummyto redundantRob_link7 (select redundantRob_tip, then redundantRob_link7, then click [Menu bar Edit Make Last Selected Object Parent]. Our tip dummyis ready!

    Now lets prepare the target dummy: copy and paste redundantRob_tip and rename the copy to redundantRob_target. The target dummyis ready. Next, we have to inform V-REP that redundantRob_tip and redundantRob_target are a tip-target pair for inverse kinematics resolution. Double-click the dummyicon of redundantRob_tip in the scene hierarchy view: this opens the dummy properties dialog. In the Dummy-dummy linksection, specify redundantRob_target as Linked dummy. Notice how both dummiesgot linked through a redstippled line in the scene hierarchy view (the two dummiesare also linked in the scene through a red line, but since both dummiesare coincident, the line cannot be seen). In the same dialog, Link typeis already IK, tip-target, which is the default value. This is what you should have by now:

    Page 4 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    5/10

    At this stage, all elements for the definition of the inverse kinematics task are ready, and we just need to register the task as an IK group. Open the inverse kinematics dialog with [Menu bar Tools Inverse Kinematics] or by clicking the appropriate toolbar button, and click Add new IK group. A new item appears in the IK groupslist: IK_Group. While that item is selected, indicate further down redundantRob_tip in the drop-down box that says - Select a tip -, and click Add new IK element. Then indicate redundantRobot as the Base. Finally, make sure that all items are checked in the Constraintssection (check Alpha-Betaand Gamma). Indeed,we want our tip dummyto follow our target dummyin position and orientation. You are free to check the item Mechanism is redundant, but at this stage, it wont make any difference since no joint limits or obstacle avoidance parameters have been defined.

    Page 5 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    6/10

    Close the dialog. Our inverse kinematics task is ready! Lets test it. Run the simulation, then select redundantRob_target, then disable the click-selectiontoolbar button:

    Then select the objectshiftingtoolbar button:

    Now drag the objectwith the mouse: the manipulator should follow. Also try the objectrotationtoolbar button:

    Switch back to the object shiftingtoolbar button, and try to drag the objectas far as possible, and notice how the inverse kinematics task breaks. Indeed, this happens when a configuration is singular or not reachable, how

    ever there are workarounds to this behavior: while the simulation is still running, re-open the inverse kinematicsdialog, select IK Group in the upper list, then specify DLS for the Calculation methoditem. Drag the objectout of reach and notice how the inverse kinematics resolution became more stable. Try adjusting the DLS dampingitem up and down. Basically, when damping is large, resolution becomes more stable but slower. Practically, you can get the advantages of both resolution methods, all you need to do is define two identical IK groups, where the first is not damped and the second is damped. Then, for the second IK group, you can specifya conditional resolution (e.g. Perform if previous IK group was performed and failed). Now set back the Calculation methoditem to Pseudo inverse.

    Now select redundantRob_tip in the IK element tipssection of the dialog, then try to disable some of the Constraintsitems and notice how the manipulator behaves when the redundantRob_target objectis dragged orrotated. Once you experimentated enough, reset all Constraintsitems to checked, then stop the simulation.

    What we will now do is add a way to easily manipulate the robot, without having to worry about breaking it by shifting the wrong objectsaround. We will therefore define it as a model. First, move redundantRob_tip and redundantRob_target to layer 11 to make both dummiesinvisible. Then shift-select all visible objectsin the scene view, ctrl-click the objectredundantRobot in the scene hierarchy view to remove it from the selection, then open the object common properties dialog. Check the Select base of model insteaditem, then the related App

    Page 6 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    7/10

    ly to selectionbutton. Clear the selection with , then select redundantRobot. In the dummy propertiesdialog, check the Dummy is model baseitem, then close the dialogs. Notice how a stippled bounding box now encompasses the whole manipulator:

    Click any objecton the manipulator and notice how the base dummy(redundantRobot) always gets selected instead. Now open the coordinates/transformations dialog (make sure that redundantRobot is selected), and uncheck Along Z, About Xand About Yin the Object Manipulation Mode Permissionssection:

    When you now try to shift or rotate the robot in the scene (using the object manipulation toolbar buttons), it willalways stay on the floor, and keep a proper orientation. Try it! (then make sure you reset it to its initial position/orientation with the undo toolbar button).

    Page 7 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    8/10

    Next, lets add a manipulation sphere that we will use to manipulate the robots gripper position/orientation. Click [Menu bar Add Primitive Shape Sphere] to open the primitive shape dialog, indicate 0.05 for the X-Size, Y-Sizeand Z-Size, then uncheck the Pure primitive (for dynamics)item and click OK. Adjust the newlyadded spheres position to be the same as redundantRob_target (using the coordinates/transformations dialog). The sphere now appears at the tip of the manipulator. Rename the sphere to redundantRob_manipSphere, then make it parent of redundantRob_target. When you now run the simulation, you should be able to change the manipulators configuration by moving the manipulation sphere around. Stop the simulation again.

    Lets change a few other details. In the shape properties dialog, click Outside faces, then check the Transparencyitem. Notice how the sphere appearance changed. Two other settings needs to be changed before the sphere appears transparent: check the Backface cullingitem in the shape properties dialog, then in the object common properties dialog click Set to last pos. in the Rendering ordersection: our manipulation sphere now appears transparent!

    In the same dialog uncheck all items in the Object special propertiessection (this is because the manipulation sphere doesnt really belong to the manipulator, it is more of a user-interface element). Now make redundantRobot parent of redundantRob_manipSphere:

    In the final step of this tutorial, we will register a collision object that should detect collisions between the manipulator and its environment. What we want is for every single shape(except for the manipulation sphere) in themanipulator to be able to detect a collision with the environment. Lets first define a collectionfor our manipulator:

    Open the collections dialog with [Menu bar Tools Collections] or by clicking the appropriate toolbar button. Select redundantRobot, then click Add new collection. A new, empty collectionwas added. We now needto define the collectioncontent: click Tree (selection). Notice how the collections contentchanged. Now click

    the newly added collectionitem: all objectscomposing the manipulator get a pink color in the scene! Rename the collection to redundantRob. This is what you should have:

    Page 8 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    9/10

    Now that the redundantRob collection is defined, we can register a collision object: open the collision detection dialog with [Menu bar Tools Collisions] or by clicking the appropriate toolbar button, then specify redundantRob [Collection] in the Check entitydrop-down box. Finally click Add collision objectand rename thenewly added collision object to redundantRob. Close the dialog.

    Collapse the redundantRobot tree in the scene hierarchy view. Your redundant manipulator model is ready!

    Run the simulation, and copy-paste a few times the manipulator. Shift/rotate the copies around, and change their configurations by dragging their manipulation spheres. Notice how every robot instance is fully functional, and how collisions are indicated with a color change. Open the inverse kinematics dialog, the collection dialog and the collision detection dialog. Notice how the listed items have also been automatically duplicated. Stop thesimulation.

    The procedure to register a minimum distance object is very similar to the collision object registration here above. All registered objects (collision detection, collections, IK groups, etc.) and all scene objectscan be accessed through appropriate API calls. Additionally, they can be directly recorded and visualized by graph objects.

    Page 9 of 10

    16.11.2010mk:@MSITStore:C:\Program%20Files\V-REP\V-REP%20EVALUATION\system\V...

  • 8/8/2019 Mk @Msitstore c Program Files v-rep v-rep Evaluation Syste

    10/10

    Page 10 of 10