diff --git a/include/ur_client_library/ur/ur_driver.h b/include/ur_client_library/ur/ur_driver.h index d064c8128..e0c334f22 100644 --- a/include/ur_client_library/ur/ur_driver.h +++ b/include/ur_client_library/ur/ur_driver.h @@ -435,7 +435,7 @@ class UrDriver init(config); } - virtual ~UrDriver() = default; + ~UrDriver(); /*! * \brief Access function to receive the latest data package sent from the robot through RTDE diff --git a/src/ur/ur_driver.cpp b/src/ur/ur_driver.cpp index e61082293..47705b3fa 100644 --- a/src/ur/ur_driver.cpp +++ b/src/ur/ur_driver.cpp @@ -52,6 +52,12 @@ static const std::string SCRIPT_COMMAND_PORT_REPLACE("{{SCRIPT_COMMAND_SERVER_PO static const std::string FORCE_MODE_SET_DAMPING_REPLACE("{{FORCE_MODE_SET_DAMPING_REPLACE}}"); static const std::string FORCE_MODE_SET_GAIN_SCALING_REPLACE("{{FORCE_MODE_SET_GAIN_SCALING_REPLACE}}"); +UrDriver::~UrDriver() +{ + // This will return false if the external control script is not running. + stopControl(); +} + void UrDriver::init(const UrDriverConfiguration& config) { robot_ip_ = config.robot_ip;