python - ROS frame transformation (camera to base) -


i working baxter robot , trying position of object using augmented reality markers , move hand position in order grasp it.

i using ar_tools package position/orientation of object, respect head_camera using. last couple of days i've been experimenting how change reference frame (head_camera) base frame frame used moveit make plans. have tried set frame_id of header of message receive ar_tools manually 'base':

 pose_target.header.frame_id = 'base' 

but position , orientation getting still wrt head_camera. tried do:

self.tl.lookuptransform("/base", "/head_camera", self.t)  

where self.t = self.tl.getlatestcommontime("/head_camera", "/base"), getting extrapolation error.

the transformation requires extrapolate in past

(i can't remember , i'm not in lab.) thought might need run lookuptransform head_cam head, head torso , torso baxter's base.

could guide me on how change frame of marker of ar_tools head_camera base?

also, extrapolation error, there way in static way?

there more straightforwards way this, presuming you're reviving posestamped message ar_tools:

on_received_pose(pose):     '''     handler poses ar_tools     '''     if self.tl.waitfortransform(pose.header.frame_id, "/base", pose.header.stamp, rospy.duration(0.1)): # line prevents extrapolation error, waits 0.1 seconds transform become valid         transd_pose = self.tl.transformpose("/base",pose)         # whatever transformed pose here     else:         rospy.logwarn('couldn\'t transform "{}" "/base"  before timeout. updating tf tree sufficiently?'.format(pose.header.frame_id)) 

you're getting extrapolation error because transform network wasn't formed @ time got first message; tf refuses extrapolate, interpolate, if haven't received @ least 1 transform message every frame both before , after (or at) timestamp you're trying transform to, throw exception. added if statement checks see if can perform transform before trying so. of course surround transformpose() call in try/catch block instead, feel tf makes more explicit you're trying do.

in general, check out simple ros tf python tutorial more examples/modes of operation.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -