ouster-lidar / ouster-sdk

Ouster, Inc. sample code
Other
468 stars 440 forks source link

Running `ouster-cli benchmark-sensor <any_sensor_here>` fails with python runtime error #605

Open wimos-ai opened 3 months ago

wimos-ai commented 3 months ago

Describe the bug A runtime error in python.

To Reproduce

  1. compile the project
  2. get a sensor
  3. Verify connection to sensor via a browser
  4. Determine sensor IP or hostname
  5. run ouster-cli util benchmark-sensor <hostname_or_ip
  6. Get an error message saying object has no atribute

Screenshots image

Platform (please complete the following information):

twslankard commented 3 months ago

Thanks for the report @wimos-ai !

A fix for this issue is in review and will be part of our next patch release.

Here's a patch you may be able to use in the interim.

diff --git a/python/src/ouster/cli/core/util.py b/python/src/ouster/cli/core/util.py
index edd74a80..0e1ee3db 100644
--- a/python/src/ouster/cli/core/util.py
+++ b/python/src/ouster/cli/core/util.py
@@ -32,7 +32,8 @@ from ouster.sdk import client
 from ouster.sdk.util import resolve_metadata

 from ouster.sdk.sensor import SensorMultiPacketReader
-from ouster.sdk.client import ScansMulti, PacketMultiSource, PacketMultiWrapper
+from ouster.sdk.client import ScansMulti, PacketMultiSource, PacketMultiWrapper, PacketFormat
+from ouster.sdk.client.data import ColHeader

 from ouster.sdk.sensor.util import configure_sensor_multi

@@ -437,7 +438,6 @@ def benchmark_sensor(hostname: str, lidar_port: Optional[int],
         click.echo(f"sensor [{idx}] = ")
         click.echo(f"  {'Model':<20}: {meta.prod_line} {meta.fw_rev} {meta.mode}")
         click.echo(f"  {'SN':<20}: {meta.sn}")
-        click.echo(f"  {'hostname':<20}: {meta.hostname}")
         for prop in [
                 "udp_dest", "udp_port_lidar", "udp_port_imu", "lidar_mode",
                 "azimuth_window", "udp_profile_lidar"
@@ -463,6 +463,9 @@ def benchmark_sensor(hostname: str, lidar_port: Optional[int],
     columns_per_packet = [
         m.format.columns_per_packet for m in packet_source.metadata
     ]
+    pf = [
+        PacketFormat(m) for m in packet_source.metadata
+    ]

     xyzlut = [client.XYZLut(info) for info in packet_source.metadata]

@@ -553,7 +556,8 @@ def benchmark_sensor(hostname: str, lidar_port: Optional[int],
             if isinstance(obj, client.LidarPacket):
                 # no scan batching branch
                 packet = obj if not copy_data else deepcopy(obj)
-                packet_num = int(packet.measurement_id[0] / columns_per_packet[idx])
+                packet_num = int(pf[idx].packet_header(ColHeader.MEASUREMENT_ID, packet.buf)[0]
+                    / columns_per_packet[idx])

                 total_packets[idx] += 1

Cheers,

Tom Slankard Staff Engineer Ouster Inc.