Skip to content

ROS_Environment

Junichi Tokuda edited this page Mar 20, 2019 · 16 revisions

Setting Up ROS Environment for Tutorial

Prerequisite

In this tutorial, we will use ROS Kinetic, which supports Wily (Ubuntu 15.10), Xenial (Ubuntu 16.04) and Jessie (Debian 8) for Debian. See Installation page for detail.

Installing ROS on Native Linux Machine

Please follow Installation page.

Then we install additional packages, including ROS-Industrial, MoveIt!, Universal Robot, and libvtk6-dev. From the terminal,

$ sudo rosdep update -y
$ sudo apt-get update -y
$ sudo apt-get dist-upgrade -y
$ sudo apt-get install -y ros-kinetic-industrial-core
$ sudo apt-get install -y ros-kinetic-universal-robot
$ sudo apt-get install -y ros-kinetic-moveit
$ sudo apt-get install libvtk6-dev

Installing ROS using Docker

Docker must be installed prior to the installation. To install the Docker image for the tutorial, open the terminal and run the following command:

$ docker pull docker pull rosmed/docker-ros-igtl
$ docker run -it --rm -p 6080:80 -p 28944:18944 rosmed/docker-ros-igtl

In this example, the HTTP port (port 80) and the OpenIGTLink port (port 18944) on the docker container are mapped to ports 6080 and 28944 on the host computer respectively. The '--rm' option will remove the container upon termination.

To access the desktop, open a web browser (compatible with HTML5) on the same computer, and type the following address in the address bar:

http://localhost:6080

If the Docker image container is successfully running, the browser should show the desktop screen.

This docker image includes all the software required for the tutorial. Please skip the following two steps ("Building OpenIGTLink" and "Installing ROS-IGTL-Bridge").

Building OpenIGTLink

ROS-IGTL-Bridge depends on the OpenIGTLink library. We install the source files of the libary under ~/igtl/OpenIGTLink and build files under ~/igtl/OpenIGTLink-build

$ cd ~
$ mkdir igtl
$ cd igtl
$ git clone https://github.com/openigtlink/OpenIGTLink.git
$ mkdir OpenIGTLink-build
$ cd OpenIGTLink-build
$ cmake -DBUILD_SHARED_LIBS:BOOL=ON ../OpenIGTLink
$ make

Installing ROS-IGTL-Bridge

First, set up catkin working directory (if it has not been set up):

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws
$ catkin_make
$ source devel/setup.bash

Then obtain the code from the github repository:

$ cd ~/catkin_ws/src
$ git clone https://github.com/openigtlink/ROS-IGTL-Bridge

To build the ROS-IGTL-Bridge, run

$ cd ~/catkin_ws/
$ catkin_make --cmake-args -DOpenIGTLink_DIR:PATH=<your OpenIGTLink directory>/OpenIGTLink-build

Testing ROS-IGTL-Bridge

To run the bridge, type:

$ roslaunch ros_igtl_bridge bridge.launch

If the bridge is set up, you can launch the test procedure for communication with [3D Slicer] (https://www.slicer.org/):

$ roslaunch ros_igtl_bridge test.launch  

It is possible to edit the launch files and set your IP & Port in the file. Run the node as server or client by adjusting the parameter RIB_type. Open the file and uncomment the lines:

$ <!--param name="RIB_server_ip" value="111.111.111.111" type="str"/-->
$ <!--param name="RIB_port" value="18944" type="int"/-->
$ <!--param name="RIB_type" value="client" type="str"/-->

The node can be run as server or client. If you executed the test procedure, the node will send a "ROS_IGTL_Test_Transform" with random translation, a random "ROS_IGTL_Test_Point", a random "ROS_IGTL_Test_Pointcloud" including 20 points, a "ROS_IGTL_Test_String" and a "ROS_IGTL_Test_PolyData", which is a rendered model of the 3D Slicer MRHead sample data. Any data received from 3D Slicer is published to a ROS topic by the bridge node and displayed by the test node.

After confirming that the bridge is working, stop the bridge and test nodes by pressing Ctrl-C on the terminals.

Clone this wiki locally