[Documentation] [TitleIndex] [WordIndex

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

WinRos Master and Virtual Ubuntu

Description: How to link a windows host running a winros master with nodes running on a virtualbox ubuntu.

Keywords: winros

Tutorial Level: ADVANCED

Overview

These instructions will create an Ubuntu VirtualBox on Windows, and will allow the win_ros listener/talker example programs to communicate with ROS nodes running on the Ubuntu VB.

Preparation

  1. Follow all the instructions to install win_ros on your windows machine and check that the listener/talker example is working.

    • If you get "error code 2" when running roscore, it's because Python is not in your path. I added it into my setup.bat.
  2. Follow all the instructions to install VirtualBox.

  3. Download your desired version of the Ubuntu iso.

  4. Create an Ubuntu VirtualBox by following these directions

  5. Once you successfully boot into your Ubuntu VirtualBox, follow all the instructions to install ROS onto it, and make sure that it can run properly by running through some simple tests or the first few tutorials.

Networking

Now comes the tricky bit - interfacing the guest and host. You must modify your VirtualBox network adapter to make your Ubuntu VirtualBox visible to the Windows host.

If the above step fails, change the network adapter back to "NAT" and follow the following steps:

  1. Shut down your Ubuntu VirtualBox.

  2. In the VirtualBox Manager, select the Ubuntu VirutalBox, then go to Settings->Network->Adapter 2. Enable this second Adapter, make it a "Host-only Adapter", and save the changes.

    • You need the NAT adapter to supply internet connection to the Ubuntu VirtualBox. You need the Host-Only adapter to allow the Ubuntu VirtualBox and Windows host to see each other.

  3. Open a command window in Windows and run ipconfig. You should have a "VirtualBox Host-Only Network" adapter. Note the IP Address.

  4. Start your Ubuntu VirtualBox again. When it loads, go to System Setting->Network. You should have two wired connections. Find the one that has an IP address where the first three numbers are the same as the VirtualBox Host-Only Network IP address on your Windows host. This is your "Host-Only" network connection.

  5. Click Options and go to the IPv4 tab. Make this connection have a static IP address by choosing Method:Manual and plugging in the Address, Netmask, and Gateway that's currently being displayed in the Network Settings window.

  6. Save your changes, write down the IP address for later and close out of there.
  7. Modify the Ubuntu hosts file (/etc/hosts). Add the Host-Only IP Address and computer name of your windows host to the list. (You might have to open the file with admin privileges to actually change it).
  8. Modify the Windows hosts file (It's at C:\Windows\System32\drivers\etc\hosts on Vista). Add the Host-Only IP Address and computer name of your Ubuntu VirtualBox. (You might have to open the file with admin privileges to actually change it).

  9. Verify your setup: try to ping your VirtualBox from windows and your windows host from Ubuntu. Make sure that the ipadress associated with the pinging is the right one for the Host-Only network.

Verification

Now for the final verification: Getting nodes on the separate machines to communicate.

  1. Start up roscore on your windows machine.
    • It is theoretically possible to start roscore on the Ubuntu VirtualBox, but initial trials of this failed with strange errors, and since some diagnostics (like rosnode) have not yet been fully ported into win_ros, it is currently easier to just run roscore on Windows.

  2. In another command window, start up the example talker win_ros example project.

roslaunch msvc_runtime talker.launch
  1. In Ubuntu, change the ROS_MASTER_URI variable to your windows Host. This URI should be the same one that the windows roscore is connected to (if your windows host says "localhost", use the network name of Windows in it's place in Ubuntu).

export ROS_MASTER_URI=<Windows_Roscore_URI>
  1. In Ubuntu, listen to the chatter topic.

rostopic echo /chatter
  1. You should get "hello world" printed over and over in the Ubuntu terminal.
    • You can run a similar verification for talking on Ubuntu and listening on Windows.

Once you have this in place, you should be able to talk/listen on any topic you want from your windows project and see an associated package that is running in Ubuntu respond.

This has yet to be tested for complicated scenarios or for service/client connections. If there is something missing from this or a step doesn't work, please contact the winros google group for more help.


2019-10-12 13:17