Skip to content

Conversation

@leshy
Copy link
Contributor

@leshy leshy commented Feb 11, 2026

No description provided.

…notations`

The future annotations import made Out[PointCloud2] and Out[Imu] lazy
strings, preventing the Module metaclass from creating real port
descriptors. Move type imports out of TYPE_CHECKING block so ports
are properly resolved at class definition time.
Livox-specific module (LivoxLidarModule, LivoxLidarModuleConfig) now
lives in dimos/hardware/sensors/lidar/livox/module.py alongside the
driver and SDK code. Generic LidarModule stays in the parent.
@greptile-apps
Copy link

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR integrates Livox Mid-360 LiDAR hardware support into the dimos framework. The implementation includes:

  • Complete Livox SDK2 ctypes bindings (sdk.py) for interfacing with the C library
  • Hardware driver (mid360.py) with point cloud and IMU streaming via RxPy observables
  • Module wrapper (livox/module.py) extending the base LidarModule with IMU support
  • New Imu message type compatible with ROS sensor_msgs
  • Protocol specs for Lidar and IMU interfaces
  • Bug fix for port resolution broken by from __future__ import annotations

The implementation follows good practices with thread-safe queuing, proper SDK lifecycle management, and comprehensive error handling. The code is well-documented and includes spec compliance tests.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with proper thread safety, error handling, and comprehensive SDK bindings. The port resolution fix addresses a real issue. Only minor style improvements suggested.
  • No files require special attention - all changes are well-implemented

Important Files Changed

Filename Overview
dimos/hardware/sensors/lidar/livox/mid360.py Livox Mid-360 hardware driver with ctypes SDK bindings, point cloud and IMU streaming - well-structured with proper thread safety and error handling
dimos/hardware/sensors/lidar/livox/sdk.py ctypes bindings for Livox SDK2 C library - comprehensive struct definitions and library loading logic
dimos/hardware/sensors/lidar/livox/module.py LivoxLidarModule extends base LidarModule with IMU support - clean implementation but missing from __future__ import annotations
dimos/hardware/sensors/lidar/module.py Fixed port resolution issue by removing future annotations that broke Module metaclass
dimos/hardware/sensors/lidar/spec.py New LiDAR hardware interface spec with point cloud and optional IMU streams
dimos/msgs/sensor_msgs/Imu.py New IMU message type with ROS sensor_msgs/Imu compatibility and LCM encoding

Sequence Diagram

sequenceDiagram
    participant User
    participant LivoxLidarModule
    participant LivoxMid360
    participant LivoxSDK
    participant HardwareDevice as Livox Hardware

    User->>LivoxLidarModule: start()
    LivoxLidarModule->>LivoxMid360: pointcloud_stream()
    LivoxMid360->>LivoxSDK: init(config, host_ip)
    LivoxSDK->>LivoxSDK: load shared library
    LivoxSDK->>HardwareDevice: connect via network
    
    LivoxMid360->>LivoxSDK: set_point_cloud_callback()
    LivoxMid360->>LivoxSDK: set_imu_callback()
    LivoxMid360->>LivoxSDK: set_info_change_callback()
    LivoxMid360->>LivoxSDK: start()
    
    LivoxSDK->>HardwareDevice: start device communication
    
    loop Point Cloud Data
        HardwareDevice->>LivoxSDK: UDP packet (points)
        LivoxSDK->>LivoxMid360: callback with packet
        LivoxMid360->>LivoxMid360: enqueue to _pc_queue
        LivoxMid360->>LivoxMid360: consumer thread aggregates
        LivoxMid360->>LivoxLidarModule: emit PointCloud2
        LivoxLidarModule->>User: publish to pointcloud port
    end
    
    loop IMU Data
        HardwareDevice->>LivoxSDK: UDP packet (IMU)
        LivoxSDK->>LivoxMid360: callback with packet
        LivoxMid360->>LivoxMid360: enqueue to _imu_queue
        LivoxMid360->>LivoxMid360: consumer thread processes
        LivoxMid360->>LivoxLidarModule: emit Imu
        LivoxLidarModule->>User: publish to imu port
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

# See the License for the specific language governing permissions and
# limitations under the License.

"""Livox-specific LiDAR module with IMU support."""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing from __future__ import annotations import that was intentionally removed from dimos/hardware/sensors/lidar/module.py to fix port resolution

Suggested change
"""Livox-specific LiDAR module with IMU support."""
"""Livox-specific LiDAR module with IMU support."""
from __future__ import annotations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant