23 transform = json.load(f)
28 transform[
"Translation"][0] / 1000,
29 transform[
"Translation"][1] / 1000,
30 transform[
"Translation"][2] / 1000,
32 axis = (transform[
"Rotation"][
"Axis"][0], transform[
"Rotation"][
"Axis"][1], transform[
"Rotation"][
"Axis"][2])
35 return cls(position, orientation)
39 position = [message.position.x, message.position.y, message.position.z]
40 orientation = [message.orientation.x, message.orientation.y, message.orientation.z, message.orientation.w]
42 return cls(position, orientation)
46 Get the inverse of the pose.
56 return Pose(translation, rotation)
58 def equals(self, other, tolerance=0.002):
60 Check whether this pose is equal to another one. The poses are
61 considered equal, when all of the entries are within the given tolerance
64 for a, b
in zip(self.
position, other.position):
65 if abs(a - b) > tolerance:
67 for a, b
in zip(self.
orientation, other.orientation):
68 if abs(a - b) > tolerance:
80 return cls(message.x, message.y)
83 return math.sqrt((self.
x - other.x) ** 2 + (self.
y - other.y) ** 2)
85 def equals(self, other, tolerance=1):
87 Check whether the points are the same, up to the given distance.
99 return self.
x * other_point.x + self.
y * other_point.y + self.
z * other_point.z
109 lower = [message.lower.x, message.lower.y, message.lower.z]
110 upper = [message.upper.x, message.upper.y, message.upper.z]
112 return cls(lower, upper)
115 message.lower.x = float(self.
lower[0])
116 message.lower.y = float(self.
lower[1])
117 message.lower.z = float(self.
lower[2])
119 message.upper.x = float(self.
upper[0])
120 message.upper.y = float(self.
upper[1])
121 message.upper.z = float(self.
upper[2])
124 for lower, upper
in zip(self.
lower, self.
upper):
130 for a, b
in zip(self.
lower, other.lower):
131 if abs(a - b) > tolerance:
133 for a, b
in zip(self.
upper, other.upper):
134 if abs(a - b) > tolerance: