-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.py
82 lines (61 loc) · 2.82 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from dovsg.controller import Controller
from dovsg.utils.utils import vis_depth
import argparse
def main(args):
controller = Controller(
step=0,
tags=args.tags,
interval=3,
resolution=0.01,
occ_avoid_radius=0.2,
save_memory=args.save_memory,
debug=args.debug
)
if args.scanning_room:
# data collection and pose estimation, if you have data, please don't use it
# to avoid delte exist data
controller.data_collection()
if args.preprocess:
controller.pose_estimation()
# show droid-slam pose pointcloud
controller.show_droidslam_pointcloud(use_inlier_mask=False, is_visualize=True)
# transform droid-slam pose to floor base coord
controller.transform_pose_with_floor(display_result=False)
# use transformed pose train ace for relocalize
controller.train_ace()
# vis_depth(controller.recorder_dir)
controller.show_pointcloud(is_visualize=True)
# when first times, init scenario
controller.get_view_dataset()
controller.get_semantic_memory()
controller.get_instances()
controller.get_instance_scene_graph()
controller.get_lightglue_features()
# controller.show_pointcloud()
controller.show_instances(
controller.instance_objects,
clip_vis=True,
scene_graph=controller.instance_scene_graph,
show_background=True
)
if not args.scanning_room:
tasks = controller.get_task_plan(description=args.task_description, change_level=args.task_scene_change_level)
print(tasks)
controller.run_tasks(tasks=tasks)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='demo of dovsg.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('--tags', type=str, default="room1", help='tags for scene.')
parser.add_argument('--save_memory', type=bool, default=True, help='save each step memory.')
parser.add_argument('--scanning_room', action='store_true', help='For hand camera to recorder scene.')
parser.add_argument('--preprocess', action='store_true', help='preprocess scene.')
parser.add_argument('--debug', action='store_true', help='For debug mode.')
parser.add_argument('--task_scene_change_level', type=str, default="Minor Adjustment",
choices=["Minor Adjustment", "Positional Shift", "Appearance"], help='scene change level.')
parser.add_argument('--task_description', type=str, default="", help='your task description.')
args = parser.parse_args()
# args.task_scene_change_level = "Minor Adjustment" # Minor Adjustment, Positional Shift, Appearance
# args.task_description = "Please move the red pepper to the plate, then move the green pepper to plate."
main(args)