您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

6.1 KiB

Pick-and-Place Tutorial: Part 0

This part provides two options for setting up your ROS workspace: using Docker, or manually setting up a catkin workspace.

Table of Contents


If you have not already cloned this project to your local machine, do so now:

git clone --recurse-submodules https://github.com/Unity-Technologies/Unity-Robotics-Hub.git

Option A: Use Docker

The Docker-related files (Dockerfile, setup scripts) are located in the docker/ directory.

  1. Follow the steps to install Docker Engine for your platform if it is not already installed.

  2. Start the Docker daemon.

    Note: The system-independent docker info command can verify whether or not Docker is running. This command will throw a Server: ERROR if the Docker daemon is not currently running, and will print the appropriate system-wide information otherwise.

  3. Build the provided ROS Docker image:

    cd /PATH/TO/Unity-Robotics-Hub/tutorials/pick_and_place &&
    git submodule update --init --recursive &&
    docker build -t unity-robotics:pick-and-place -f docker/Dockerfile .
    

    Note: The provided Dockerfile uses the ROS Melodic base Image. Building the image will install the necessary packages, copy the provided ROS packages and submodules to the container, and build the catkin workspace.

  4. Start the newly built Docker container:

    docker run -it --rm -p 10000:10000 -p 5005:5005 unity-robotics:pick-and-place /bin/bash
    

    When this is complete, it will print: Successfully tagged unity-robotics:pick-and-place. This console should open into a bash shell at the ROS workspace root, e.g. root@8d88ed579657:/catkin_ws#.

The ROS workspace is now ready to accept commands!


Option B: Manual Setup

  1. Navigate to the /PATH/TO/Unity-Robotics-Hub/tutorials/pick_and_place/ROS directory of this downloaded repo.

    • This directory will be used as the ROS catkin workspace.
    • If you cloned the project and forgot to use --recurse-submodules, or if any submodule in this directory doesn't have content, you can run the command git submodule update --init --recursive to download packages for Git submodules.
    • Copy or download this directory to your ROS operating system if you are doing ROS operations in another machine, VM, or container.

    Note: This contains the ROS packages for the pick-and-place task, including ROS TCP Endpoint, Niryo One ROS stack, MoveIt Msgs, niryo_moveit, and niryo_one_urdf.

  2. The provided files require the following packages to be installed. ROS Melodic users should run the following commands if the packages are not already present:

    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install python-pip ros-melodic-robot-state-publisher ros-melodic-moveit ros-melodic-rosbridge-suite ros-melodic-joy ros-melodic-ros-control ros-melodic-ros-controllers ros-melodic-tf2-web-republisher
    sudo -H pip install rospkg jsonpickle
    

    ROS Noetic users should run:

    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install python3-pip ros-noetic-robot-state-publisher ros-noetic-moveit ros-noetic-rosbridge-suite ros-noetic-joy ros-noetic-ros-control ros-noetic-ros-controllers
    sudo -H pip3 install rospkg jsonpickle
    
  3. If you have not already built and sourced the ROS workspace since importing the new ROS packages, navigate to your ROS workplace, and run catkin_make && source devel/setup.bash. Ensure there are no errors.

  4. The ROS parameters will need to be set to your configuration in order to allow the server endpoint to fetch values for the TCP connection, stored in src/niryo_moveit/config/params.yaml. From your ROS workspace, assign the ROS IP in this yaml file:

    echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml
    

    Note: You can also manually assign this value by navigating to the params.yaml file and opening it for editing.

    ROS_IP: <your ROS IP>
    

    e.g.

    ROS_IP: 192.168.50.149
    
  5. (Optional) By default, the server_endpoint will listen on port 10000, but this is also controlled by a parameter. If you need to change it, you can run the command rosparam set ROS_TCP_PORT 10000, replacing 10000 with the desired port number.

The ROS workspace is now ready to accept commands!


Troubleshooting

  • Building the Docker image may throw an Could not find a package configuration file provided by... exception if one or more of the directories in ROS/ appears empty. Try downloading the submodules again via git submodule update --init --recursive.

  • ...failed because unknown error handler name 'rosmsg' This is due to a bug in an outdated package version. Try running sudo apt-get update && sudo apt-get upgrade to upgrade packages.

  • If the ROS TCP handshake fails (e.g. ROS-Unity server listening... printed on the Unity side but no ROS-Unity Handshake received on the ROS side), the ROS IP may not have been set correctly in the params.yaml file. Try running echo "ROS_IP: $(hostname -I)" > src/niryo_moveit/config/params.yaml in a terminal from your ROS workspace.


Resources


Proceed to Part 1.