03장 DDS란 무엇인가?

  1. DDS란 무엇일까?

(1) MiddleWare:양 쪽을 연결하여 데이터를 주고받을 수 있도록 중간에서 매개 역할을 하는 소프트웨어네트워크를 통해서 연결된 여러 개의 컴퓨터에 있는 많은 프로세스들에게 어떤 서비스를 사용할 수 있도록 연결해줌.

(2) DDS 배경(http://design.ros2.org/articles/ros_on_dds.html)

ROS의 새로운 통신 시스템을 알아보던중, 처음 옵션은 ROS1 통신을 개선하거나 ZeroMO 라이브러리 같은 새로운 미들웨어를 만드는 것 이었다. 하지만 프로토콜 버퍼와 Zeroconf는 모두 다른 파트에서 만들어져야 했고 다른 end-to-end 미들웨어를 고려해야 했다. 이 과정에서 제기된 미들웨어가 DDS였다.

(3) End-to-End MiddleWare 장점: 유지하고 작동하기 훨씬 적은 코드 필요 + 정확한 세부사항이 공개되어 있다.

점: ROS가 기존 설계 내에서 작동해야한다는 것이다. 설계가 관련 사용 사례를 대상으로 하지 않거나 융통성이 없는 경우 설계를 해결해야 할 수도 있다. On some level, adopting an end-to-end middleware includes adopting the philosophy and culture of that middleware, which should not be taken lightly.

(4) DDS란?

OMG(Object Management Group)에서 표준화 한 실시간 발간자-구독자 방식 통신 미들웨어분산 서비스.

<통신 프로토콜>

실시간 : RTPS(Real Time Publish Subscribe)

UDP 기반이지만, QoS 설정을 통해 UDP/TCP의 기능을 선택적으로 사용 가능함.

•TCP: 신뢰성 기반

접속 후 데이터 전송, 확인 후 재전송 후 클로즈. 특정 시간에 테스크 하지 않을 수 있음. 지연 가능성.

•UDP: 신뢰성 부족.

커넥션과 클로즈 없음. 확인하지 않음. 가장 효율적인 상태.

•Qos best effort기반이지만 중간에 확인할수 있도록 옵션 추가. 모든 특성을 선택적으로 가짐.→ ROS2 기본 통신

(5)DDS 특징 - Data Centricity (데이터 중심)

•단순한 데이터 타입 정의. IDL이 많이 사용. XML도 사용 가능.

•Topic은 문자열 형식으로 정의. 토픽을 통하여 통신

•DDS 도메인에서 토픽 조합. 각자 독립적으로 활동.

•QoS를 붙여서 쉽게 토픽의 생존성에 대한 설정. 성능이 뛰어나짐.

(6) DDS 특징 - Dynamic Discovery

•자동으로 퍼블리셔/서브스크라이버 어디 있는지 확인.

•노드를 켰다 끄며 플러그 엔 플레이.

(7) DDS 특징 - Scalable Architecture

•빠른 속도로 정보 전달.

•많은 데이터 관리

•보안 제공

•Edge to Fog to Cloud- 가까이에서 멀리 보냄.

(8) DDS 특징 - Interperability

•상호 운용성. 표준화 된 규격. 다른 회사 로봇들도 서로 동작 가능.

(9) QoS

•약 20가지 정도로 구조체화 되어있다.

QoS policies

(10) 메세지

ROS1의 형식을 보존하였다.

2. 실습https://github.com/ros2/demos.git

(1) Historys-values

KEEP_LAST : 정해진 사이즈 만큼의 데이터를 보관

depth: 메세지 큐 사이즈KEEP_ALL: 모든 데이터를 보관 (메세지 큐 사이즈는 벤더마다 다름)

-examples

rclcpp::QoS(rclcpp::KeepLast(depth)).reliable().durability_volatile();

rclcpp::QoS(rclcpp::KeepAll).best_effort().transient_local();

(2) Reliability

-values

BEST_EFFORT: 데이터 송신에 집중, 상태에 따라 유실 발생 가능

RELIABLE: 데이터 수신에 집중 유실이 발생하면 재전송을 통해 수신을 보장함

-RxO

-example

srclcpp::QoS(rclcpp::KeepLast(depth)).reliable().durability_volatile();

rclcpp::QoS(rclcpp::KeepAll).best_effort().transient_local();

(3) Durability

-values

TRANSIENT_LOCAL: Subscription()이 생성되기 전의 데이터도 보관 에만 적용 가능

VOLATILE: Subscription이 생선되기 전의 데이터는 무효

-RxO

example

srclcpp::QoS(rclcpp::KeepLast(depth)).reliable().durability_volatile();

rclcpp::QoS(rclcpp::KeepAll).best_effort().transient_local();

(4) Deadline

-values

deadline_duration: 정해진 주기 안에 데이터가 Pub/Sub 되지 않을 경우 EventCallback 실시

-RxO

-example

rclcpp::QoS(10).deadline(10ms);

$ ros2 run quality_of_service_demo_cpp deadline 600 --publish-for 5000 --pause-for 2000

(5) Lifespan

-values

lifespan_duration: 정해진 주기 안에서 Sub 되는 데이터만 유효 판정하고 그렇지 않은 데이터는 삭제

-example

rclcpp::QoS(10).reliable().transient_local().lifespan(10ms);

$ ros2 run quality_of_service_demo_cpp lifespan 1000 --publish-count 10 --subscribe-after 3000

$ ros2 run quality_of_service_demo_cpp lifespan 4000 --publish-count 10 --subscribe-after 3000

(6) Liveliness

-values

liveliness_duration: 정해진 주기 안에서 노드 혹은 토픽의 생사 확인

-RxO

is not yet supported

(7) QoS Policies in RMW

참고

Gurum DDS 소개자료 : https://github.com/jung-ha-jung/2020-01-30-GurumDDS-_-.git DDS의 표준 프로토콜인 RTPS 확인)

1) wireshark 설치 : $ sudo apt install wireshark

