tool changing simulation

Typically: "How do I... ", "How can I... " questions
Post Reply
enoughtoo
Posts: 3
Joined: 17 Jul 2013, 13:46

tool changing simulation

Post by enoughtoo » 19 Jul 2013, 09:15

Hello all,

I am wondering how can I simulate the tool change behaviors with vrep. For instance, robot could "pick up" a welding or painting tool, do something with this tool on one surface, disconnect this tool and assemble a camera on the arm and then do the inspection with the camera. It is a quite realistic scene. However, it seems that the link between objects in vrep needs to be created before the simulation starts (this is what I know how to handle it now). I have listed the possible solutions to my setup,

1. using gripper or suction pad to grasp various objects. However, most of objects i want to assemble on robot are non-dynamic items (cannot see them when I click the Dynamic content visualization and verification toolbar button). And I am not sure the functionality of these tools (welding, painting etc) will be still maintain.

2. move the tip of the arm to the object's position, do some magically connection. I am considering using "dummy dummy link" you have described in "Designing dynamic simulations" page. Basically I think everything that I can use mouse to operate (e.g. assemble two objects together) can be implemented with some code in script. However I am not sure it is correct when the dynamic simulation is involved in my situation.

many thanks to your fantastic work

Cheers

Kai

coppelia
Site Admin
Posts: 7024
Joined: 14 Dec 2012, 00:25

Re: tool changing simulation

Post by coppelia » 20 Jul 2013, 00:17

Hello Kai,

Have a look at following API functions:
You will not have to use all of above's functions. It will depend on what type of model you want to attach (i.e. if it is static or non-static). In case it is non-static, you could also use something similar to the suction pad model, but this solution is not elegant for your application. Make sure you attach a non-static model via a force sensor to the robot as you can see in this video.

Cheers

enoughtoo
Posts: 3
Joined: 17 Jul 2013, 13:46

Re: tool changing simulation

Post by enoughtoo » 23 Jul 2013, 14:14

Thank you for your reply. With these functions, now I am able to "connect" tools and robot arm. However, it seems the dynamic simulation of this manually connection doesn't work. This is how I do it:

Code: Select all


LBR_joint=simGetObjectHandle('LBR4p_connection')   -- force sensor
drill_tool=simGetObjectHandle('DrillTool')                   -- drill tool
LBR=simGetObjectHandle('LBR4p')

simSetObjectIntParameter(LBR,3003,1)                     -- set the robot arm static
simResetDynamicObject(LBR)
simResetDynamicObject(drill_tool)
simResetDynamicObject(LBR_joint)

-- some codes that make position and orientation of tool correct

simSetObjectParent(drill_tool, LBR_joint,1)               -- 'connect' tool and robot arm

drill_target=simGetObjectHandle('DrillTool_target')
drill_tip=simGetObjectHandle('DrillTip')
drill_ik=simGetIkGroupHandle('DrillIK')
simSetObjectParent(drill_tip, objHandle,1)
simSetLinkDummy(drill_target,drill_tip)

targetPos1={90*math.pi/180,90*math.pi/180,170*math.pi/180,90*math.pi/180,90*math.pi/180,90*math.pi/180,0}
simRMLMoveToJointPositions(jointHandles,-1,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos1,targetVel)
However, I can observe the correct movement of 'drill_target', but the arm/drill_tip do not follow the movement. And a warning icon is displayed after 'LBR4p_connection' in scene hierarchy. If I manually assemble tool with this 'LBR4p_connection', I don't get this warning icon and everything works perfectly. Anything I did wrong or missed?

Thanks

Kai
coppelia wrote:Hello Kai,

Have a look at following API functions:

coppelia
Site Admin
Posts: 7024
Joined: 14 Dec 2012, 00:25

Re: tool changing simulation

Post by coppelia » 23 Jul 2013, 17:53

Hello Kai,

If you drag-and-drop the LBR4+ and the Drill tool into the scene, then just add following piece of code to the beginning of the LBR4p child script:

Code: Select all

connector=simGetObjectHandle('LBR4p_connection')
drillBase=simGetObjectHandle('DrillTool')
simSetObjectParent(drillBase,connector,true)
simSetObjectPosition(drillBase,sim_handle_parent,{0,0,0.04})
simSetObjectOrientation(drillBase,sim_handle_parent,{math.pi,0,0})
This is quite easy since the drill tool is static. Had it been non-static, then you would have had to reset it (and its other objects) dynamically (with simResetDynamicObject) and make sure they are linked via a force sensor.

Cheers

Post Reply