⌚ Time to complete: 1 hr (or less for every repeated configuration)

Planned outcomes

You will have a MoveIt configuration package for the robot model that you select, which will also support control using ROS-Industrial (ROS-I) driver. This will allow you to connect and control the robot in Unity.

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)
  3. installed MoveIt and ROS-Industrial core (How to install MoveIt and ROS-Industrial core)

Steps

Part 1: Prepare the robot model

  1. Decide on the robot model for which the configuration will be created.

    <aside> 💡 For example, Motoman GP8.

    </aside>

  2. Download ROS-Industrial package for your robot model into your ROS workspace’s src folder.

    <aside> ℹ️ These packages are distributed by the robot manufacturers through GitHub repositories (for example, here is a Motoman ROS-I repository). All these repos can be found in GitHub ROS-I organization page.

    </aside>

    For example, to add Motoman ROS-I packages to your workspace, run the following:

    ROS_WS_PATH=~/ros/ws_unity_x_ros
    
    # Change to the root of the Catkin workspace
    cd ${ROS_WS_PATH}/
    
    # Retrieve the latest development version of Motoman packagescatkin build
    GIT_BRANCH="kinetic-devel"
    GIT_REPO="<https://github.com/ros-industrial/motoman.git>"
    ROBOT_VENDOR_NAME="motoman"
    git clone -b ${GIT_BRANCH} ${GIT_REPO} src/${ROBOT_VENDOR_NAME}
    
    # Check build dependencies
    rosdep update -y
    
    # Install dependencies for your current ROS version
    rosdep install -y --from-paths src/ --ignore-src --rosdistro ${ROS_DISTRO}
    
    # Build the workspace (using catkin_tools)
    catkin build
    
  3. Locate the URDF/XACRO file for your robot model.

    <aside> ℹ️ Every ROS-I support repository keeps robot models into separate folders named as <ROBOT_MODEL>_support/urdf. These support packages contain the XACRO models. For example, if you are looking for Motoman GP8 model file, it will be located in motoman/motoman_gp8_support/urdf/gp8.xacro

    </aside>

    <aside> 💡 If there are two XACRO files, the version without _macro in the name is used for creating the MoveIt package.

    </aside>

  4. Part 1 is done! 🎉

Part 2: Generate the configuration package

  1. Use MoveIt Setup Assistant to create a configuration package for your robot.

    <aside> ℹ️ The given steps are a concise version of this tutorial from ROS wiki.

    </aside>

    1. Launch MoveIt Setup Assistant:

      roslaunch moveit_setup_assistant setup_assistant.launch
      
    2. In the window that opened, select “Create New MoveIt Configuration Package”.

      moveit_setup_assistant-urdf_path.png

    3. In the Start tab, select the robot’s URDF/XACRO file that you located in the previous step.

    4. In the Self-Collisions tab:

      • Set Sampling Density slider to the maximum value (100k)

      • Click on “Generate Collision Matrix” and wait for it to complete

        moveit_setup_assistant-collision_matrix.png

    5. In the Virtual Joints tab, add a virtual joint with the following settings:

      Name base_to_world
      Child base_link
      Parent world
      Type fixed
    6. In the Planning Groups tab:

      • Add a group with the following settings:

        Name manipulator
        Kinematic Solver TRAC_IKKinematicsPlugin

        <aside> ℹ️ You can learn more about TRAC-IK Kinematics Solver here and in its official repo.

        </aside>

      • Inside the group, add a kinematics chain (click “Add Kin. Chain”) with the following settings:

        Base Link base_link
        Tip Link tool0
      • Leave other settings at their defaults and save.

    7. In the Author Information tab, fill in your name and email.

      Yevhen Bondarenko
      
      [email protected]
      
    8. In the Configuration Files tab:

      • In the Configuration Package Save Path, put in the path to the output package in the form <robot_name>_moveit_config.

        <aside> 💡 For example, if your ROS workspace is located in /home/USER/ros/ws_unity_x_ros/ and your robot is named Motoman GP8, then your output package path must be: /home/USER/ros/ws_unity_x_ros/src/motoman_gp8_moveit_config/.

        </aside>

        <aside> 💡 It is recommended to save the path somewhere for yourself so that you can paste it in again when you are regenerating the package (you will be doing it quite often when integrating robot with Unity).

        </aside>

      • Click “Generate Package” and agree to the prompts. The package will be generated in the indicated output directory.

  2. Rebuild and source your ROS workspace:

    cd ${ROS_WS_PATH}
    catkin build
    
    source ${ROS_WS_PATH}/devel/setup.zsh
    
  3. Test the generated configuration package by running the generated demo.launch file:

    ROBOT_NAME="motoman_gp8"
    
    ROBOT_MOVEIT_CONFIG_PATH="${ROS_WS_PATH}/src/${ROBOT_NAME}_moveit_config"
    
    roslaunch ${ROBOT_MOVEIT_CONFIG_PATH}/launch/demo.launch
    

    <aside> ℹ️ If everything was done correctly, this command should result in an Rviz window displaying your robot model.

    </aside>

  4. Part 2 is done! 🎉