Skip to content

Commit 7c1ef8c

Browse files
committed
Initialize dashboard client for PolyScopeX version 10.11.0 and above
There is dashboard client support for PolyScopeX version 10.11.0 and above, so we should initialize it in the ExampleRobotWrapper when it is possible.
1 parent 1d785d9 commit 7c1ef8c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/example_robot_wrapper.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std:
4646
primary_client_->start();
4747

4848
auto robot_version = primary_client_->getRobotVersion();
49-
if (*robot_version < VersionInformation::fromString("10.0.0"))
49+
if (*robot_version < VersionInformation::fromString("10.0.0") ||
50+
*robot_version >= VersionInformation::fromString("10.11.0"))
5051
{
51-
dashboard_client_ = std::make_shared<DashboardClient>(robot_ip);
52+
const DashboardClient::ClientPolicy client_policy = *robot_version < VersionInformation::fromString("10.0.0") ?
53+
DashboardClient::ClientPolicy::G5 :
54+
DashboardClient::ClientPolicy::POLYSCOPE_X;
55+
dashboard_client_ = std::make_shared<DashboardClient>(robot_ip, client_policy);
5256
// Connect the robot Dashboard
5357
if (!dashboard_client_->connect())
5458
{
@@ -107,8 +111,15 @@ bool ExampleRobotWrapper::clearProtectiveStop()
107111
URCL_LOG_INFO("Robot is in protective stop, trying to release it");
108112
if (dashboard_client_ != nullptr)
109113
{
110-
dashboard_client_->commandClosePopup();
111-
dashboard_client_->commandCloseSafetyPopup();
114+
try
115+
{
116+
dashboard_client_->commandClosePopup();
117+
dashboard_client_->commandCloseSafetyPopup();
118+
}
119+
catch (const NotImplementedException&)
120+
{
121+
// The command is not yet implemented for the dashboardClient in PolyscopeX, so we just ignore the exception
122+
}
112123
}
113124
try
114125
{

0 commit comments

Comments
 (0)