当前位置: 首页>>代码示例>>Python>>正文


Python Position.fromnp方法代码示例

本文整理汇总了Python中position.Position.fromnp方法的典型用法代码示例。如果您正苦于以下问题:Python Position.fromnp方法的具体用法?Python Position.fromnp怎么用?Python Position.fromnp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在position.Position的用法示例。


在下文中一共展示了Position.fromnp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: to_screen

# 需要导入模块: from position import Position [as 别名]
# 或者: from position.Position import fromnp [as 别名]
 def to_screen(self, pos):
     """
     Does not modify original pos. Converto from field space to screen space.
     :param pos: Position or RobotPosition
     :return: new Position ready to draw on screen
     """
     if pos.__class__.__name__ == "ndarray":
         pos = Position.fromnp(pos)
     pos = pos.clone()
     pos.y = -pos.y
     if hasattr(pos, 'theta'):
         pos.theta = -pos.theta
     pos = pos.move_origin(-75, -65)
     pos.x = int(pos.x*self.field_zoom)
     pos.y = int(pos.y*self.field_zoom)
     return pos
开发者ID:AnthonyCAS,项目名称:vsss2015_Strategy,代码行数:18,代码来源:visualizer.py

示例2: go_with_trajectory

# 需要导入模块: from position import Position [as 别名]
# 或者: from position.Position import fromnp [as 别名]
 def go_with_trajectory(self, goal, current, points_distance=10.0):
     """
     Create a trajectory to go to the desired goal
     :param goal: RobotPosition where we want to go
     :param current: RobotPosition where we are now
     :return: Move
     """
     path = self.trajectory_generator.get_trajectory(
         goal, current, points_distance)
     if path is None:
         alternative_angles = range(-180,180, 45)
         distances = [abs(normalize(goal.theta-angle)) for angle in alternative_angles]
         for dist, angle in sorted(zip(distances, alternative_angles)):
             path = self.trajectory_generator.get_trajectory(
                         RobotPosition(goal.x, goal.y, angle), current, points_distance)
             if path is not None:
                 break
     if path is None:
         return self.go_to_from(goal, current)
     intermediate = Position.fromnp(path[1])
     return self.go_to_from(intermediate, current)
开发者ID:AnthonyCAS,项目名称:vsss2015_Strategy,代码行数:23,代码来源:controller.py


注:本文中的position.Position.fromnp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。