本文整理汇总了Python中searcher.Searcher.search_one_of方法的典型用法代码示例。如果您正苦于以下问题:Python Searcher.search_one_of方法的具体用法?Python Searcher.search_one_of怎么用?Python Searcher.search_one_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类searcher.Searcher
的用法示例。
在下文中一共展示了Searcher.search_one_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Actions
# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import search_one_of [as 别名]
#.........这里部分代码省略.........
TODO: have several kick types, one for passing, one for kicking towards goal.
"""
ballkicker = BallKicker(self, target_left_right_posts=target_left_right_posts)
ballkicker.start()
return ballkicker
@returnsbd # must be first
def runSecondary(self, direction):
""" Go to a predefined point and then run kicker depending on the kick off side chosen.
Returns an already initialized SecondaryStarter instance which can be used to stop the current activity
"""
second = SecondaryStarter(self, direction=LEFT)
second.start()
return second
@returnsbd # must be first
def passBall(self, target_world_frame=None):
passingChallange = passBall(self._eventmanager, self)
passingChallange.start()
return passingChallange
@stopped(['searcher', 'centerer'])
@setfps(20)
def track(self, target, lostCallback=None):
""" Track an object that is seen. If the object is not seen,
does nothing. """
return self.tracker.start(target=target, lostCallback=lostCallback)
@returnsbd # must be first
@stopped(['tracker', 'centerer'])
@setfps(20)
def search(self, targets, center_on_targets=True, stop_on_first=False):
if stop_on_first:
return self.searcher.search_one_of(targets, center_on_targets)
else:
return self.searcher.search(targets, center_on_targets)
# TODO: returns centered, maybe_bd - I should wrap this too, but returnsbd
# is too inflexible.
def executeTracking(self, target, normalized_error_x=0.05, normalized_error_y=0.05,
return_exact_error=False):
if not all(x.stopped for x in self.headControllers):
raise Exception("Can't start searching while tracking")
return self.tracker.executeTracking(target,
normalized_error_x=normalized_error_x,
normalized_error_y=normalized_error_y)
@returnsbd # must be first
def localize(self):
return self.localizer.start() # a Behavior, hence a BurstDeferred
#===============================================================================
# Mid Level - any motion that uses callbacks
#===============================================================================
@returnsbd # must be first (since other wrappers don't copy the attributes..)
@legal_any
@setfps(10)
def changeLocationRelative(self, delta_x, delta_y = 0.0, delta_theta = 0.0,
walk=walks.STRAIGHT_WALK, steps_before_full_stop=0):
"""
Add an optional addTurn and StraightWalk to ALMotion's queue.
Will fire EVENT_CHANGE_LOCATION_DONE once finished.
Coordinate frame for robot is same as world: x forward, y left (z up)