⌚ Time to complete: 3 min

Planned outcomes

You will have a service running on ROS side, which will allow you to communicate with ROS server from your Unity machine.

Prerequisites

Before you proceed, make sure that you have:

  1. installed ROS Noetic (How to install ROS Noetic)
  2. configured a ROS workspace (How to set up a ROS workspace)

Steps

  1. Go to the src folder of your ROS workspace:

    WORKSPACE_NAME="ws_unity_x_ros"
    ROS_WS_PATH=~/ros/${WORKSPACE_NAME}
    
    cd ${ROS_WS_PATH}/src
    
  2. Clone Unity ROS TCP Endpoint repository:

    git clone <https://github.com/Unity-Technologies/ROS-TCP-Endpoint>
    
  3. Rebuild and source your catkin workspace:

    cd ${ROS_WS_PATH}
    catkin build
    
    source ${ROS_WS_PATH}/devel/setup.zsh
    
  4. To launch the endpoint, use the endpoint.launch file located in the launch folder inside the cloned repository:

    roslaunch ros_tcp_endpoint endpoint.launch
    

    This will launch the endpoint server at 0.0.0.0:1000 on your the ROS machine. You can connect to it from Unity as described in ⚠How to connect robot in Unity to Robot Control Server.

    <aside> 💡 This will launch the endpoint server at 0.0.0.0:1000 on your the ROS machine. You can change the default IP and port by supplying tcp_ip and tcp_port parameters to the launch file, e.g.: roslaunch endpoint.launch tcp_ip:="127.0.0.1" tcp_port:="424242"

    </aside>

  5. Done! 🎉

Notes

https://github.com/Unity-Technologies/ROS-TCP-Endpoint