챕터(4)에선 Unity 매니퓰레이터의 모션 경로를 MoveIt을 통해 계획 후 실행합니다.
* 이번 챕터 진행하기 전에 아래 페이지에서 Unity 매니퓰레이터 pick and place 튜토리얼 해보는 것을 추천합니다.
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. - GitHub - Unity-Technologies/Unity-Robotics-Hub: Central repository for tools, tutorials, re...
github.com
1. ROS 패키지 설치
Ubuntu에서 ROS-Unity 이번 챕터를 진행하기 위해 필요한 패키지를 설치합니다.
1. 'ur5e_moveit_config' 패키지를 설치합니다.
cd ~/unity_ws/src
git clone https://github.com/beomjoonlee/ur5e_moveit_config.git
2. 'ur5e_unity_moveit' 패키지를 설치합니다.
cd ~/unity_ws/src
git clone https://github.com/beomjoonlee/ur5e_unity_moveit.git
3. workspace를 build 합니다.
cd ~/unity_ws
catkin_make && source devel/setup.bash
2. Unity ROS 환경 셋업
1. 윈도우에도 'ur5e_unity_moveit' 패키지를 설치합니다.
2. 윈도우에 설치한 'ur5e_unity_moveit' 패키지 내 다음(https://github.com/beomjoonlee/ur5e_unity_moveit/tree/main/unity) 폴더들을 Unity project 폴더/Assets폴더에 넣어줍니다.

3. 필요한 msg와 srv를 빌드합니다.
'Robotics'에서 'Generate ROS Messages...' 클릭
-> 'ROS message path' 옆 'Browse' 클릭
-> 2.에서 설치한 'ur5e_unity_moveit' 패키지 폴더 선택
-> 'moveit_msgs'에서 'msg' 내 'RobotTrajectory.msg' 빌드


-> 'msg'와 'srv' 빌드

3. Unity 환경 셋업
1. 'Assets' 내 'Prefab'에 있는 모든 object들을 Scene에 추가합니다.

2. 'Publisher'에 'SourceDestinationPublisher' script와 'TrajectoryPlanner' script를 추가 후 각각의 항목에 해당되는 object들을 넣습니다.

3. 'TargetPlacement' object에 'TargetPlacement' script를 추가합니다.

4. 'Canvas' 내 'Button'에서 'On Click ()' 항목에 'Publisher'를 추가하고 'PublishJoint ()' 함수를 선택합니다.

4. Unity 매니퓰레이터 작동
1. Ubuntu 환경에서 MoveIt을 실행합니다.
roslaunch ur5e_unity_moveit unity_ur5e_mover.launch
2. Unity에서 시뮬레이션을 실행합니다.
3. 게임 화면 내 'Publish' 버튼을 클릭합니다.
4. 로봇이 'Target' object를 파지한 후 'TargetPlacement' 위치에 놓습니다.