V-REP allows you to perform cutting simulations. The user can model almost any type of cutting volumes as long as they are convex (however you can always combine several convex cutting volumes to obtain a non-convex cutting volume). The scene objects that allow for this functionality are mills, which can cut cuttable entities. Following figures illustrates examples using mills:
[Two cutting simulation examples]
Mills will always have a convex cutting volume, however they can be combined to generate a non-convex cutting volume or more complex volumes. They cut parts of cuttable entities away that interferes with their cutting volume. By default, cuttable objects have their cuttable tag disabled. Refer to the object common properties to enable or disable individual object's cuttable tag.
Parts of cuttable objects that have been cut away will not be collidable, measurable, detectable or renderable anymore (but the remainder will). Depending on the size and complexity of cuttable objects, the cutting operation can be slowed down. The cutting speed is also linked to the cutting volume precision and the rate at which the cut is performed. Smooth cutting volumes usually perform better when the cutting is continuous (not a one-time cut). A too small cutting rate might also result in a slow-down due to the increasing size of the required calculation structure. The best is to test for the best cutting volume - cutting rate relationship.
Cut objects can be reset to their initial state with the simResetMilling command. Changes can also be made permanent with the simApplyMilling command.The amount of cut surface/volume can be recorded by graph objects. Refer to graphs and graph data stream types for more information about how to record mill data.
VREP中Mill只能对表面进行切削(不支持实体模型切削)。下面导入一个立方体STL网格模型,勾选其Cuttable属性:
然后添加一个Mill放在立方体上表面(刀具的切削体要进入立方体表面内),cutting volume可以设置成下面几种基本形状:
添加脚本控制Mill在立方体上表面移动,可以看到与刀具接触的面被移除:
仿真结束后被切削的对象会还原,如果要应用切削改变,可以使用simApplyMilling函数(Applies changes made during milling operations to a cuttable object)。
function sysCall_init()
-- do some initialization here: millHandle = sim.getObjectHandle('Mill') end function sysCall_actuation()
-- put your actuation code here -- Explicit handling
--sim.handleMill(millHandle) local position=sim.getObjectPosition(millHandle,-)
position[]=position[]+0.0001
sim.setObjectPosition(millHandle,-,position)
end function sysCall_cleanup()
-- do some clean-up here
end
参考: