Advertisement
ljklonepiece

get_T_cam_world

Aug 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1.   def get_T_cam_world(self, from_frame='kinect2_ir_optical_frame', to_frame='world'):
  2.         """ get transformation from camera frame to world frame"""
  3.  
  4.         time = 0
  5.         trans = None
  6.         qat = None
  7.         while not rospy.is_shutdown():
  8.             try:
  9.                 time = self.tl.getLatestCommonTime(from_frame, to_frame)
  10.                 (trans, qat) = self.tl.lookupTransform(from_frame, to_frame, time)
  11.                 break
  12.             except (tf.Exception,tf.LookupException,tf.ConnectivityException, tf.ExtrapolationException):
  13.                 print 'try again'
  14.                 continue
  15.  
  16.         print qat
  17.         return RigidTransform(translation=trans, rotation=qat, from_frame=from_frame, to_frame=to_frame)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement