def search_straw(self):
if self.listen.frameExists("/j2n6a300_end_effector") and self.listen.frameExists("/root"):
# print ("we are in the search spoon fucntion")
self.listen.waitForTransform('/j2n6a300_end_effector','/root',rospy.Time(),rospy.Duration(100.0))
t = self.listen.getLatestCommonTime("/j2n6a300_end_effector","/root")
translation, quaternion = self.listen.lookupTransform("/j2n6a300_end_effector","/root",t)
matrix1=self.listen.fromTranslationRotation(translation,quaternion)
counter=0
rate=rospy.Rate(100)
while not self.obj_det:
counter = counter + 1
if(counter < 200):
cart_velocities = np.dot(matrix1[:3,:3],np.array([00,0,0.05])[np.newaxis].T) #change in y->x, z->y, x->z
cart_velocities = cart_velocities.T[0].tolist()
self.cmmnd_CartesianVelocity(cart_velocities + [0,0,0,1])
else:
cart_velocities = np.dot(matrix1[:3,:3],np.array([0.0,0,-.05])[np.newaxis].T)
cart_velocities = cart_velocities.T[0].tolist()
self.cmmnd_CartesianVelocity(cart_velocities + [0,0,0,1])
rate.sleep()
if(counter >400):
counter=0
task_7.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录