示例#1
0
import os
from assembly import Assembly
from assembly.rhino import AssemblyArtist

HERE = os.path.dirname(__file__)
DATA = os.path.abspath(os.path.join(HERE, "data"))

filepath = os.path.join(DATA, 'flemish_bond.json')
assembly = Assembly.from_json(filepath)

artist = AssemblyArtist(assembly, layer='COMPAS::Assembly')
artist.clear_layer()
artist.draw()
savelevel_picking_frame = picking_frame.copy()
savelevel_picking_frame.point += savelevel_vector
picking_frame.point += tolerance_vector

# create tool from json
filepath = os.path.join(DATA, "vacuum_gripper.json")
tool = Tool.from_json(filepath)

# load assembly from file
filepath = os.path.join(DATA, '048_flemish_bond.json')
# load from existing if calculation failed at one point...

clear_planning_scene = True

if os.path.isfile(PATH_TO):
    assembly = Assembly.from_json(PATH_TO)
    clear_planning_scene = False
else:
    assembly = Assembly.from_json(filepath)

# create an attached collision mesh to be attached to the robot's end effector.
T = Transformation.from_frame_to_frame(brick.gripping_frame, tool.frame)
brick_tool0 = brick.transformed(T)
attached_brick_mesh = AttachedCollisionMesh(
    CollisionMesh(brick_tool0.mesh, 'brick'), 'ee_link')

# ==============================================================================
# From here on: fill in code, whereever you see this dots ...


def plan_picking_motion(robot, picking_frame, savelevel_picking_frame,