Example #1
0
def raw_point(ChannelID, azimuth_block):
    """
    Returns a raw data point for a given `ChannelID` and `AzimuthID` within
    a single packet.

    Parameters
    ----------
    ChannelID : uint16
        number between 0 and `N_CHANNEL`-1 identifying the Ouster channel
    azimuth_block : list of packet data
        raw packet data from the azimuth block for processing

    Returns
    -------
    data : list
        [FrameID, AzimuthID, ChannelID, Timestamp, EncoderPosition, Range, Reflectivity, Signal, Noise]
    """
    channel = channel_block(ChannelID, azimuth_block)
    AzimuthID = azimuth_measurement_id(azimuth_block)
    FrameID = azimuth_frame_id(azimuth_block)
    Timestamp = azimuth_timestamp(azimuth_block)
    EncoderPosition = azimuth_encoder_count(azimuth_block)
    Range = channel_range(channel)  # [mm]
    Reflectivity = channel_reflectivity(channel)
    Signal = channel_signal_photons(channel)
    Noise = channel_noise_photons(channel)

    return [
        FrameID, AzimuthID, ChannelID, Timestamp, EncoderPosition, Range,
        Reflectivity, Signal, Noise
    ]
Example #2
0
def xyz_point(channel_n, azimuth_block):
    if not _trig_table:
        raise UninitializedTrigTable()

    channel = channel_block(channel_n, azimuth_block)
    table_entry = _trig_table[channel_n]
    range = channel_range(channel) / 1000  # to meters
    adjusted_angle = table_entry[2] + azimuth_angle(azimuth_block)
    x = -range * table_entry[1] * math.cos(adjusted_angle)
    y = range * table_entry[1] * math.sin(adjusted_angle)
    z = range * table_entry[0]

    return [x, y, z]
Example #3
0
def raw_values(packet, os16=False):

    channels = OS_16_CHANNELS if os16 else OS_128_CHANNELS
    if not isinstance(packet, tuple):
        packet = unpack(packet)

    ch = []
    timeStamp = []
    encoderCount = []
    measurementID = []
    frameID = []
    x = []
    y = []
    z = []
    ch_range = []
    reflectivity = []
    intensity = []
    noise = []

    for b in range(AZIMUTH_BLOCK_COUNT):
        block = azimuth_block(b, packet)

        # if not azimuth_valid(block):
        #     continue

        for c in channels:
            channel = channel_block(c, block)
            ch.append(c)
            ch_range.append(channel_range(channel))
            timeStamp.append(azimuth_timestamp(block))
            encoderCount.append(azimuth_encoder_count(block))
            measurementID.append(azimuth_measurement_id(block))
            frameID.append(azimuth_frame_id(block))
            point = xyz_point(c, block)
            x.append(point[0])
            y.append(point[1])
            z.append(point[2])
            reflectivity.append(channel_reflectivity(channel))
            intensity.append(channel_signal_photons(channel))
            noise.append(channel_noise_photons(channel))

    return ch, ch_range, reflectivity, intensity, timeStamp, encoderCount, measurementID, frameID, x, y, z, noise