Skip to content

User_App_ROS_TransferURDFFromROS

Mehmet Emre Çakal edited this page Oct 11, 2024 · 4 revisions

2.2 Transfer a URDF from ROS to Unity

Note: This tutorial assumes that you have completed tutorial:

In Ubuntu VM

$\textcolor{red}{\textsf{Note:}}$ When a URDF is involved with ROS#, it means that the file_server(2) package is being used. Although the basic functionality of the package will be mentioned throughout the tutorials, you can optionally check the this page for more information about file_server.

ROS2 Humble
  • Notice that the file_server2 package comes bundled with two additional launch files that publish TurtleBot4 lite and standard. And of course they need the TurtleBot4 ROS Humble package installed (turtlebot4_bringup, specifically) to work. Again, we will only use R2D2; and TurtleBot4 files are included for convenience.
# Inside the root of your workspace folder (not /src)
colcon build
source install/local_setup.bash

# R2D2
ros2 launch file_server2 publish_description_r2d2.launch.py
# TB4 - Standard 
ros2 launch file_server2 publish_description_turtlebot4_standard.launch.py
# TB4 - Lite
ros2 launch file_server2 publish_description_turtlebot4_lite.launch.py

# file_server2/publish_description_<robot_name>.launch.py files combine:
# 1. ros_sharp_communication.launch.py (from file_server2)
# 2. <selected_robot>_description.launch
# 3. joint_state_publisher

Alternatively, for your convenience, you can follow the step two of our tutorial video on YouTube.

ROS1 Noetic

Run the following command to launch the publish_description_TurtleBot2.launch file previously downloaded in the TurtleBot Setup tutorial. This will start rosbridge_websocket and file_server and publish the necessary robot description and robot name parameters to be captured by Unity.

catkin_make
source devel/setup.bash
roslaunch file_server publish_description_turtlebot2.launch

In Unity

  • Go to RosBridgeClient > Transfer URDF from ROS...
  • The URDF tools in the ROS# Unity package do not use an additional ROS# Connector instance, but use the connector already present in the scene. If there is none, the button next to ROS Connector Status will turn red and be pressable. If you click on it, you can create an empty game object with a ROS Connector component. Don't forget to adjust your ROS Connector settings!

Note: If you are transferring large files, it is advised that you should increase the Seconds Timeout in your ROS Connector. Otherwise, it may disconnect without completing all the files.

  • In ROS2, parameters are handled as <node_name>:<parameter_name> and, in ROS1, just the parameter name is sufficient. You can select your ROS version from the ROS Connector and Reset to Default button will fill the input files according to your ROS version. You can also hover your mouse over them to get a syntax hint.
    TransferFromRosWindow

  • Initiate the transfer by clicking on the Read Robot Description button. Once all the files have been transferred, the following dialogue box will appear.
    URDF Assets imported
  • Click Yes. This leads to a creation of a GameObject in the scene
    Robot in Unity

© Siemens AG, 2017-2024

Clone this wiki locally