mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-12 11:00:47 +02:00
Introduce UrException as exception base class
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <csignal>
|
||||
#include <ur_rtde_driver/ros/hardware_interface.h>
|
||||
#include <ur_rtde_driver/exceptions.h>
|
||||
|
||||
std::unique_ptr<ur_driver::HardwareInterface> g_hw_interface;
|
||||
|
||||
@@ -64,9 +65,17 @@ int main(int argc, char** argv)
|
||||
|
||||
g_hw_interface.reset(new ur_driver::HardwareInterface);
|
||||
|
||||
if (!g_hw_interface->init(nh, nh_priv))
|
||||
try
|
||||
{
|
||||
ROS_ERROR_STREAM("Could not correctly initialize robot. Exiting");
|
||||
if (!g_hw_interface->init(nh, nh_priv))
|
||||
{
|
||||
ROS_ERROR_STREAM("Could not correctly initialize robot. Exiting");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (ur_driver::UrException& e)
|
||||
{
|
||||
ROS_FATAL_STREAM("Could not correctly initialize robot: " << e.what());
|
||||
exit(1);
|
||||
}
|
||||
ROS_INFO_STREAM("initialized hw interface");
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "ur_rtde_driver/ur/ur_driver.h"
|
||||
#include "ur_rtde_driver/primary/package_header.h"
|
||||
#include "ur_rtde_driver/exceptions.h"
|
||||
#include <memory>
|
||||
|
||||
namespace ur_driver
|
||||
@@ -51,7 +52,7 @@ ur_driver::UrDriver::UrDriver(const std::string& robot_ip, const std::string& sc
|
||||
|
||||
if (!rtde_client_->init())
|
||||
{
|
||||
throw std::runtime_error("initialization went wrong"); // TODO: be less harsh
|
||||
throw UrException("Initialization of RTDE client went wrong.");
|
||||
}
|
||||
|
||||
rtde_frequency_ = rtde_client_->getMaxFrequency();
|
||||
|
||||
Reference in New Issue
Block a user