Beispiel #1
0
		if direction in moveCommandDeltas:
			odomMeasure = odom.updatePosition(moveCommandDeltas[direction])
			if odomMeasure is not None:
				part_filt.moveParticles(odomMeasure)

		sensor_readings = sensor.getNoisyDistances(odom.getActualPosition())
		sensor_angles = sensor.getSensorAngles()
		sensor_angles_rads = [math.radians(angle) for angle in sensor_angles]
		part_filt.weightParticles(sensor_readings)

		# Update the robot map using particle filter knowledge
		the_robot_map.updateMap(sensor_angles, sensor_readings)

		endTime = time.time()

		print "Time per particle without visualization: ", (endTime-startTime)/part_filt.getNumParticles()
		# visualize the particles every 10 steps
		# if step_count % 10 == 0:
		# 	viz.replot_particles(part_filt.getParticleLocations())
		viz.replot_particles(part_filt.getParticleLocations())

		# update the visual position
		viz.move_robot(new_coord=odom.getActualPosition())


		viz.display_plot()
		if (step_count % 10) == 0:
			viz.display_a_matrix(the_robot_map.getMap())
		
		endTime = time.time()