Universal Robots+

Running ursim in Windows SubSystem for Linux

After some trial and error I figured out how to get ursim to run on Windows 10. I thought I would share the instructions I typed up in case it helps someone else out in the future. I have only tested this on one machine so far so your mileage may vary…

Install the Windows Subsystem for Linux

In my case I had to manually install the Ubuntu 16.04 distro because the windows store was not working on my pc which appears to be a common issue. I originally tried using Ubuntu 18 but it failed. Just for clarity, I determined which Ubuntu version to use by downloading the entire starter package, running the virtual machine in VMWare player and at the bash prompt I used the command:

‘lsb_release -a’

I discovered that the VM image was using Ubuntu 16.04. I have a hunch that the URControl binary file was compiled using the gcc version common for the 16.04 release. Therefore, to make things compatible you will also want to use 16.04. However, in the future when the URSim is updated, you may have be required to upgrade to a newer version. You can always check which version to use by running the command above. Hopefully by that time someone at universal robots will read my crazy instructions and officially support running ursim on windows. :smiley:

To manually install, I downloaded the appx file for 16.04, rename the file extension to zip. Extract it to a temp folder using 7-Zip or another tool of your choice. Then open and administrative command prompt and run ubuntu.exe. It will take a few minutes to install.

To make things easy, during the install you should assign the default username to “ur” and use the password “easybot”. This will create your home directory so it matches the folder structure in the VMWare image provided by UR. If you choose a different username then you can still use the linux adduser command to create the “ur” user. However, when you compile with maven or run the simulator you will probably want to use the “su ur” command to login to the “ur” account.

Install Xming Server for Windows


After install finished run the program, it will run minimized in your system tray

Upgrade Ubuntu packages

Open a command prompt, then type bash. You should now be running your Ubuntu distro. Now enter the following commands to apply the updates to your Ubuntu install. This will probably take a few minutes because there are a lot of packages to update.

sudo apt update
sudo apt upgrade

Manually Install Required Packages

Download URSim 5.2: URSim. Using 7-zip or another extraction tool of your choice, decompress the files into the /home/ur/ursim directory. Using your bash prompt run the install.sh using the following command.
./install.sh

In my case, the install script returned a few errors and ultimately failed, but not before it installed quite a few dependencies such as java. To finish the install process you will now need to run these additional commands:

sudo apt install lib32gcc1 lib32stdc++6 libc6-i386
sudo apt install libcurl3 libjava3d-* ttf-dejavu* fonts-ipafont fonts-baekmuk fonts-nanum fonts-arphic-uming fonts-arphic-ukai
cd ursim-dependencies
sudo dpkg -i curl-dev-ur_7.18.2-1_amd64.deb
sudo dpkg -i libxmlrpc-c-ur_1.33.14_amd64.deb
sudo dpkg -i libxmlrpc-c-dev-ur_1.33.14_amd64.deb

Install QEMU BinFormat Support

The URControl binary executable does not run by default in WSL. In order to make it work you have to install QEMU Binary Format Support. Thankfully someone else figured this out because I never would have found this one on my own:

https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520

sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'

You will need to reactivate binfmt support every time you start WSL. To simplify this process, I created a .bashrc file in the ur home directory so this happens automatically everytime I login. I also export the DISPLAY variable so my screen is pushed to the Xming window.

sudo service binfmt-support start
export DISPLAY=:0

To start the simulator, navigate to the ~/ursim folder and run the command
./start-ursim

If all goes well, the Xming window should appear.

URCap Development

I use Visual Studio Code with the Maven for Java extension to develop the UR Caps.

If you open a terminal in VS Code, you can access the command prompt and type “bash” to enter your Ubuntu shell. I installed maven 3 using “sudo apt install maven” and I copied the .m2 folder in the UR home directory from the Starter kit. The .m2 folder contains the jar files required for the UR api.

You will need a copy of the sdk folder from the VMWare image in the ur home directory. Run the install.sh script from this folder.

