Unity 자체적으로는 ROS2 네트워크와 통신을 할 수 없기 때문에
아래의 유니티 공식 깃허브를 참고해서 ROS2와 통신을 해야한다.
https://github.com/Unity-Technologies/Unity-Robotics-Hub?tab=readme-ov-file
GitHub - Unity-Technologies/Unity-Robotics-Hub: Central repository for tools, tutorials, resources, and documentation for roboti
Central repository for tools, tutorials, resources, and documentation for robotics simulation in Unity. - Unity-Technologies/Unity-Robotics-Hub
github.com
근데 헷갈릴수도 있으니 대략적으로 정리해볼까한다.
유니티와 ROS2를 통합하기 위해서는 아래의 작업이 필요하다.
1. 유니티에서 ROS-TCP-Connector 설치
2. ROS2에서 Server Endpoint Node를 실행
1. 유니티 세팅
(아래의 링크를 참조하여 정리)
https://github.com/Unity-Technologies/Unity-Robotics-Hub/blob/main/tutorials/quick_setup.md
Unity-Robotics-Hub/tutorials/quick_setup.md at main · Unity-Technologies/Unity-Robotics-Hub
Central repository for tools, tutorials, resources, and documentation for robotics simulation in Unity. - Unity-Technologies/Unity-Robotics-Hub
github.com
먼저 유니티 패키지에 ROS-TCP-Connector를 설치해야한다.
상단 메뉴바에서 window → package manager
+ → add package from git URL …
아래의 URL 넣어서 패키지 설치
ROS-TCP-Connector가 정상 설치되면 상단에 Robotics 메뉴가 생김
Protocol을 ROS1 → ROS2로 변경
2. ROS2 세팅
유니티와 ROS2가 통신하기 위해서는 ROS2 네트워크와 통신할 수 있는 브릿지 노드(Server Endpoint)가 필요하다.
아래의 링크에서 ROS2 브랜치 소스 설치(~/robot_ws/src) 및 빌드
https://github.com/Unity-Technologies/ROS-TCP-Endpoint
colcon build --packages-select ros_tcp_endpoint
endpoint 노드 실행
ros2 launch ros_tcp_endpoint endpoint.py
이제 ROS2와 Unity가 정상적으로 통신할 수 있을 것이다
끝!
'Unity Robotics' 카테고리의 다른 글
[Unity] 3D model import 하는 방법 (0) | 2025.01.08 |
---|---|
[Unity] unityhub 로그인이 안될 때 (ubuntu 22.04) (0) | 2025.01.08 |
[Unity] vscode 연동(ubuntu 22.04) (0) | 2025.01.08 |
[Unity] URDF Importer를 사용하여 로봇 모델 생성 (1) | 2024.12.31 |
[Unity] Nav2 테스트 환경 구축 with turtlebot3 (1) | 2024.12.31 |