1. German Larrain
  2. ars

Commits

German Larrain  committed 4d6ac67

simulator.SimulatedPhysicsObject: added methods 'get_pose' and 'set_pose'

  • Participants
  • Parent commits 66f4cc7
  • Branches dev

Comments (0)

Files changed (1)

File ars/model/simulator/__init__.py

View file
 		"""
 		pass
 
+	def get_pose(self):
+		"""Get the pose (3D position and rotation) of the object.
+
+		:return: pose
+		:rtype: :class:`ars.utils.geometry.Transform`
+
+		"""
+		return gemut.Transform(self.get_position(), self.get_rotation())
+
+	def set_pose(self, pose):
+		"""Set the pose (3D position and rotation) of the object.
+
+		:param pose:
+		:type pose: :class:`ars.utils.geometry.Transform`
+
+		"""
+		self.set_position(pose.get_translation())
+		rot = pose.get_rotation()
+		self.set_rotation(mu.matrix_as_tuple(rot))
+
 
 class SimulatedBody(SimulatedPhysicsObject):
 	"""Class encapsulating the physics, collision and graphical objects