dashboard_client.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // Copyright 2019 FZI Forschungszentrum Informatik
5 // Created on behalf of Universal Robots A/S
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // -- END LICENSE BLOCK ------------------------------------------------
19 
20 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 
29 #include <filesystem>
30 #include <iostream>
31 #include <regex>
32 #include <thread>
33 #include <ur_client_library/log.h>
36 
37 #ifndef _WIN32
38 # include <unistd.h>
39 #endif // !_WIN32
40 
41 using namespace std::chrono_literals;
42 
43 namespace urcl
44 {
45 DashboardClient::DashboardClient(const std::string& host) : host_(host), port_(DASHBOARD_SERVER_PORT)
46 {
47 }
48 
49 void DashboardClient::rtrim(std::string& str, const std::string& chars)
50 {
51  str.erase(str.find_last_not_of(chars) + 1);
52 }
53 
54 bool DashboardClient::connect(const size_t max_num_tries, const std::chrono::milliseconds reconnection_time)
55 {
57  {
58  URCL_LOG_ERROR("%s", "Socket is already connected. Refusing to reconnect.");
59  return false;
60  }
61  bool ret_val = false;
62 
63  timeval configured_tv = getConfiguredReceiveTimeout();
64  timeval tv;
65 
66  while (!ret_val)
67  {
68  // The first read after connection can take more time.
69  tv.tv_sec = 10;
70  tv.tv_usec = 0;
71  TCPSocket::setReceiveTimeout(tv);
72  try
73  {
74  if (TCPSocket::setup(host_, port_, max_num_tries, reconnection_time))
75  {
76  URCL_LOG_INFO("%s", read().c_str());
77  ret_val = true;
78  }
79  else
80  {
81  return false;
82  }
83  }
84  catch (const TimeoutException&)
85  {
86  URCL_LOG_WARN("Did not receive dashboard bootup message although connection was established. This should not "
87  "happen, please contact the package maintainers. Retrying anyway...");
88  }
89  }
90 
91  // Reset read timeout to configured socket timeout
92  TCPSocket::setReceiveTimeout(configured_tv);
93 
94  std::string pv;
96 
97  return ret_val;
98 }
99 
101 {
102  URCL_LOG_INFO("Disconnecting from Dashboard server on %s:%d", host_.c_str(), port_);
103  TCPSocket::close();
104 }
105 
106 bool DashboardClient::send(const std::string& text)
107 {
108  size_t len = text.size();
109  const uint8_t* data = reinterpret_cast<const uint8_t*>(text.c_str());
110  size_t written;
111  return TCPSocket::write(data, len, written);
112 }
113 
115 {
116  std::stringstream result;
117  char character;
118  size_t read_chars = 99;
119  while (read_chars > 0)
120  {
121  if (!TCPSocket::read((uint8_t*)&character, 1, read_chars))
122  {
123  disconnect();
124  throw TimeoutException("Did not receive answer from dashboard server in time. Disconnecting from dashboard "
125  "server.",
126  *recv_timeout_);
127  }
128  result << character;
129  if (character == '\n')
130  {
131  break;
132  }
133  }
134  return result.str();
135 }
136 
137 std::string DashboardClient::sendAndReceive(const std::string& text)
138 {
139  std::string command = text;
140  if (text.back() != '\n')
141  {
142  command = text + "\n";
143  }
144  std::string response = "ERROR";
145  std::lock_guard<std::mutex> lock(write_mutex_);
146  if (send(command))
147  {
148  response = read();
149  }
150  else
151  {
152  throw UrException("Failed to send request to dashboard server. Are you connected to the Dashboard Server?");
153  }
154  rtrim(response);
155 
156  return response;
157 }
158 
159 bool DashboardClient::sendRequest(const std::string& command, const std::string& expected)
160 {
161  URCL_LOG_DEBUG("Send Request: %s", command.c_str());
162  std::string response = sendAndReceive(command);
163  URCL_LOG_DEBUG("Got Response: %s", response.c_str());
164  bool ret = std::regex_match(response, std::regex(expected));
165  if (!ret)
166  {
167  URCL_LOG_WARN("Expected: \"%s\", but received: \"%s\"", expected.c_str(), response.c_str());
168  }
169  return ret;
170 }
171 
172 std::string DashboardClient::sendRequestString(const std::string& command, const std::string& expected)
173 {
174  URCL_LOG_DEBUG("Send Request: %s", command.c_str());
175  std::string response = sendAndReceive(command);
176  bool ret = std::regex_match(response, std::regex(expected));
177  if (!ret)
178  {
179  throw UrException("Expected: " + expected + ", but received: " + response);
180  }
181  return response;
182 }
183 
184 bool DashboardClient::waitForReply(const std::string& command, const std::string& expected,
185  const std::chrono::duration<double> timeout)
186 {
187  const std::chrono::duration<double> wait_period = 100ms;
188 
189  std::chrono::duration<double> time_done(0);
190  std::string response;
191 
192  while (time_done < timeout)
193  {
194  // Send the request
195  response = sendAndReceive(command);
196 
197  // Check if the response was as expected
198  if (std::regex_match(response, std::regex(expected)))
199  {
200  return true;
201  }
202 
203  // wait 100ms before trying again
204  std::this_thread::sleep_for(wait_period);
205  time_done += wait_period;
206  }
207 
208  URCL_LOG_WARN("Did not got the expected \"%s\" response within the timeout. Last response was: \"%s\"",
209  expected.c_str(), response.c_str()); // Is a warning here so retryCommand does not throw when retrying
210  return false;
211 }
212 
213 bool DashboardClient::retryCommand(const std::string& requestCommand, const std::string& requestExpectedResponse,
214  const std::string& waitRequest, const std::string& waitExpectedResponse,
215  const std::chrono::duration<double> timeout,
216  const std::chrono::duration<double> retry_period)
217 {
218  std::chrono::duration<double> time_done(0);
219  do
220  {
221  sendRequest(requestCommand, requestExpectedResponse);
222  time_done += retry_period;
223 
224  if (waitForReply(waitRequest, waitExpectedResponse, retry_period))
225  {
226  return true;
227  }
228  } while (time_done < timeout);
229  return false;
230 }
231 
233 {
234  assertVersion("5.0.0", "3.0", "power off");
235  return sendRequest("power off", "Powering off") && waitForReply("robotmode", "Robotmode: POWER_OFF");
236 }
237 
238 bool DashboardClient::commandPowerOn(const std::chrono::duration<double> timeout)
239 {
240  assertVersion("5.0.0", "3.0", "power on");
241  return retryCommand("power on", "Powering on", "robotmode", "Robotmode: IDLE", timeout);
242 }
243 
245 {
246  assertVersion("5.0.0", "3.0", "brake release");
247  return sendRequest("brake release", "Brake releasing") && waitForReply("robotmode", "Robotmode: RUNNING");
248 }
249 
250 bool DashboardClient::commandLoadProgram(const std::string& program_file_name)
251 {
252  assertVersion("5.0.0", "1.4", "load <program>");
253  // We load the program, which will fail if the program is not found or the requested file does
254  // not contain a valid program. Afterwards, we wait until the program state is stopped with a
255  // program named the same as the requested program. We cannot check the full file path here, but
256  // the important thing is that the program state is stopped.
257  return sendRequest("load " + program_file_name + "", "(?:Loading program: ).*(?:" + program_file_name + ").*") &&
258  waitForReply("programState", "STOPPED " + std::filesystem::path{ program_file_name }.filename().string());
259 }
260 
261 bool DashboardClient::commandLoadInstallation(const std::string& installation_file_name)
262 {
263  assertVersion("5.0.0", "3.2", "load installation");
264  return sendRequest("load installation " + installation_file_name,
265  "(?:Loading installation: ).*(?:" + installation_file_name + ").*");
266 }
267 
269 {
270  assertVersion("5.0.0", "1.4", "play");
271  return sendRequest("play", "Starting program") && waitForReply("programState", "(?:PLAYING ).*");
272 }
273 
275 {
276  assertVersion("5.0.0", "1.4", "pause");
277  return sendRequest("pause", "Pausing program") && waitForReply("programState", "(?:PAUSED ).*");
278 }
279 
281 {
282  assertVersion("5.0.0", "1.4", "stop");
283  return sendRequest("stop", "Stopped") && waitForReply("programState", "(?:STOPPED ).*");
284 }
285 
287 {
288  assertVersion("5.0.0", "1.6", "close popup");
289  return sendRequest("close popup", "closing popup");
290 }
291 
293 {
294  assertVersion("5.0.0", "3.1", "close safety popup");
295  return sendRequest("close safety popup", "closing safety popup");
296 }
297 
299 {
300  assertVersion("5.1.0", "3.7", "restart safety");
301  return sendRequest("restart safety", "Restarting safety") && waitForReply("robotmode", "Robotmode: POWER_OFF");
302 }
303 
305 {
306  assertVersion("5.0.0", "3.1", "unlock protective stop");
307  return sendRequest("unlock protective stop", "Protective stop releasing");
308 }
309 
311 {
312  assertVersion("5.0.0", "1.4", "shutdown");
313  return sendRequest("shutdown", "Shutting down");
314 }
315 
317 {
318  assertVersion("5.0.0", "1.4", "quit");
319  return sendRequest("quit", "Disconnected");
320 }
321 
323 {
324  assertVersion("5.0.0", "1.6", "running");
325  std::string const response = sendAndReceive("running");
326  return std::regex_match(response, std::regex("Program running: true"));
327 }
328 
330 {
331  assertVersion("5.0.0", "1.8", "isProgramSaved");
332  return sendRequest("isProgramSaved", "(?:true ).*");
333 }
334 
336 {
337  assertVersion("5.6.0", "-", "is in remote control");
338  std::string response = sendAndReceive("is in remote control");
339  bool ret = std::regex_match(response, std::regex("true"));
340  return ret;
341 }
342 
343 bool DashboardClient::commandPopup(const std::string& popup_text)
344 {
345  assertVersion("5.0.0", "1.6", "popup");
346  return sendRequest("popup " + popup_text, "showing popup");
347 }
348 
349 bool DashboardClient::commandAddToLog(const std::string& log_text)
350 {
351  assertVersion("5.0.0", "1.8", "addToLog");
352  return sendRequest("addToLog " + log_text, "Added log message");
353 }
354 
355 bool DashboardClient::commandPolyscopeVersion(std::string& polyscope_version)
356 {
357  std::string expected = "(?:URSoftware ).*";
358  polyscope_version = sendRequestString("PolyscopeVersion", expected);
359  std::string version_string = polyscope_version.substr(polyscope_version.find(" ") + 1,
360  polyscope_version.find(" (") - polyscope_version.find(" ") - 1);
362  return std::regex_match(polyscope_version, std::regex(expected));
363 }
364 
365 bool DashboardClient::commandGetRobotModel(std::string& robot_model)
366 {
367  assertVersion("5.6.0", "3.12", "get robot model");
368  std::string expected = "(?:UR).*";
369  robot_model = sendRequestString("get robot model", expected);
370  return std::regex_match(robot_model, std::regex(expected));
371 }
372 
373 bool DashboardClient::commandGetSerialNumber(std::string& serial_number)
374 {
375  assertVersion("5.6.0", "3.12", "get serial number");
376  std::string expected = "(?:20).*";
377  serial_number = sendRequestString("get serial number", expected);
378  return std::regex_match(serial_number, std::regex(expected));
379 }
380 
381 bool DashboardClient::commandRobotMode(std::string& robot_mode)
382 {
383  assertVersion("5.0.0", "1.6", "robotmode");
384  std::string expected = "(?:Robotmode: ).*";
385  robot_mode = sendRequestString("robotmode", expected);
386  return std::regex_match(robot_mode, std::regex(expected));
387 }
388 
389 bool DashboardClient::commandGetLoadedProgram(std::string& loaded_program)
390 {
391  assertVersion("5.0.0", "1.6", "get loaded program");
392  std::string expected = "(?:Loaded program: ).*";
393  loaded_program = sendRequestString("get loaded program", expected);
394  return std::regex_match(loaded_program, std::regex(expected));
395 }
396 
397 bool DashboardClient::commandSafetyMode(std::string& safety_mode)
398 {
399  assertVersion("5.0.0", "3.0", "safetymode");
400  std::string expected = "(?:Safetymode: ).*";
401  safety_mode = sendRequestString("safetymode", expected);
402  return std::regex_match(safety_mode, std::regex(expected));
403 }
404 
405 bool DashboardClient::commandSafetyStatus(std::string& safety_status)
406 {
407  assertVersion("5.4.0", "3.11", "safetystatus");
408  std::string expected = "(?:Safetystatus: ).*";
409  safety_status = sendRequestString("safetystatus", expected);
410  return std::regex_match(safety_status, std::regex(expected));
411 }
412 
413 bool DashboardClient::commandProgramState(std::string& program_state)
414 {
415  assertVersion("5.0.0", "1.8", "programState");
416  std::string expected = "(?:).*";
417  program_state = sendRequestString("programState", expected);
418  return !std::regex_match(program_state, std::regex("(?:could not understand).*"));
419 }
420 
421 bool DashboardClient::commandGetOperationalMode(std::string& operational_mode)
422 {
423  assertVersion("5.6.0", "-", "get operational mode");
424  std::string expected = "(?:).*";
425  operational_mode = sendRequestString("get operational mode", expected);
426  return !std::regex_match(operational_mode, std::regex("(?:could not understand).*"));
427 }
428 
429 bool DashboardClient::commandSetOperationalMode(const std::string& operational_mode)
430 {
431  assertVersion("5.0.0", "-", "set operational mode");
432  return sendRequest("set operational mode " + operational_mode,
433  "(?:Operational mode ).*(?:" + operational_mode + ").*");
434 }
435 
437 {
438  assertVersion("5.0.0", "-", "clear operational mode");
439  return sendRequest("clear operational mode", "(?:No longer controlling the operational mode. ).*");
440 }
441 
442 bool DashboardClient::commandSetUserRole(const std::string& user_role)
443 {
444  assertVersion("-", "1.8", "setUserRole");
445  return sendRequest("setUserRole " + user_role, "(?:Setting user role: ).*");
446 }
447 
448 bool DashboardClient::commandGetUserRole(std::string& user_role)
449 {
450  assertVersion("-", "1.8", "getUserRole");
451  std::string expected = "(?:).*";
452  user_role = sendRequestString("getUserRole", expected);
453  return !std::regex_match(user_role, std::regex("(?:could not understand).*"));
454 }
455 
456 bool DashboardClient::commandGenerateFlightReport(const std::string& report_type)
457 {
458  assertVersion("5.8.0", "3.13", "generate flight report");
459  timeval configured_tv = getConfiguredReceiveTimeout();
460  timeval tv;
461  tv.tv_sec = 180;
462  tv.tv_usec = 0;
463  TCPSocket::setReceiveTimeout(tv); // Set timeout to 3 minutes as this command can take a long time to complete
464  bool ret = sendRequest("generate flight report " + report_type, "(?:Flight Report generated with id:).*");
465  TCPSocket::setReceiveTimeout(configured_tv); // Reset to configured receive timeout
466  return ret;
467 }
468 
469 bool DashboardClient::commandGenerateSupportFile(const std::string& dir_path)
470 {
471  assertVersion("5.8.0", "3.13", "generate support file");
472  timeval configured_tv = getConfiguredReceiveTimeout();
473  timeval tv;
474  tv.tv_sec = 600;
475  tv.tv_usec = 0;
476  TCPSocket::setReceiveTimeout(tv); // Set timeout to 10 minutes as this command can take a long time to complete
477  bool ret = sendRequest("generate support file " + dir_path, "(?:Completed successfully:).*");
478  TCPSocket::setReceiveTimeout(configured_tv); // Reset to configured receive timeout
479  return ret;
480 }
481 
483 {
484  assertVersion("5.0.0", "1.8", "save log");
485  return sendRequest("saveLog", "Log saved to disk");
486 }
487 
488 void DashboardClient::assertVersion(const std::string& e_series_min_ver, const std::string& cb3_min_ver,
489  const std::string& required_call)
490 {
491  if (!polyscope_version_.isESeries() && cb3_min_ver == "-")
492  {
493  std::stringstream ss;
494  ss << "The dasboard call '" << required_call
495  << "' is only available on e-series robots, but you seem to be running version " << polyscope_version_;
496  throw UrException(ss.str());
497  }
498 
499  if (polyscope_version_.isESeries() && e_series_min_ver == "-")
500  {
501  std::stringstream ss;
502  ss << "The dasboard call '" << required_call
503  << "' is only available on pre-e-series robots (5.x.y), but you seem to be running version "
505  throw UrException(ss.str());
506  }
507 
508  auto ref = polyscope_version_.isESeries() ? VersionInformation::fromString(e_series_min_ver) :
509  VersionInformation::fromString(cb3_min_ver);
510  if (ref > polyscope_version_)
511  {
512  std::stringstream ss;
513  ss << "Polyscope version " << polyscope_version_ << " isn't recent enough to use dashboard call '" << required_call
514  << "'";
515  throw UrException(ss.str());
516  }
517 }
518 
520 {
521  timeval tv;
522  if (recv_timeout_ != nullptr)
523  {
524  tv = *recv_timeout_.get();
525  }
526  else
527  {
528  tv.tv_sec = 1;
529  tv.tv_usec = 0;
530  }
531  return tv;
532 }
533 
534 } // namespace urcl
urcl::DashboardClient::commandRestartSafety
bool commandRestartSafety()
Send Restart Safety command.
Definition: dashboard_client.cpp:298
urcl::VersionInformation::fromString
static VersionInformation fromString(const std::string &str)
Parses a version string into a VersionInformation object.
Definition: version_information.cpp:59
urcl::DashboardClient::commandPlay
bool commandPlay()
Send Play program command.
Definition: dashboard_client.cpp:268
urcl::DashboardClient::commandSetOperationalMode
bool commandSetOperationalMode(const std::string &operational_mode)
Send Set operational mode command (Only available for e-series)
Definition: dashboard_client.cpp:429
urcl::DashboardClient::assertVersion
void assertVersion(const std::string &e_series_min_ver, const std::string &cb3_min_ver, const std::string &required_call)
Makes sure that the dashboard_server's version is above the required version.
Definition: dashboard_client.cpp:488
exceptions.h
urcl::DashboardClient::commandIsProgramSaved
bool commandIsProgramSaved()
Send "Is program saved" request command.
Definition: dashboard_client.cpp:329
urcl::DashboardClient::commandGetSerialNumber
bool commandGetSerialNumber(std::string &serial_number)
Get Serial number.
Definition: dashboard_client.cpp:373
urcl::DashboardClient::polyscope_version_
VersionInformation polyscope_version_
Definition: dashboard_client.h:458
urcl::DashboardClient::commandClosePopup
bool commandClosePopup()
Send Close popup command.
Definition: dashboard_client.cpp:286
urcl
Definition: bin_parser.h:36
urcl::DashboardClient::commandStop
bool commandStop()
Send Stop program command.
Definition: dashboard_client.cpp:280
urcl::DashboardClient::commandGenerateSupportFile
bool commandGenerateSupportFile(const std::string &dir_path)
Send Generate support file command.
Definition: dashboard_client.cpp:469
urcl::DashboardClient::commandSetUserRole
bool commandSetUserRole(const std::string &user_role)
Send Set user role command (Only available for CB3)
Definition: dashboard_client.cpp:442
urcl::DashboardClient::commandUnlockProtectiveStop
bool commandUnlockProtectiveStop()
Send Unlock Protective stop popup command.
Definition: dashboard_client.cpp:304
URCL_LOG_ERROR
#define URCL_LOG_ERROR(...)
Definition: log.h:26
urcl::DashboardClient::write_mutex_
std::mutex write_mutex_
Definition: dashboard_client.h:467
urcl::DashboardClient::retryCommand
bool retryCommand(const std::string &requestCommand, const std::string &requestExpectedResponse, const std::string &waitRequest, const std::string &waitExpectedResponse, const std::chrono::duration< double > timeout, const std::chrono::duration< double > retry_period=std::chrono::seconds(1))
Keep Sending the requesting Command and wait until it returns the expected answer.
Definition: dashboard_client.cpp:213
urcl::DashboardClient::send
bool send(const std::string &text)
Definition: dashboard_client.cpp:106
urcl::DashboardClient::waitForReply
bool waitForReply(const std::string &command, const std::string &expected, std::chrono::duration< double > timeout=std::chrono::seconds(30))
brief Sends a command and wait until it returns the expected answer
Definition: dashboard_client.cpp:184
URCL_LOG_DEBUG
#define URCL_LOG_DEBUG(...)
Definition: log.h:23
urcl::DashboardClient::rtrim
void rtrim(std::string &str, const std::string &chars="\t\n\v\f\r ")
Definition: dashboard_client.cpp:49
urcl::DashboardClient::port_
int port_
Definition: dashboard_client.h:466
urcl::DashboardClient::commandLoadProgram
bool commandLoadProgram(const std::string &program_file_name)
Send Load program command.
Definition: dashboard_client.cpp:250
urcl::DashboardClient::commandShutdown
bool commandShutdown()
Send Shutdown command.
Definition: dashboard_client.cpp:310
urcl::DashboardClient::commandGetRobotModel
bool commandGetRobotModel(std::string &robot_model)
Get Robot model.
Definition: dashboard_client.cpp:365
urcl::DashboardClient::commandPopup
bool commandPopup(const std::string &popup_text)
Send popup command.
Definition: dashboard_client.cpp:343
urcl::DashboardClient::commandBrakeRelease
bool commandBrakeRelease()
Send Brake release command.
Definition: dashboard_client.cpp:244
urcl::UrException
Our base class for exceptions. Specialized exceptions should inherit from those.
Definition: exceptions.h:53
urcl::DashboardClient::commandAddToLog
bool commandAddToLog(const std::string &log_text)
Send text to log.
Definition: dashboard_client.cpp:349
urcl::DashboardClient::host_
std::string host_
Definition: dashboard_client.h:465
urcl::DashboardClient::sendRequest
bool sendRequest(const std::string &command, const std::string &expected)
Sends command and compare it with the expected answer.
Definition: dashboard_client.cpp:159
urcl::DashboardClient::sendAndReceive
std::string sendAndReceive(const std::string &command)
Sends a command through the socket and waits for an answer.
Definition: dashboard_client.cpp:137
urcl::DashboardClient::commandQuit
bool commandQuit()
Send Quit command.
Definition: dashboard_client.cpp:316
urcl::DashboardClient::commandProgramState
bool commandProgramState(std::string &program_state)
Get Program state.
Definition: dashboard_client.cpp:413
urcl::DashboardClient::commandSaveLog
bool commandSaveLog()
Flush the polyscope log to the log_history.txt file.
Definition: dashboard_client.cpp:482
dashboard_client.h
urcl::DashboardClient::read
std::string read()
Definition: dashboard_client.cpp:114
urcl::DashboardClient::commandClearOperationalMode
bool commandClearOperationalMode()
Send Clear operational mode command.
Definition: dashboard_client.cpp:436
urcl::DashboardClient::commandRunning
bool commandRunning()
Send Running command.
Definition: dashboard_client.cpp:322
urcl::DashboardClient::getConfiguredReceiveTimeout
timeval getConfiguredReceiveTimeout() const
Gets the configured receive timeout. If receive timeout is unconfigured "normal" socket timeout of 1 ...
Definition: dashboard_client.cpp:519
urcl::DashboardClient::commandLoadInstallation
bool commandLoadInstallation(const std::string &installation_file_name)
Send Load installation command.
Definition: dashboard_client.cpp:261
urcl::TimeoutException
A specialized exception representing that communication to the tool is not possible.
Definition: exceptions.h:121
URCL_LOG_INFO
#define URCL_LOG_INFO(...)
Definition: log.h:25
urcl::DashboardClient::disconnect
void disconnect()
Makes sure no connection to the dashboard server is held inside the object.
Definition: dashboard_client.cpp:100
log.h
urcl::VersionInformation::isESeries
bool isESeries() const
Definition: version_information.cpp:88
urcl::DashboardClient::commandGetLoadedProgram
bool commandGetLoadedProgram(std::string &loaded_program)
Get Loaded Program.
Definition: dashboard_client.cpp:389
urcl::comm::SocketState::Connected
@ Connected
Socket is connected and ready to use.
urcl::DashboardClient::commandGenerateFlightReport
bool commandGenerateFlightReport(const std::string &report_type)
Send Generate flight report command.
Definition: dashboard_client.cpp:456
urcl::DashboardClient::connect
bool connect(const size_t max_num_tries=0, const std::chrono::milliseconds reconnection_time=std::chrono::seconds(10))
Opens a connection to the dashboard server on the host as specified in the constructor.
Definition: dashboard_client.cpp:54
urcl::DashboardClient::commandSafetyStatus
bool commandSafetyStatus(std::string &safety_status)
Get Safety status.
Definition: dashboard_client.cpp:405
urcl::DashboardClient::commandGetUserRole
bool commandGetUserRole(std::string &user_role)
Send Get user role command (Only available for CB3)
Definition: dashboard_client.cpp:448
urcl::DashboardClient::commandPause
bool commandPause()
Send Pause program command.
Definition: dashboard_client.cpp:274
urcl::DashboardClient::commandPolyscopeVersion
bool commandPolyscopeVersion(std::string &polyscope_version)
Get Polyscope version.
Definition: dashboard_client.cpp:355
urcl::DashboardClient::commandPowerOn
bool commandPowerOn(const std::chrono::duration< double > timeout=std::chrono::seconds(300))
Send Power on command.
Definition: dashboard_client.cpp:238
URCL_LOG_WARN
#define URCL_LOG_WARN(...)
Definition: log.h:24
urcl::DashboardClient::commandPowerOff
bool commandPowerOff()
Send Power off command.
Definition: dashboard_client.cpp:232
urcl::comm::TCPSocket::recv_timeout_
std::unique_ptr< timeval > recv_timeout_
Definition: tcp_socket.h:67
urcl::DashboardClient::commandGetOperationalMode
bool commandGetOperationalMode(std::string &operational_mode)
Get Operational mode.
Definition: dashboard_client.cpp:421
urcl::DashboardClient::commandCloseSafetyPopup
bool commandCloseSafetyPopup()
Send Close safety popup command.
Definition: dashboard_client.cpp:292
urcl::DashboardClient::commandSafetyMode
bool commandSafetyMode(std::string &safety_mode)
Get Safety mode.
Definition: dashboard_client.cpp:397
urcl::DashboardClient::commandRobotMode
bool commandRobotMode(std::string &robot_mode)
Get Robot mode.
Definition: dashboard_client.cpp:381
urcl::DashboardClient::sendRequestString
std::string sendRequestString(const std::string &command, const std::string &expected)
Sends command and compare it with the expected answer.
Definition: dashboard_client.cpp:172
urcl::comm::TCPSocket::getState
SocketState getState()
Getter for the state of the socket.
Definition: tcp_socket.h:82
urcl::DashboardClient::commandIsInRemoteControl
bool commandIsInRemoteControl()
Send "Is in remote control" query command.
Definition: dashboard_client.cpp:335


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58