DashboardClient

The DashboardClient wraps the calls on the Dashboard server directly into C++ functions.

After connecting to the dashboard server by using the connect() function, dashboard calls can be sent using the sendAndReceive() function. Answers from the dashboard server will be returned as string from this function. If no answer is received, a UrException is thrown.

Some functions are also wrapped into command...() functions such as commandCloseSafetyPopup(). These functions are blocking and will wait for the necessary action being done. This can involve querying another call to the dashboard server until the action is done. For example, commandPowerOn() will block until the robot reports “Robotmode: RUNNING” or the given timeout is reached.

The dashboard_example.cpp shows how to use this class:

Listing 3 examples/dashboard_example.cpp
61  auto my_dashboard = std::make_unique<DashboardClient>(robot_ip);
62  if (!my_dashboard->connect())
63  {
64    URCL_LOG_ERROR("Could not connect to dashboard");
65    return 1;
66  }
67
68  if (!my_dashboard->commandPowerOff())
69  {
70    URCL_LOG_ERROR("Could not send power off");
71    return 1;
72  }
73
74  my_dashboard->commandCloseSafetyPopup();