Exemplo n.º 1
0
    current_time = 0
    seconds_per_output = 1
    SECONDS_PER_MINUTE = 60.0
    rotations = []
    while 1:
        try:
            rotation = Rotation(lasr.gather_full_rotation())
            rotations = rotations[-4:]
            rotations.append(rotation)
            # rotation = OldRotation(lasr.gather_full_rotation())
            #
            # For now, we just output a lidar data snapshot every 10 seconds
            # We will want this for debugging (maybe every second instead)
            # change the "seconds_per_output" to tune that.
            #
            tgt_heading, tgt_range = Analyzer.range_at_heading(rotation.polar_data(), (Analyzer.start, Analyzer.stop))
            logger.info(
                "{:d} points yields {:.2f} inches at {:2d} degrees)".format(
                    len(rotation.polar_data()), tgt_range, tgt_heading
                )
            )

            # push the newly calculated data into the message
            range_at_heading_message.heading = tgt_heading
            range_at_heading_message.range = tgt_range
            channel.send_to(range_at_heading_message.encode_message())

            # push periodic message to the bot
            periodic_message.status = "ok"
            periodic_message.rpm = rotation.rpm()
            channel.send_to(periodic_message.encode_message())
Exemplo n.º 2
0
	slice_index = 0
        file_index = 1
        rotation_time = 0
        current_time = 0
        seconds_per_output = 10
        SECONDS_PER_MINUTE = 60.0
	while 1: 
		try:
                        rotation = Rotation(lasr.gather_full_rotation())
                        # rotation = OldRotation(lasr.gather_full_rotation())
                        #
                        # For now, we just output a lidar data snapshot every 10 seconds
                        # We will want this for debugging (maybe every second instead)
                        # change the "seconds_per_output" to tune that.
                        #
                        tgt_heading, tgt_range = Analyzer.range_at_heading(rotation.polar_data(), (Analyzer.start, Analyzer.stop))
                        logger.info("{:d} points yields {:.2f} inches at {:2d} degrees)".format(len(rotation.polar_data()),tgt_range, tgt_heading))

                        # push the newly calculated data into the message
                        range_at_heading_message.heading = tgt_heading
                        range_at_heading_message.range = tgt_range
                        channel.send_to(range_at_heading_message.encode_message())

                        # push periodic message to the bot
                        periodic_message.status = 'ok'
                        periodic_message.rpm = rotation.rpm()
                        channel.send_to(periodic_message.encode_message())

 		except IOError,e:
                        #  log and notify robot of error
                        periodic_message.status = 'error'