Skip to content

Instantly share code, notes, and snippets.

@Shawn-Armstrong
Last active April 21, 2024 10:51
Show Gist options
  • Save Shawn-Armstrong/2451cc2405b0577c4469c8b187e19ebb to your computer and use it in GitHub Desktop.
Save Shawn-Armstrong/2451cc2405b0577c4469c8b187e19ebb to your computer and use it in GitHub Desktop.

#UR_driver_setup.md

Overview

  • This file provides instructions for setting up the Robot Operating System 2 (ROS2) Universal Robots' (UR) driver in conjunction with a UR simulator using containers running on a Windows host machine.

Requirements

Setup

NOTE: The resolution for all image resources in this file can be enhanced by clicking on them.

  1. Create a docker network by opening a console and using the following command:

    docker network create --subnet=192.168.56.0/24 ursim_net
  2. Create container1 using the official UR simulator image by opening a console and using the following command:

    docker run -it -e ROBOT_MODEL=UR3e --net ursim_net --ip 192.168.56.101 -p 30002:30002 -p 30004:30004 -p 6080:6080 --name ur3e_container universalrobots/ursim_e-series
  3. Open Google Chrome, visit http://localhost:6080/vnc_auto.html then perform the following actions to turn the cobot on.

    turnon_cobot

  4. Create a Windows X server using VcXsrv's XLaunch with the following actions:

    create_x_server

  5. Identify your virtual ethernet adapter by opening a console on your Windows host machine and using the following command:

    ipconfig

    image

    • It'll typically look something like this.
  6. Create container2 using the community contributed ROS2 Humble Desktop image by opening a console and using the following command:

    docker run -it --name ros2_container --net ursim_net osrf/ros:humble-desktop
  7. Inside container2, execute the following commands to install the ROS2 UR driver and set necessary environment variables.

    apt-get update
    apt-get install sudo
    sudo apt-get install ros-humble-ur-robot-driver
    export DISPLAY=<YOUR_IP_ADDRESS_GOES_HERE>:2.0
    ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.56.101 launch_rviz:=true
    • Use the IP address from step5 in the export command.
  8. If everything was done successfully you should be able to observe the demo on your machine.

    Demo

    demo_ur_driver

    • A simple movej command was executed in PolyScope and the related data was sent to container2.

Summary

  • We used Docker to create a network with two containers; one running the UR simulator and the other running Ubuntu with ROS2 installed.
  • The Ubuntu container instantiates the ROS2 UR driver then makes a connection with the UR simulator.
  • The UR simulator sends messages containing cobot data to the Ubuntu container.
  • The driver running on the container receives the messages then converts them into a format that can be used internally by ROS2.
  • The converted messages are used to model the cobot inside ROS2's RViz.

Final Observations

  • According to collaborators in the UR driver repo the UR driver does not support Windows. This setup is intended to be used as an alternative work around for Windows users.
  • Docker containers are not designed for dealing with heavy graphical payloads; for this reason, rViz will likely have a noticeable delay running in the container. The more important aspect is that we can observe that the two systems are communicating properly.
@IrvingF7
Copy link

Hi Shawn!

Thanks for this write-up. It helped me tremendously. However, I encountered another problem after this.

After this, even when the robot model shows up in the rviz, I cannot play the remote control program on the VNC panel.
image

If it's on a real robot, I know how to set up the network to make this disappear, but on URSim, I am kinda clueless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment