def make_verb_library_single():
    for (verb_name, verb_info) in verbs.get_all_demo_info().items():
        print colorize("processing demo: %s"%verb_name, "red")
        bag = rosbag.Bag(osp.join(data_dir, verb_info["bag_file"]))
        
        segs = bag_proc.create_segment_without_look(bag, link_names)    
        if len(segs) > 1: print "warning: more than one segment found"
        kinematics_data = segs[0]
        
        verb_data = copy(kinematics_data)
        seg_file = h5py.File(osp.join(data_dir,verb_info["seg_file"]),"r")
        
        bag_proc.dict_to_hdf(verb_lib, verb_data, verb_name)

        seg_file.copy("/", verb_lib[verb_name],"object_clouds")
        verb_lib[verb_name]["arms_used"] = verb_info["arms_used"]
def make_verb_library_single(data_dir, verb_lib):
    from lfd import verbs
    link_names = ["r_gripper_tool_frame", "l_gripper_tool_frame"]
    for (verb_name, verb_info) in verbs.get_all_demo_info().items():
        print colorize("processing demo: %s" % verb_name, "red")
        bag = rosbag.Bag(osp.join(data_dir, verb_info["bag_file"]))

        segs = bag_proc.create_segment_without_look(bag, link_names)
        if len(segs) > 1: print "warning: more than one segment found"
        kinematics_data = segs[0]

        verb_data = copy(kinematics_data)
        seg_file = h5py.File(osp.join(data_dir, verb_info["seg_file"]), "r")

        bag_proc.dict_to_hdf(verb_lib, verb_data, verb_name)

        seg_file.copy("/", verb_lib[verb_name], "object_clouds")
        verb_lib[verb_name]["arms_used"] = verb_info["arms_used"]
Exemple #3
0
    print colorize(cmd, color, bold=True)
    if not args.dry_run: subprocess.check_call(cmd, shell=True)

parser = argparse.ArgumentParser()
parser.add_argument("verb")
parser.add_argument("target")
parser.add_argument("arms_used")
parser.add_argument("--dry_run", action="store_true")

args = parser.parse_args()
verb = args.verb
target = args.target
arms_used = args.arms_used

from lfd import verbs
all_demo_info = verbs.get_all_demo_info()
for i in xrange(1000):
    demo_name = "%s-%s%i"%(verb, target, i)
    if demo_name not in all_demo_info:
        break


data_dir = osp.join(osp.dirname(lfd.__file__), "data")
os.chdir(data_dir + "/images")
call_and_print("get_point_cloud.py %s"%demo_name)
print colorize("now, select the target object", color="red", bold=True)
call_and_print("manually_segment_point_cloud.py %s.npz --objs=%s"%(demo_name, target))

print colorize("now, human, demonstrate the action on the robot", color="red", bold=True)
os.chdir(data_dir + "/bags")
Exemple #4
0
    if not args.dry_run: subprocess.check_call(cmd, shell=True)


parser = argparse.ArgumentParser()
parser.add_argument("verb")
parser.add_argument("target")
parser.add_argument("arms_used")
parser.add_argument("--dry_run", action="store_true")

args = parser.parse_args()
verb = args.verb
target = args.target
arms_used = args.arms_used

from lfd import verbs
all_demo_info = verbs.get_all_demo_info()
for i in xrange(1000):
    demo_name = "%s-%s%i" % (verb, target, i)
    if demo_name not in all_demo_info:
        break

data_dir = osp.join(osp.dirname(lfd.__file__), "data")
os.chdir(data_dir + "/images")
call_and_print("get_point_cloud.py %s" % demo_name)
print colorize("now, select the target object", color="red", bold=True)
call_and_print("manually_segment_point_cloud.py %s.npz --objs=%s" %
               (demo_name, target))

print colorize("now, human, demonstrate the action on the robot",
               color="red",
               bold=True)