> For the complete documentation index, see [llms.txt](https://help.movin3d.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.movin3d.com/kr/movin-studio-usage-guide/live-streaming/streaming-mocap-data-into-ros-by-osc.md).

# Streaming Mocap Data into ROS by OSC

[**ROS**](https://www.ros.org/)는 로봇 애플리케이션 개발을 위한 오픈소스 프레임워크로, 센서, 제어, 시각화 등을 하나의 구조에서 연결할 수 있습니다.

MOVIN TRACIN과 MOVIN Studio로 캡처한 모션 데이터는 ROS 2 환경에서 실시간 (또는 파일 기반) 으로 재생, 리타게팅되어, RViz2에서 로봇 모델 움직임을 확인하거나 로봇 제어 파이프라인에 연동해 활용할 수 있습니다.

### 사전 준비사항

ROS 연동을 위해서는 아래 환경이 필요합니다. 하단의 패키지들이 모두 설치되어 있는지 먼저 확인해주세요.

* **ROS 2**:&#x20;
  * Humble (tested)
* **필수 ROS 2 패키지**:
  * `robot_state_publisher`
  * `rviz2`
  * `xacro`
  * `tf2_ros`&#x20;
* **필수 pip 패키지**:
  * `numpy`
  * `scipy`
  * `movin-sdk-python` (BVH 파일 로딩 및 실시간 모드에 필요)

{% stepper %}
{% step %}

### Motion-Player-ROS를 다운로드해주세요.

```
cd ~/ros2_ws/src
git clone https://github.com/MOVIN3D/Motion-Player-ROS
```

* ROS 2 워크스페이스의 `src` 폴더로 이동한 뒤, [Motion-Player-ROS 레포지토리](https://github.com/MOVIN3D/Motion-Player-ROS)를 클론해주세요.
  {% endstep %}

{% step %}

### MOVIN SDK Python을 설치해주세요.

```
pip install git+https://github.com/MOVIN3D/MOVIN-SDK-Python.git
```

* 위 [#undefined](#undefined "mention")에 언급된 패키지들이 모두 설치되어 있는지 확인해주세요.
* BVH 파일 로딩 및 실시간 라이브 스트리밍을 위해 movin-sdk-python 패키지를 설치해주세요.
  * MOVIN-SDK-Python에 대해 더 알고 싶다면 [해당 링크](https://github.com/MOVIN3D/MOVIN-SDK-Python)를 참고해주세요.
    {% endstep %}

{% step %}

### 패키지를 빌드해주세요.

```
cd ~/ros2_ws
colcon build --packages-select motion_player
```

* 워크스페이스 루트로 이동한 뒤 `motion_player` 패키지를 빌드해주세요.
  {% endstep %}

{% step %}

### 빌드한 ROS 패키지를 터미널 세션에 등록해주세요.

```
source ~/ros2_ws/install/setup.bash
```

* 패키지를 빌드한 후, `install/setup.bash` 파일을 터미널 세션에 등록해주세요.
  * 해당 과정을 거쳐야 ROS에서 `motion_player` 패키지를 인식할 수 있습니다.
    {% endstep %}

{% step %}

### 실시간 모드를 실행해주세요.

```
ros2 launch motion_player realtime.launch.py
```

* MOVIN Studio에서 모션 데이터를 받기 위해 실시간 모드를 실행해주세요.
* 실시간 모드에서는 다음 기능을 사용할 수 있습니다
  * 실시간 리타게팅: MOVIN의 모션 데이터를 로봇 모델에 즉시 적용합니다.&#x20;
  * 실시간 시각화: RViz2에서 MOVIN의 모션 캡처 스켈레톤과 리타게팅된 로봇 모션을 동시에 확인할 수 있습니다.

```
ros2 launch motion_player realtime.launch.py port:=11235 human_height:=1.80 skeleton_offset_x:=1.5
```

* 필요에 따라 아래와 같이 커스텀 파라미터를 지정할 수 있습니다.&#x20;

<table><thead><tr><th width="175.76953125">인수 (Argument)</th><th width="169.12890625">기본값 (Default)</th><th>설명 (Description)</th></tr></thead><tbody><tr><td><code>port</code></td><td><code>11235</code></td><td>UDP port to listen for OSC mocap data</td></tr><tr><td><code>robot_type</code></td><td><code>unitree_g1</code></td><td>Target robot type (<code>unitree_g1</code> or <code>unitree_g1_with_hands</code>)</td></tr><tr><td><code>human_height</code></td><td><code>1.75</code></td><td>Human height in meters for scaling</td></tr><tr><td><code>skeleton_offset_x</code></td><td><code>1.0</code></td><td>X offset to place skeleton beside robot</td></tr><tr><td><code>urdf_file</code></td><td>(package default)</td><td>Path to custom URDF file</td></tr><tr><td><code>rviz_config</code></td><td>(package default)</td><td>Path to custom RViz config file</td></tr></tbody></table>

또한 --realtime 플래그를 사용해 직접 노드를 실행할 수도 있습니다.

```
ros2 run motion_player motion_player --realtime --ros-args -p port:=11235 -p human_height:=1.8
```

{% endstep %}

{% step %}

### MOVIN Studio에서 OSC 프로토콜 스트리밍을 시작해주세요.

<figure><img src="/files/Cb7Uc566KfaE1qrsENRm" alt=""><figcaption></figcaption></figure>

* ROS에서 설정한 포트 번호가 MOVIN Studio에 동일하게 작성되어 있는지 확인해주세요.
* MOVIN Studio에서 OSC 프로토콜 스트리밍을 시작해주세요.
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.movin3d.com/kr/movin-studio-usage-guide/live-streaming/streaming-mocap-data-into-ros-by-osc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
