コード例 #1
0
ファイル: utils.py プロジェクト: Venicius/rpi-ouster
def xyz_points_with_time(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 = []

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

        if not azimuth_valid(block):
            continue

        for c in channels:
            ch.append(c)
            timeStamp.append(azimuth_timestamp(block))
            encoderCount.append(azimuth_encoder_count(block))
            measurementID.append(azimuth_measurement_id(block))
            frameID.append(azimuth_frame_id(block))

    return ch, timeStamp, encoderCount, measurementID, frameID
コード例 #2
0
def xyz_points(packet, os16=False):
    """
    Returns a tuple of x, y, z points where each x, y, z is a list of
    all the x, y or z points in the packet

        (
            [x1, x2, ...],
            [y1, y2, ...],
            [z1, z2, ...],
        )
    """
    channels = OS_16_CHANNELS if os16 else OS_64_CHANNELS
    if not isinstance(packet, tuple):
        packet = unpack(packet)

    x = []
    y = []
    z = []

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

        if not azimuth_valid(block):
            continue

        for c in channels:
            point = xyz_point(c, block)
            x.append(point[0])
            y.append(point[1])
            z.append(point[2])
    return x, y, z
コード例 #3
0
ファイル: utils.py プロジェクト: grosskc/ouster-python
def raw_points(packet, os16=False):
    """
    Returns a list of raw data point lists for a given packet.

    Parameters
    ----------
    packet : bytearray
        UDP raw packet data
    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]
    """
    channels = OS_16_CHANNELS if os16 else OS_64_CHANNELS
    if not isinstance(packet, tuple):
        packet = unpack(packet)

    raw = []
    for b in range(AZIMUTH_BLOCK_COUNT):
        block = azimuth_block(b, packet)
        if azimuth_valid(block):
            for c in channels:
                raw.append(raw_point(c, block))
    return raw
コード例 #4
0
ファイル: utils.py プロジェクト: Venicius/rpi-ouster
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
コード例 #5
0
def xyz_columns(packet, os16=False):
    """
    Similar to xyz_points except the x, y, z values are ordered by
    column. This is convenient if you only want to render a specific
    column.

    The structure of it will be be columns containing channels. It
    looks like...

        [
            # column 1
            [
                [channel1_x, channel2_x, ...],
                [channel1_y, channel2_y, ...],
                [channel1_z, channel2_z, ...],
            ],
            # column 2
            [
                [channel1_x, channel2_x, ...],
                [channel1_y, channel2_y, ...],
                [channel1_z, channel2_z, ...],
            ],
        ]
    """
    channels = OS_16_CHANNELS if os16 else OS_64_CHANNELS
    if not isinstance(packet, tuple):
        packet = unpack(packet)

    points = []
    for b in range(AZIMUTH_BLOCK_COUNT):
        block = azimuth_block(b, packet)
        x = []
        y = []
        z = []

        for channel in channels:
            point = xyz_point(channel, block)
            x.append(point[0])
            y.append(point[1])
            z.append(point[2])
        points.append([x, y, z])
    return points