15 self.
dir = rospy.get_param(
'compliance_dir') +
'/' 17 'sensor_compliance/numeric.yaml'))
24 params = params.copy()
26 rospy.logerr(
'%s is not defined anywhere under %s' %
27 (sensor_type, self.
dir))
29 '%s is not defined anywhere under %s' % (sensor_type, self.
dir)
31 if i
not in self.
numeric[sensor_type][
'allowed_params']:
32 rospy.logerr(
'%s parameter specification of %s not permitted' %
39 if 'x' and 'y' and 'z' in params:
40 xyz = np.array([float(params[
'x']),
43 for box
in self.
boxes:
46 rospy.logerr(
'%s %s is out of bounds' %
47 (sensor_type, params[
'name']))
48 rospy.logerr(
'%s %s is at xyz=(%s, %s, %s), %s' %
49 (sensor_type, params[
'name'],
50 xyz[0], xyz[1], xyz[2],
51 'must fit in at least one of the following boxes ' +
52 'with remaining space:'))
53 for box
in self.
boxes:
54 rospy.logerr(
' %s' % str(box))
61 if n > self.
numeric[sensor_type][
'num']:
62 rospy.logerr(
'Too many %s requested' % sensor_type)
63 rospy.logerr(
' maximum of %s %s allowed' %
64 (self.
numeric[sensor_type][
'num'], sensor_type))
76 self.
dir = rospy.get_param(
'compliance_dir') +
'/' 78 'thruster_compliance/numeric.yaml'))
86 params = params.copy()
88 rospy.logerr(
'%s is not defined anywhere under %s' %
89 (thruster_type, self.
dir))
91 '%s is not defined anywhere under %s' % \
92 (thruster_type, self.
dir)
94 if i
not in self.
numeric[thruster_type][
'allowed_params']:
95 rospy.logerr(
'%s parameter specification of not permitted' %
105 xyz = np.array([float(j)
for j
in [i
for i
in 106 params[
'position'].split(
' ')
108 for box
in self.
boxes:
111 rospy.logerr(
'%s %s is out of bounds' %
112 (thruster_type, params[
'prefix']))
113 rospy.logerr(
'%s %s is at xyz=(%s, %s, %s), %s' %
114 (thruster_type, params[
'prefix'],
115 xyz[0], xyz[1], xyz[2],
116 'it must fit in at least one of the following boxes ' +
117 'with remaining space:'))
118 for box
in self.
boxes:
119 rospy.logerr(
' %s' % str(box))
123 if n > self.
numeric[thruster_type][
'num']:
124 rospy.logerr(
'Too many %s requested' % thruster_type)
125 rospy.logerr(
' maximum of %s %s allowed' %
126 (self.
numeric[thruster_type][
'num'], thruster_type))
135 self.
pose = np.array([float(j)
for j
in [i
for i
in pose.split(
' ')
137 self.
size = np.array([float(j)
for j
in [i
for i
in size.split(
' ')
143 pose = pose-self.
pose[:3]
144 for idx, i
in enumerate(pose):
145 if abs(i) > self.
size[idx]/2:
150 elif self.
space == 0:
157 return '<Box name:%s x:[%s, %s] y:[%s,%s] z:[%s,%s]\ 158 remaining_space:%s>' % \
170 addrs = rospy.get_param(
'compliance_dir') +
'/' + box_yaml
171 box_def = yaml.safe_load(open(addrs))
174 for name, properties
in box_def.iteritems():
175 boxes.append(
Box(str(name),
178 properties[
'capacity']))
def param_compliance(self, sensor_type, params={})
def param_compliance(self, thruster_type, params={})
def number_compliance(self, sensor_type, n)
def number_compliance(self, thruster_type, n)
def __init__(self, name, pose, size, space)