Example #1
0
        Rule(grippers, [''], True),
        Rule(grippers, ['sphere0/handle'], True),
        Rule(grippers, ['sphere1/handle'], True)
    ]
    cg = ConstraintGraph.buildGenericGraph(robot=robot,
                                           name="manipulation",
                                           grippers=grippers,
                                           objects=objects,
                                           handlesPerObjects=handlesPerObject,
                                           shapesPerObjects=contactsPerObject,
                                           envNames=[],
                                           rules=rules)

if lang == 'py':
    cg = ConstraintGraph(robot, "manipulation")
    factory = ConstraintGraphFactory(cg)
    factory.setGrippers(grippers)
    factory.setObjects(objects, handlesPerObject, contactsPerObject)
    factory.generate()

for e in [
        'ur3/gripper > sphere0/handle | f_ls',
        'ur3/gripper > sphere1/handle | f_ls'
]:
    cg.setWeight(e, 100)
for e in [
        'ur3/gripper < sphere0/handle | 0-0_ls',
        'ur3/gripper < sphere1/handle | 0-1_ls'
]:
    cg.setWeight(e, 100)
cg.initialize()
ps.createPositionConstraint("look_at_gripper", "tiago/camera_color_optical_frame", tool_gripper,
        (0,0,0), (0,0,0), (True,True,True))
look_at_gripper = ps.hppcorba.problem.getConstraint("look_at_gripper")
import hpp_idl
look_at_gripper.setComparisonType([hpp_idl.hpp.EqualToZero,hpp_idl.hpp.EqualToZero,hpp_idl.hpp.Superior])

# Create "Look at part" constraint
ps.createPositionConstraint("look_at_part", "tiago/camera_color_optical_frame", "part/to_tag_00001",
        (0,0,0), (0,0,0), (True,True,False))
look_at_part = ps.hppcorba.problem.getConstraint("look_at_part")
# 3}}}

# {{{3 Constraint graph instanciation
from hpp.corbaserver.manipulation import ConstraintGraphFactory
graph = ConstraintGraph(robot, 'graph')
factory = ConstraintGraphFactory(graph)
factory.setGrippers([ "tiago/gripper", "driller/drill_tip", ])

all_handles = ps.getAvailable('handle')
part_handles = filter(lambda x: x.startswith("part/"), all_handles)
test_handles = [    'part/handle_10',
                    'part/handle_11',
                    'part/handle_12',
                    'part/handle_13',
                    'part/handle_14',
                    'part/handle_15',
                    'part/handle_16',
                    'part/handle_17',
                    'part/handle_18',
                    'part/handle_19',
                    'part/handle_20',