Conversation
Greptile OverviewGreptile SummaryThis PR adds depth image compression using DepthLiteZ algorithm to reduce storage requirements for 16-bit depth images by 5-10x. The implementation includes a new filters library, ROS1/ROS2 plugin integration, and conditional compilation support. Major Changes:
Critical Issues Found:
Style Issues:
Testing Impact:
|
| Filename | Overview |
|---|---|
| apps/axon_recorder/recording_session.cpp | Added composite key for channel registration, but breaks backward compatibility with get_channel_id() |
| middlewares/ros2/src/ros2_subscription_wrapper.cpp | Race condition in callback accessing subscriptions map without lock |
| middlewares/filters/src/depth_compressor.cpp | Unsafe const_cast on input data passed to dlz library |
| middlewares/ros2/CMakeLists.txt | Uses deprecated ament_target_dependencies instead of modern target_link_libraries |
| apps/axon_recorder/test/unit/test_recording_session.cpp | Tests will fail due to broken get_channel_id implementation |
Sequence Diagram
sequenceDiagram
participant App as Axon Recorder
participant Plugin as ROS2 Plugin
participant SubMgr as SubscriptionManager
participant Filter as DepthCompressionFilter
participant Compressor as DepthCompressor
participant Session as RecordingSession
participant MCAP as MCAP Writer
Note over App,Plugin: Initialization Phase
App->>Plugin: init() with config
App->>Plugin: subscribe(topic, type, options_json)
Plugin->>Plugin: Parse depth_compression from options_json
Plugin->>SubMgr: subscribe(topic, type, options)
alt Depth Compression Enabled
SubMgr->>Filter: Create DepthCompressionFilter(config)
Filter->>Compressor: Configure compression level
end
SubMgr->>SubMgr: Create GenericSubscription
SubMgr->>SubMgr: Store filter in subscriptions map
Note over App,MCAP: Recording Phase - Message Flow
Plugin->>SubMgr: ROS message arrives
SubMgr->>SubMgr: Extract serialized bytes
alt Depth Compression Enabled
SubMgr->>Filter: filter_and_process(topic, type, data)
Filter->>Filter: Deserialize to sensor_msgs::Image
Filter->>Filter: Check if 16UC1 encoding
alt Is 16UC1 Depth Image
Filter->>Compressor: compress(depth_data, width, height)
Compressor->>Compressor: Cast to int16_t and call dlz::CompressEx
Compressor-->>Filter: compressed_data
Filter->>Filter: Build CompressedImage message
Filter->>Filter: Change type to sensor_msgs/msg/CompressedImage
end
Filter-->>SubMgr: Processed message (original or compressed)
end
SubMgr->>App: Callback with processed message
App->>Session: get_or_create_channel(topic, message_type)
alt Channel Not Exists
Session->>Session: Auto-register schema for message_type
Session->>Session: Create composite key (topic + "\\n" + message_type)
Session->>MCAP: register_channel()
Session->>Session: Store in topic_channel_ids map
end
Session-->>App: channel_id
App->>Session: write(channel_id, data, timestamp)
Session->>MCAP: Write message to MCAP file
Additional Comments (1)
After the changes, This breaks backward compatibility for any code that registers a channel with Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/axon_recorder/recording_session.cpp
Line: 210:214
Comment:
Potential broken behavior: `get_channel_id` now searches by topic only but map uses composite keys
After the changes, `topic_channel_ids_` uses composite keys (`topic + "\n" + message_type`), but `get_channel_id(topic)` still searches by topic alone. This will fail to find any channels registered after the change, always returning 0.
This breaks backward compatibility for any code that registers a channel with `register_channel()` and then looks it up with `get_channel_id()`.
How can I resolve this? If you propose a fix, please make it concise. |
f85da47 to
42e9b54
Compare
Pull Request Checklist
Please ensure your PR meets the following requirements:
make testormake docker-test)make format)Summary
This PR adds depth image compression filter using DepthLiteZ algorithm for ROS1 and ROS2 plugins, achieving 5-10x compression ratio on 16-bit depth images.
Motivation
Depth images consume significant storage space in robotics recordings. A specialized compression filter is needed to reduce storage costs and improve upload performance without losing depth precision.
Changes
Modified Files
Added Files
Deleted Files
Type of Change
Impact Analysis
Breaking Changes
None
Backward Compatibility
Fully backward compatible. Depth compression is opt-in via CMake option
AXON_ENABLE_DEPTH_COMPRESSION=ON. Default behavior unchanged when option is disabled.Testing
Test Environment
Test Cases
Manual Testing Steps
cmake -DAXON_ENABLE_DEPTH_COMPRESSION=ON .../axon_recorder --config config/default_config_ros2.yaml_compressedsuffixTest Coverage
Screenshots / Recordings
N/A
Performance Impact
Documentation
Related Issues
Additional Notes
middlewares/filters/depthlitezgit clone --recursiveor rungit submodule update --init --recursivedepth_compression.mode: fast|medium|maxmediumfor balanced compression ratio and performanceReviewers
@zhexuany
Notes for Reviewers
Checklist for Reviewers