The URDF files for Universal Robots (UR20/UR30) can be generated using the below steps and use them in MATLAB as follows:
1. Download the ROS VM shipped by MathWorks from:
2. The Universal Robots package is already present in the same VM at:
/home/user/catkin_ws/src/Universal_Robots_ROS2_Description-rolling
3. To generate URDF from Xacro, open a terminal and enter the following commands:
$ cd /home/user/catkin_ws/src/Universal_Robots_ROS2_Description-rolling/urdf/
$ source /opt/ros/noetic/setup.bash
$ ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/catkin_ws/src/Universal_Robots_ROS2_Description-rolling
$ echo $ROS_PACKAGE_PATH
$ xacro ur.urdf.xacro name:=ur20 ur_type:=ur20 > ur20.urdf
$ xacro ur.urdf.xacro name:=ur30 ur_type:=ur30 > ur30.urdf
These commands generate the URDF files in the Universal_Robots_ROS2_Description folder.
4. If MATLAB is on another machine, copy the `Universal_Robots_ROS2_Description-rolling` folder along with the `urdf` and `meshes` folders.
5. Use `importrobot` in MATLAB to load the robot model.
This step can be repeated for the required Cobot model.
