本文整理汇总了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
示例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