本文整理汇总了Python中navigation.Navigation.move_to_shelf方法的典型用法代码示例。如果您正苦于以下问题:Python Navigation.move_to_shelf方法的具体用法?Python Navigation.move_to_shelf怎么用?Python Navigation.move_to_shelf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation.Navigation
的用法示例。
在下文中一共展示了Navigation.move_to_shelf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Milestone1GUI
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import move_to_shelf [as 别名]
#.........这里部分代码省略.........
if not rotate_count:
rotate_count = 2
topic_name = '/base_controller/command'
base_publisher = rospy.Publisher(topic_name, Twist)
twist_msg = Twist()
twist_msg.linear = Vector3(0.0, 0.0, 0.0)
twist_msg.angular = Vector3(0.0, 0.0, 0.5)
start_time = rospy.get_rostime()
while rospy.get_rostime() < start_time + rospy.Duration(15.0 * rotate_count):
base_publisher.publish(twist_msg)
def navigate_to_shelf(self, marker_id = None):
# Move forward, place book on the shelf, and move back
if marker_id is None or marker_id is False:
marker_id = self.marker_perception.get_marker_id()
rospy.loginfo("marker id returned by get_marker_id is: " + str(marker_id))
if marker_id is False:
rospy.loginfo("wuuuuuuuut")
if marker_id is None:
self._sound_client.say("I don't think I am holding a book "
"right now")
rospy.logwarn("Navigate to shelf called when marker id is None")
return
book = self.book_map.get(unicode(marker_id))
if book is None:
self._sound_client.say("The book that I am holding is unknown "
"to me")
rospy.logwarn("Navigate to shelf called when marker id is not in database")
return
x = book.getXCoordinate()
y = book.getYCoordinate()
self.navigation.move_to_shelf(x, y)
# Ye Olde Dropping way of putting a book on the shelf. Deprecating.
def drop_on_shelf(self):
self.saved_r_arm_pose = Milestone1GUI.PLACE_ON_SHELF_R_POS
self.move_arm('r', 4.0, True) # Increase these numbers for slower movement
self.move_base(True)
self.r_gripper.open_gripper(True)
self.saved_r_arm_pose = Milestone1GUI.RELEASE_BOOK_R_POS
self.move_arm('r', 2.0, True) # Increase these numbers for slower movement
self.move_base(False)
self.marker_perception.reset_marker_id()
def place_on_shelf(self):
self.saved_r_arm_pose = Milestone1GUI.PLACE_ON_SHELF_R_POS
self.move_arm('r', 4.0, True) # Increase these numbers for slower movement
self.move_base(True)
self.saved_r_arm_pose = Milestone1GUI.LOWER_ON_SHELF_R_POS
self.move_arm('r', 2.0, True) # Increase these numbers for slower movement
self.r_gripper.open_gripper(True)
self.move_base(False)
self.marker_perception.reset_marker_id()
def give_information(self):
marker_id = self.marker_perception.get_marker_id()
rospy.loginfo("marker id returned by get_marker_id is: " + str(marker_id))
if marker_id is not None:
book = self.book_map.get(unicode(marker_id))
if book is None:
rospy.logwarn("Give information called when marker id is not in database")
self._sound_client.say("The book that I am holding is unknown to me")
else:
self._sound_client.say(book.getInformation())