Skip to content

Commit a6fe13d

Browse files
authored
Merge pull request #60 from MGBla/fb_dashboard_client_fix
Dashboard client fixes
2 parents 4df673d + ef9fd61 commit a6fe13d

File tree

5 files changed

+310
-185
lines changed

5 files changed

+310
-185
lines changed

ur_robot_driver/include/ur_robot_driver/dashboard_client_ros.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
* \author Felix Exner [email protected]
2323
* \date 2019-10-21
24+
* \author Marvin Große Besselmann [email protected]
25+
* \date 2021-03-22
2426
*
2527
*/
2628
//----------------------------------------------------------------------
@@ -36,6 +38,7 @@
3638

3739
// UR client library
3840
#include <ur_client_library/ur/dashboard_client.h>
41+
#include <ur_client_library/exceptions.h>
3942
#include <ur_dashboard_msgs/msg/program_state.hpp>
4043
#include <ur_dashboard_msgs/srv/add_to_log.hpp>
4144
#include <ur_dashboard_msgs/srv/get_loaded_program.hpp>
@@ -74,12 +77,20 @@ class DashboardClientROS
7477
const std::string& expected)
7578
{
7679
rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr service = node_->create_service<std_srvs::srv::Trigger>(
77-
"topic", [&, command, expected](const std::shared_ptr<std_srvs::srv::Trigger::Request> req,
78-
const std::shared_ptr<std_srvs::srv::Trigger::Response> resp) {
79-
resp->message = this->client_.sendAndReceive(command);
80-
resp->success = std::regex_match(resp->message, std::regex(expected));
80+
topic, [&, command, expected](const std::shared_ptr<std_srvs::srv::Trigger::Request> req,
81+
const std::shared_ptr<std_srvs::srv::Trigger::Response> resp) {
82+
try
83+
{
84+
resp->message = this->client_.sendAndReceive(command);
85+
resp->success = std::regex_match(resp->message, std::regex(expected));
86+
}
87+
catch (const urcl::UrException& e)
88+
{
89+
RCLCPP_ERROR(rclcpp::get_logger("Dashboard_Client"), "Service Call failed: '%s'", e.what());
90+
resp->message = e.what();
91+
resp->success = false;
92+
}
8193
});
82-
8394
return service;
8495
}
8596

ur_robot_driver/include/ur_robot_driver/hardware_interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*
2222
* \author Lovro Ivanov [email protected]
2323
* \author Andy Zelenak [email protected]
24+
* \author Marvin Große Besselmann [email protected]
2425
* \date 2019-04-11
2526
*
2627
*/
@@ -154,6 +155,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
154155
double pausing_ramp_up_increment_;
155156

156157
std::unique_ptr<urcl::UrDriver> ur_driver_;
158+
std::unique_ptr<ur_robot_driver::DashboardClientROS> dashboard_client_;
157159
};
158160
} // namespace ur_robot_driver
159161

0 commit comments

Comments
 (0)