Skip to content

Commit 075c7e0

Browse files
committed
Shutdown dashboard client when connected to PolyScopeX robot
Before trying to establish a connection to the dashboard server, check the version of the connected robot. If it is a PolyScopeX robot, shutdown the dashboard client.
1 parent 077bac5 commit 075c7e0

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

ur_robot_driver/include/ur_robot_driver/dashboard_client_ros.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// UR client library
5252
#include "ur_client_library/ur/dashboard_client.h"
5353
#include "ur_client_library/exceptions.h"
54-
#include "ur_dashboard_msgs/msg/program_state.hpp"
54+
#include "ur_client_library/primary/primary_client.h"
5555
#include "ur_dashboard_msgs/srv/add_to_log.hpp"
5656
#include "ur_dashboard_msgs/srv/get_loaded_program.hpp"
5757
#include "ur_dashboard_msgs/srv/get_program_state.hpp"
@@ -120,6 +120,9 @@ class DashboardClientROS
120120
std::shared_ptr<rclcpp::Node> node_;
121121
urcl::DashboardClient client_;
122122

123+
urcl::comm::INotifier notifier_;
124+
urcl::primary_interface::PrimaryClient primary_client_;
125+
123126
// Commanding services
124127
rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr brake_release_service_;
125128
rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr clear_operational_mode_service_;

ur_robot_driver/src/dashboard_client_node.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ int main(int argc, char** argv)
5353

5454
ur_robot_driver::registerUrclLogHandler(""); // Set empty tf_prefix at the moment
5555

56-
ur_robot_driver::DashboardClientROS client(node, robot_ip);
56+
try {
57+
ur_robot_driver::DashboardClientROS client(node, robot_ip);
58+
} catch (const urcl::UrException& e) {
59+
RCLCPP_WARN(rclcpp::get_logger("Dashboard_Client"),
60+
"%s This warning is expected on a PolyScopeX robot. If you don't want to see this warning, "
61+
"please don't start the dashboard client. Exiting dashboard client now.",
62+
e.what());
63+
}
5764

5865
rclcpp::spin(node);
5966

ur_robot_driver/src/dashboard_client_ros.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,27 @@
3737
*/
3838
//----------------------------------------------------------------------
3939

40-
#include <ur_robot_driver/dashboard_client_ros.hpp>
40+
#include <ur_client_library/exceptions.h>
41+
#include <ur_client_library/primary/primary_client.h>
4142

4243
#include <string>
4344

45+
#include <ur_robot_driver/dashboard_client_ros.hpp>
46+
4447
namespace ur_robot_driver
4548
{
4649
DashboardClientROS::DashboardClientROS(const rclcpp::Node::SharedPtr& node, const std::string& robot_ip)
47-
: node_(node), client_(robot_ip)
50+
: node_(node), client_(robot_ip), primary_client_(robot_ip, notifier_)
4851
{
4952
node_->declare_parameter<double>("receive_timeout", 1);
53+
54+
primary_client_.start(10, std::chrono::seconds(2));
55+
auto robot_version = primary_client_.getRobotVersion();
56+
57+
if (robot_version->major > 5) {
58+
throw(urcl::UrException("The dashboard server is only available for CB3 and e-Series robots."));
59+
}
60+
5061
connect();
5162

5263
// Service to release the brakes. If the robot is currently powered off, it will get powered on on the fly.

0 commit comments

Comments
 (0)