To compile your code use the bash prompt in the terminal window and type “mvn install -P ursim”. To run the simulator type “~/ursim/ursim-5.2.0.61336/start-ursim.sh”.

13 Likes

@michael_ceranski

Thank you for a great write-up of your steps taken, to achieve this.

Perhaps some of the steps listed here, can resolve your “Manually Install Required Packages” steps in a better way?
How to install URSim for URCaps Development

As an alternative, it would also be possible to use WSL to only build and deploy the URCap from Windows, deploying to a URSim in a VM (using the ursimvm deployment method). In this way, you could use your favorite IDE directly in Windows, but execute URSim in virtual Linux.

1 Like

I added some instructions on how I use Visual Studio Code to do URCap development and compilation. At this point, I have completely eliminated the need for VMWare Player on my computer.

For me personally, I have a much better user experience running everything on windows 10 and I use less overhead on my workstation by running things without the overhead of the complete Linux operating system. I feel more productive this way and I hope this post will help others!

3 Likes

Thank you Michael!

Visual Studio Code (VS Code) has been a huge time and resource saver for me. No more running a resource hog virtual machine. Awesome!

Some issues I ran into…

pom.xml file changes needed due to differnece in PC and Linux.

  • Specifically installing PuTTY and using “pscp” commands with “-Premote” to send the URCap to the robot.
  • “copy-rename-maven-plugin” to rename output .jar to “.urcap”

There is even a URScrip extension available: URScript

I was not able to get the simulator fully working but its less useful for me without actual hardware interaction. I don’t believe you can even remote debug with breakpoints with the simulator (or robot) anyway? Not very useful. However, I can run my Daemon either in VS code OR the robot. VS code allows full debugging of it.

Good stuff :slight_smile:

1 Like

This was spot on.

For me I found Xming was causing some sort of issue that led to URSim crashing so I used VcXSrv instead and has been much more stable so far.

I’ve also managed to link IntellilJ to it by altering the pom.xml so that the URCAP builds straight into the WSL based URSIM.
I made a new profile just for ease of use

Apoliges - a few <>'s missing from the xml below as the post is removing them but hopefully you can get the jist.

executable>pscp</executable
commandlineArgs>
-pw {ursimvm.install.password} -P {ursimvm.install.host.port} target\{project.build.finalName}.jar {ursimvm.install.username}@{ursimvm.install.host}:{WSLursim.home}/.urcaps/${urcap.symbolicname}.jar
</commandlineArgs

Due to some permission issues I found the best way to get this to work was to setup ssh on WSL and alter the setup to run on port 2200 instead of 22. This means you can ssh into the WSL via 2200 and the localhost ip (127.0.0.1)
Used commands here
https://www.illuminiastudios.com/dev-diaries/ssh-on-windows-subsystem-for-linux/

This is a really nice setup - if only there was a way to hook in a debugger as well!!

Massive thanks to Micheal the OP. I’m really happy with this setup.

3 Likes

@michael_ceranski
Hi Michael, I have a weird error during installation:

./install.sh
Checking java version
/usr/bin/java
version 11.0.7
java version accepted
Error getting authority: Error initializing authority: Could not connect: No such file or directory

any idea on how to avoid this or have you also had this error?
Thanks!
Selen

This is the error that Micheal mentions in the original post.

At this point you should have already managed to install Java and a few other dependencies.
Run the other commands listed in the Original Post should get you to a stage where ursim will run.

Has anyone managed to get a daemon running on this setup.

I’ve been trying but with no luck so far.

Thank you Michael and everyone for posting a comprehensive guide. I’d just like to add my experience with the latest version UR Software version (URSim_Linux-5.8.2.10297.tar.gz), Ubuntu 20.04 LTS, VcXsrv (1.20.8.1), and wsl 2.

