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


Python Timer.print_delta方法代码示例

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


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

示例1: dist

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import print_delta [as 别名]
def dist(pos0, pos1):
    dx = float(pos0[0]) - float(pos1[0])
    dy = float(pos0[1]) - float(pos1[1])
    return math.sqrt(dx**2.0 + dy**2.0)

if __name__ == "__main__":
    rospy.init_node("astar_tester")
    t = Timer("MapStorage")
    map = MapStorage()
    map.downsample_map_by_half()
    map.downsample_map_by_half()
    map.expand_map()
    map.expand_map()
    map.expand_map()
    t.print_delta()
    def_marker = Marker()
    def_marker.type = Marker.SPHERE
    def_marker.action = Marker.ADD
    def_marker.scale.x = 0.10
    def_marker.scale.y = 0.10
    def_marker.scale.z = 0.10
    def_marker.color.r = 0.0
    def_marker.color.g = 1.0
    def_marker.color.b = 0.0
    def_marker.color.a = 1.0
    markers = MarkerPlacer("astar_markers", "map", 1000, def_marker)

    # Original map
    # Heuristic: rank = dist(n, goal) + cost
    # cost = current[1].cost + X
开发者ID:thisisG,项目名称:laserbot-ROS,代码行数:32,代码来源:astar_search.py

示例2: ParticleFilter

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import print_delta [as 别名]
                                  self.vel_uniform_dist)
            d_theta = ang_vel / self.odom_rate
            d_x = (lin_vel * math.cos(self.avg_theta))/self.odom_rate
            d_y = (lin_vel * math.sin(self.avg_theta))/self.odom_rate
            self.avg_x += d_x
            self.avg_y += d_y
            self.avg_theta += d_theta


if __name__ == "__main__":
    rospy.init_node("particle_filter")

    start = rospy.get_param("/robot_start", [-64.0, 0.0, 0.0])
    x, y, t = start[0], start[1], start[2]

    scan_topic = "noisy_base_scan"
    pf = ParticleFilter(odom_rate=20.0, sens_median=0.0, sens_std_dev=0.1, vel_uniform_dist=0.1,
                        num_particles=400, base_scan=scan_topic, start_pos=start, debug=True)

    # rospy.sleep(10.0)
    rate = rospy.Rate(1)
    t = Timer("Particle filter")
    try:
        while not rospy.is_shutdown():
            t.reset()
            pf.run()
            t.print_delta()
            rate.sleep()
    except KeyboardInterrupt:
        pass
开发者ID:thisisG,项目名称:laserbot-ROS,代码行数:32,代码来源:particle_filter.py


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