本文整理匯總了Python中navigation.Navigation.spin_clockwise方法的典型用法代碼示例。如果您正苦於以下問題:Python Navigation.spin_clockwise方法的具體用法?Python Navigation.spin_clockwise怎麽用?Python Navigation.spin_clockwise使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類navigation.Navigation
的用法示例。
在下文中一共展示了Navigation.spin_clockwise方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Driver
# 需要導入模塊: from navigation import Navigation [as 別名]
# 或者: from navigation.Navigation import spin_clockwise [as 別名]
#.........這裏部分代碼省略.........
self.start_time = None
self.navigation.stop()
self.change_state(State.DELIVER_spin_and_search_target)
# TODO: Use signatures with pixy
else:
status = self.navigation.wander_and_search_target()
if (status == "TARGET_FOUND"):
self.start_time = None
self.change_state(State.DELIVER_approach_target)
# ---- Deliver Approach Target ----
elif (self.state == State.DELIVER_approach_target):
status = self.navigation.approach_target()
if (status == "LOST_TARGET"):
self.change_state(State.DELIVER_wander_and_search_target)
elif (status == "TARGET_IN_RANGE"):
self.change_state(State.DELIVER_verify_target)
# ---- Deliver Verify Target ----
elif (self.state == State.DELIVER_verify_target):
self.change_state(State.DELIVER_release_cone)
# ---- Deliver Release Cone ----
elif (self.state == State.DELIVER_release_cone):
self.arduino.open_claw()
self.arduino.board.sleep(1)
self.navigation.reverse()
self.arduino.board.sleep(2)
self.navigation.spin_clockwise()
self.arduino.board.sleep(3)
print("Starting over...")
self.change_state(State.COLLECT_spin_and_search_cone)
try:
endpoint = "http://" + constants.GROUP10_IP + constants.GROUP10_ENDPOINT_READY
print("Hitting endpoint: " + endpoint)
# requests.get(endpoint, timeout=0.001)
urlopen(endpoint)
except:
print("Failed to hit Group10 Endpoint, trying again...")
print("Just kidding, I'm giving up!")
elif (self.mode == "manual"):
# print("In manual mode")
if (self.manual_direction == "stop"):
(left_motor, right_motor) = (0.0, 0.0)
elif (self.manual_direction == "forward"):
(left_motor, right_motor) = (0.2, 0.2)
elif (self.manual_direction == "backward"):
(left_motor, right_motor) = (-0.2, -0.2)
elif (self.manual_direction == "right"):
(left_motor, right_motor) = (0.2, 0.0)
elif (self.manual_direction == "left"):
(left_motor, right_motor) = (0.0, 0.2)
print("L: " + str(left_motor) + " R: " + str(right_motor))
self.arduino.set_motors(left_motor, right_motor)
elif (self.mode == "kill"):