N.B. If you follow Michael’s instructions, I found that in WSL 2 20.04 LTS from Microsft Store (MS Kernel) apt would not resolve libjava3d-* However `apt-get’ would.
The manual steps for installing the required packages were necessary due to the use of pkexec in the install script where the test for a 32 bit system / 64 bit system is coded. AFAIK it does work when running a VM (vmplayer.exe and 20.04 LTS) didn’t need pkexec removing from install.sh

Running URSoftware 5.8.2 with WSL 2 on Ubuntu 20.04 LTS

I have Windows 10 Pro (20H2) with WSL updated to WSL 2. I have tried to do the minimum to the system in order to run URSim.
After configuring WSL 2, following this document:

h t t p s://docs.microsoft.com/en-us/windows/wsl/install-win10 (2 link limit for noobs)

I installed Ubuntu 20.04 LTS from the Microsoft Store. I also installed Windows Terminal for convenience. Once installed and configured I updated and upgraded with sudo apt update, sudo apt upgrade.

Changes to Ubuntu install

Modify .bashrc

append the following to the end of your ~/.bashrc (https://github.com/microsoft/WSL/issues/4106)

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 export LIBGL_ALWAYS_INDIRECT=0

N.B. Test LBGL_ALWAYS_INDIRECT=1 and X server config to find which works (best) for you. In VcXsrv Launch I have this config (note display set to 0, multiple windows and start no client) :
image

Add extra x11 packages

I installed the following:

sudo apt install x11-apps mesa-utils

The former was to get all the x11 related stuff and in particular xeyes to test that the X server was working, and the latter to get glxgears to check my framerate with openGL.

Download tar.gz file, extract to home and modify install.sh

Following information from Scazlab’s guide (https://scazlab.github.io/ur5e_setup_guide.html), I changed the default-jre install to openjdk-8-jre and libcurl3 to libcurl4. I also added the package lib32z1 (just in case). I also removed reference to pkexec and modified the bash strings to use sudo. These are the main changes I made to install.sh:

echo "installing limb32z1"
sudo apt-get -y install lib32z1

# sudo apt-get -y install default-jre
sudo apt-get -y install openjdk-8-jre

# pkexec bash -c "apt-get -y install lib32gcc1 lib32stdc++6 libc6-i386 $commonDependencies && (echo '$packages' | xargs dpkg -i --force-overwrite)" 88 bash -c "sudo apt-get -y install lib32gcc1 lib32stdc++6 libc6-i386 $commonDependencies && (echo '$packages' | xargs sudo dpkg -i --force-overwrite)"

Note the install script still fails when it tries to create the desktop icons but that’s okay.

Issues

Software runs UR5e from start-ursim.sh and seems to work okay with motion and installation (haven’t checked program yet) however I have some warnings and errors:

`/tmp/9fc07c93-6b83-4a7d-96e8-32ebf5412c47.sh: line 1: /sbin/net-statistics: No such file or directory
13:25:49.103 WARN - Could not understand the output from ‘net-statistics’ in ‘/sbin’ {thread: AWT-EventQueue-0 , loggerClass: com.ur.polyscope.system.impl.network.internal.ExternalControllerAdministrator}
13:25:49.103 WARN - Skipping entry: {thread: AWT-EventQueue-0 , loggerClass: com.ur.polyscope.system.impl.network.internal.ExternalControllerAdministrator}
13:55:32.778 ERROR - RobotState messages are queued up: 3 {thread: RobotState - PostMan , loggerClass: com.ur.monitor.RobotState$PostMan}
13:55:42.051 ERROR - RobotState messages are queued up: 3 {thread: RobotState - PostMan , loggerClass: com.ur.monitor.RobotState$PostMan}

Can these be ignored or are there any further packages I should install. (I would normally install the meta-package build-essential but haven’t so far)

Thanks, :slight_smile:

Hi All - I come back to this thread as I know you guys are as I am using WSL for their URSIM setup.

Has anyone had issues with return values on script commands? Specifically I have been using socket commands.

I’m concerned it may be related to the WSL setup - I was wondering if you may have seen the same behavior.

Simplest example is when checking the return value of socket_open.