URSIm with ROS package ur_robot_driver

I am trying to develop an application to control the UR using ROS. I am in the process of purchasing the manipulator but want to validate the functionality before I get an access to the hardware. To replicate the workflow I am using the following

  • URSim simulator for e series robot, running on Virtual Machine

  • Linux machine with Ubuntu 18.04, ROS melodic and ur_robot_driver ROS package

I have followed all the steps mentioned here to configure the simulator to connect with ROS driver. I am able to connect to the simulator via ROS, however soon after connecting to the simulator using ROS, the following error appears (continuously) on the terminal.

  • [ERROR] Could not get fresh data package from robot

And as the error suggest, there is not data coming from the simulator (I don’t see anything if I echo any of the ROS topics like /joint_states).

I referred few discussions in the forum regarding the similar error and it seems people have faced this error due to high latency between ROS computer and hardware, or due to heavy load on the ROS computer.

It will be really great if someone can provide a workaround which allows me to test the functionality I am developing using URSim and ROS. I can afford a bad / discontinuous movement of the robot as it is just for verification. I just need a workaround which prevents the communication drop between ROS and URSim.

I’ve seen this happening when developing with URSim from time to time, but not constantly. However, if this isn’t happening too much (if you only get one line of this and not a wall of those errors) the driver should be keeping the connection.

The error is persistent in my case. Basically, I am not receiving any data at ROS driver. I don’t get anything if I echo any of the topics.

Can you please share the system configuration / setup you used ? Like a VM for the simulator and a host computer with Ubuntu for ROS or you installed the linux version of URSim in the host computer itself ? Also did you modify any parameters like keepalive timeout etc in the files provided by UR ?

Hi @dparikh,

If it is due to performance issue you can try to modify starturcontrol.sh

#!/bin/bash
SCRIPT_DIR=$(dirname $(readlink -f $0))
HOME=$SCRIPT_DIR $SCRIPT_DIR/URControl -d 2000 -r &>$SCRIPT_DIR/URControl.log &

defualt value for -d|--sim-cycle-period Sets the cycle time used for simulation. is 2000us for the e-Series if you increase the number you will lower the load, but also slow down robot execution time/movement.

Hope it helps you for the verification.

1 Like

That’s a nice addition, thanks @ebbe! I am, however, unsure what kind of implications for the ROS driver follow by that. Without modifications, it expects to get data packages by the robot with 500Hz in case of an e-Series.

So, I would expect to get the [ERROR] Could not get fresh data package from robot always in that case. This is basically setup here inside the ur_client_library.

Thank you for the suggestions @mauch and @Ebbe. I am able to establish a reliable connection now by installing the Linux version of URSim in Ubuntu 18.04 and UR ROS drivers in the same Linux host computer. Hence, we can safely ascribe this issue to the use of VM.

However the install script for URSim is strange in a way that it actually removes lot of ROS packages from the Ubuntu. So I had to install the ROS and also redo the UR ROS driver installation process. I understand the JDK dependency but I am not able to completely understand a need to remove packages while installing a simulator.

It will be really great if UR can somehow improve the install script of the UR simulator so that it does not break the existing ROS installation.

Apologies for re-opening a closed discussion. Lately, I am facing lof of connection dropout issues and could not get fresh data from the robot errors.

  • From this thread I understood that running URSim and ROS drivers in VM causes these issues and I understand the limitations.

  • I verified that the URSim and ROS driver connection is very stable on a native Ubuntu 18.04.

  • However, due to the fact that the install script of the URSim wipes installed packages from Linux, I am still shooting for installing URSim and ROS on VM.

  • I tried many things including, launching URSim with highest priority using nice command, changing network type of VM, disabling the network adapter of the VM and using 127.0.0.1 IP for the URCap and ROS driver, and launching the URSim with higher loop time as suggested by Ebbe. However, nothing seems to solve the issue reliably. Even CB3 with 125hz fails very frequently.

  • Hence the main question : Is there any way to tell URSim and ROS driver both to run at a lower loop rate? From my initial investigation, it seems that we can force URSim to keep the connection by commenting line 132 in ros_control.urp which basically don’t do anything when there is no new data from ROS. However, the ROS driver still throws the error stating could not get new data from the robot and this stops the robot midway while executing a trajectory.

From my experience, I have a very high belif that these errors are mainly due to the loading of the network. When I try with the network adapter of VM switched off, there is a definite reduction of the frequency of data drop. However, since this is only a simulation workflow it will be really great if we have an option to sacrifice the performance over realiable connection.

It is currently not supported to reduce the control frequency, though we are working on it. If you want to run URSim in a dedicated environment, I would suggest having a look at the new docker image available

Thank you for your reply. I have managed to find the source of connection dropout errors. In summary, when running the URSim and ROS drivers in VM and also using the Remote Desktop Client, the TCP communication within the VM becomes unreliable. However, if I don’t use the Remote Desktop Client and operate the host locally, the connection remains stable. I am not entirely sure which resources are shared between Remote Desktop and VM which are causing this issue.

On an unrelated note - I did manage to setup the URSim and ROS dockers on the windows platform, however, it needs some modifications related to VNC server in the entrypoint script for URSim docker (Linux is fine). I can share them if needed. I have a feature request -

  • It would be really really great if you can add instructions to expose the ROS nodes of the ROS driver docker to the host. I know it is very challenging due to dynamic port allocation and the bridged mode of the network but it opens up many new possibilities.