RTI Recording Service와 DDS로 ROS2 LiDAR 데이터 재생하기
실제 테스트는 분산 및 자율 시스템에 필수적이지만 비용이 엄청날 수 있습니다. 센서 데이터를 캡처하고 재생함으로써 팀은 각 테스트 세션에서 지속적인 가치를 창출할 수 있습니다.
GPS, 카메라, LiDAR, RADAR, 관성 센서, 전체 제어 신호 제품군을 갖춘 반자율 주행차량을 상상해 보세요. 단일 주행 중 생성되는 데이터 양은 엄청나고, 반복적인 실도로 시험 비용은 높습니다. 나중에 재생하기 위해 해당 데이터를 기록하는 것(본질적으로 테스트 세션의 디지털 라이브러리 생성)은 테스트 반복성과 유연성을 극적으로 개선합니다.
수년간 DDS 사용자들은 RTI Recording Service를 통해 고대역폭 기록과 재생에 접근해 왔습니다. 해상 함정의 해상 시험 같은 장기 배포 중 모든 시스템 데이터를 24/7 지속적으로 캡처 지원. DDS의 분산 아키텍처 덕분에 여러 Recording Service 인스턴스를 실행하여 거대한 데이터 스트림을 따라잡을 수 있습니다.
DDS를 프로세스 간 통신에 의존하는 ROS2는 동일한 현장 검증된 Recording Service를 활용해 LiDAR 포인트 클라우드 같은 고대역폭 ROS2 토픽을 캡처할 수 있습니다. 다음 예제에서는 중간 대역폭 토픽(ROS2 LiDAR 데이터)을 설정하고 DDS 도구만으로 ROS2로 재생합니다.
레코더 구성
RTI Recording Service는 기록할 토픽, 원하는 QoS 설정, 스토리지 옵션을 지정하는 XML 구성 파일로 구동됩니다. 이 설정에서는 ROS2 PointCloud2 데이터 타입을 단일 열로 처리하여 이 대용량 데이터 타입에 대한 비용이 많이 드는 역직렬화를 피하도록 레코더에 지시합니다.
아래는 ros2_record.xml이라는 이름의 XML 파일입니다:
<dds xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/5.3.1/rti_record.xsd">
<recorder name="simple_example">
<!-- Enable remote access to RTI Recorder. The Recorder creates one
DataReader and one DataWriter in the specified domain. -->
<remote_access>
<enabled>true</enabled>
<remote_access_domain>0</remote_access_domain>
</remote_access>
<!-- Base name for the set of files that will store recorded data -->
<recorder_database>
<database_name>ros2_replay_example.dat</database_name>
<overwrite>true</overwrite>
</recorder_database>
<!-- Record data from one domain -->
<domain name="domain0">
<domain_id>0</domain_id>
<!-- Turn off deserialization for ROS2 ‘PointCloud2’ data type (over 5k elements) -->
<deserialize_mode>RTIDDS_DESERIALIZEMODE_NEVER</deserialize_mode>
</domain>
<!-- Create a TopicGroup that only records rt/velodyne_points topics -->
<topic_group name="ros-rt">
<topics><topic_expr>rt/velodyne_points</topic_expr></topics>
<field_expr>*</field_expr>
</topic_group>
<!-- Create a RecordGroup -->
<record_group name="RecordAll">
<!-- Specify which domains to record from -->
<domain_ref><element>domain0</element></domain_ref>
<!-- Specify which TopicGroups to record -->
<topic_ref><element>ros-rt</element></topic_ref>
</record_group>
<!-- Add domain and typecode info to record ROS2 ‘PointCloud2’ type -->
<domain_type_config>
<domain_group>
<element>
<domain_filter>
<element>domain0</element>
</domain_filter>
<type_config>
<xml>
<file_group>
<element>
<file_name>
<element>PointCloud2.xml</element>
</file_name>
<type>
<element>
<register_top_level>false</register_top_level>
<type_name>sensor_msgs::msg::dds_::PointCloud2_</type_name>
<registered_type_name>
<element>sensor_msgs::msg::dds_::PointCloud2_</element>
</registered_type_name>
<topics><element>rt/velodyne_points</element></topics>
</element>
</type>
<max_sequence>2147483647</max_sequence>
</element>
</file_group>
<path>
<element>.</element>
</path>
</xml>
</type_config>
</element>
</domain_group>
</domain_type_config>
</recorder>
</dds>
ros2_record.xml이 있는 디렉토리에서 다음 명령으로 Recording Service 시작:
rtirecord -cfgFile ros2_record.xml -cfgName simple_example
서비스가 LiDAR 토픽을 구독하여 중지할 때까지 지속적으로 기록. 출력은 ros2_replay_example.dat_0_0이라는 SQLite 데이터베이스. 이후 기록 세션은 파일명에 숫자 접미사 추가로 사용자 정의 크기 제한 내 유지.
리플레이어 구성
데이터가 기록되었으니 이제 ROS2 환경으로 재생할 수 있습니다. 이전 블로그 게시물에서 ROS2가 원활한 상호운영을 위해 몇 가지 QoS 조정이 필요함을 강조했습니다. 이 예제에서는 ROS2 "Bouncy Bolson"(또는 rmw_connext_cpp 사용하는 모든 ROS2 릴리스)의 기본 구성과 맞추기 위해 타입 코드 전송을 억제합니다.
다음 XML 파일 ros2_replay.xml이 RTI Replay Service를 구동합니다:
<?xml version="1.0"?>
<dds xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/5.3.1/rti_replay.xsd">
<!-- Example configuration for RTI Replay Service 2.0, tailored for ROS2 rt/* topics (PointCloud2) -->
<replay_service name="simple_example">
<annotation>
<documentation>Replay service example</documentation>
</annotation>
<time_control>
<rate>1</rate> <!-- Optional rate multiplier -->
<start_mode>AUTO</start_mode>
<start_offset><sec>5</sec></start_offset>
</time_control>
<!-- Source Database, Required -->
<replay_database name="simple_config">
<filename>ros2_replay_example.dat_0_0</filename>
<readonly>false</readonly>
<!-- Participant configuration. Suppress sending typeCode info (for ROS2) -->
<participant>
<domain_id>0</domain_id>
<participant_qos>
<resource_limits>
<type_code_max_serialized_length>0</type_code_max_serialized_length>
<type_object_max_serialized_length>0</type_object_max_serialized_length>
</resource_limits>
</participant_qos>
</participant>
<!-- Get typeCode info for playback (PointCloud2 type) -->
<type_config>
<xml>
<file_group>
<element>
<file_name>
<element>PointCloud2.xml</element>
</file_name>
<type>
<element>
<register_top_level>false</register_top_level>
<type_name>sensor_msgs::msg::dds_::PointCloud2_</type_name>
<registered_type_name>
<element>sensor_msgs::msg::dds_::PointCloud2_</element>
</registered_type_name>
<topics><element>rt/velodyne_points</element></topics>
</element>
</type>
<max_sequence>2147483647</max_sequence>
</element>
</file_group>
<path><element>.</element></path>
</xml>
</type_config>
<session name="A_Session">
<!-- Default values for <time_control> * -->
<replay_topic name="All_Topic">
<input>
<topic_name>*</topic_name>
<type_name>*</type_name>
<record_group_name>*</record_group_name>
<domain_name>*</domain_name>
</input>
</replay_topic>
</session>
</replay_database>
</replay_service>
</dds>
기록된 데이터를 ROS2로 재생하려면 실행:
rtireplay -cfgFile ros2_replay.xml -cfgName simple_example
결과
일련의 ROS2 LiDAR 세션 기록 후, 데이터를 온디맨드로 재생할 수 있습니다. 다음 스크린샷은 ROS2 환경 내 재생된 포인트 클라우드를 보여줍니다:

이 접근법은 테스트 중 전용 자동차 시뮬레이터나 물리적 차량이 필요 없게 합니다. 리플레이 XML의 <time_control><rate> 설정 조정으로 재생 가속 가능—실제로 몇 분 만에 고속 시나리오 시뮬레이션.
ROS2와 DDS 통합에 대한 더 깊은 통찰은 A Field Guide to Interoperability and When Ecosystems Merge 같은 이전 RTI 블로그 게시물 참조.