-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigParser.py
74 lines (53 loc) · 1.96 KB
/
ConfigParser.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
"""
@file ConfigParser.py
@copyright Software License Agreement (BSD License).
Copyright (c) 2017, Rutgers the State University of New Jersey, New Brunswick.
All Rights Reserved. For a full description see the file named LICENSE.
Authors: Chaitanya Mitash, Kostas Bekris, Abdeslam Boularias.
"""
import yaml
import os,sys
import random
class ConfigParser:
data = []
def __init__(self, filepath):
if os.path.exists(filepath) == False:
print('please create config.yml file with simulation parameters !!!')
sys.exit()
with open(filepath,"r") as file_descriptor:
self.data=yaml.load(file_descriptor)
def getSurfaceType(self):
return self.data['rest_surface']['type']
def getSurfacePose(self):
return self.data['rest_surface']['surface_pose']
def getCamIntrinsic(self):
return self.data['camera']['camera_intrinsics']
def getCamExtrinsic(self):
return self.data['camera']['camera_poses']
def getObjModelList(self):
random.shuffle(self.data['Models'])
return self.data['Models']
def getNumTrainingImages(self):
return self.data['params']['num_images']
def getLabelType(self):
return self.data['params']['label_type']
def getMinObjectsScene(self):
return self.data['params']['minimum_objects_in_scene']
def getMaxObjectsScene(self):
return self.data['params']['maximum_objects_in_scene']
def getRangeX(self):
return self.data['params']['range_x']
def getRangeY(self):
return self.data['params']['range_y']
def getRangeZ(self):
return self.data['params']['range_z']
def getNumSimulationSteps(self):
return self.data['params']['num_simulation_steps']
def getNumViews(self):
return self.data['camera']['num_poses']
def getLightRangeX(self):
return self.data['params']['light_position_range_x']
def getLightRangeY(self):
return self.data['params']['light_position_range_y']
def getLightRangeZ(self):
return self.data['params']['light_position_range_z']