2) wireshark 실행 : $ sudo wireshark

3) ros2의 publisher, subscribe 샘플 예제 실행

4) wireshark에 캡쳐되는 RTPS 통신 데이터로 하기의 정보들을 확인할 수 있다.

- protocol version

- vendor id

- domain id

- QoS 상태

- ...

DDS QoS 실습 내용 )

로보티즈 example_ws 다운로드 / 빌드 / 실행을 확인한다.

1) 다운로드 : https://github.com/ROBOTIS-Platform/ros2_examples

2) ros2 workspace 생성한 후 소스코드 추가 예를들어 "robotis_ws/src/" 폴더 하위에 다운받은 파일의 압축을 해제한다.

3) ros2 workspace로 이동

$ cd ~/robotis_ws

4) 하기 실행으로 소스코드를 빌드

$ colcon build --symlink-install

5) Source the environment

$ . install/setup.bash

6) Publisher와 Subscribe 노드를 각각 실행하여 확인한다.

- publisher : $ ros2 run examples_rclcpp publisher

- subscribe : $ ros2 run examples_rclcpp subscriber

QoS 실습 예제 추가)

1) 다운로드 : https://github.com/jung-ha-jung/DDS-QoS-example.git

2) 로보티즈 example_ws 파일 대체 "robotis_ws/src/ros2_examples/examples_rclcpp/src/" 하위의 폴더 중 "publisher"와 "subscriber"를 대체함

4) 하기 실행으로 소스코드를 빌드

$ colcon build --symlink-install5) Source the environment

$ . install/setup.bash

6) 옵션번호를 변경하면서 실행하면 QoS 설정에 따른 데이터 전달을 확인할 수 있음

- publisher : $ ros2 run examples_rclcpp publisher -q ? (? : 옵션번호)

- subscribe : $ ros2 run examples_rclcpp subscriber -q ? (? : 옵션번호)

옵션번호)

printf("\t6 : Reliability - reliable\n");

printf("\t7 : Reliability - best_effort\n");

printf("\t8 : Durability - transient_local\n");

printf("\t9 : Durability - volatile\n");

printf("\t10: Durability - KeepAll - transient_local\n");

printf("\t11 : Deadline - 1000ms\n");

printf("\t12 : Deadline - 2000ms\n");

Last updated