UniversalRobots / Universal_Robots_Client_Library

A C++ library for accessing the UR interfaces that facilitate the use of UR robotic manipulators by external applications.
Apache License 2.0
117 stars 88 forks source link

Uninformative error when script file does not exist #142

Closed carebare47 closed 1 year ago

carebare47 commented 1 year ago

Hi all,

Due to a mismatch in versions between our configs and the Universal_Robots_ROS_Driver, we ended up passing a filename that didn't exist as the script_file name here which ends up here.

There is already a check that the parameter exists in the ROS driver, but if the parameter exists and points to an invalid file, the invalid file path gets passed down into this client library and throws weird errors:

basic_string::replace: __pos (which is 18446744073709551615) > this->size() (which is 0)
[ERROR](/sr_hand_robot): [1678106531.818786780] Initializing robot HW 'ra_sr_ur_robot_hw' failed
ERROR /tmp/binarydeb/ros-noetic-ur-client-library-1.3.1/src/rtde/rtde_client.cpp 537: Could not get response to RTDE communication pause request from robot 

Is there any reason not to add a check here that the file exists and is valid?

RobertWilbrandt commented 1 year ago

I don't see any reason to not add that, it seems like a straightforward improvement. I'd be happy to merge a pull request implementing this, otherwise i'll try to add this myself in the next weeks.

jeferal commented 1 year ago

Thank you. Are you working on adding this check at the moment?