Class DashboardClientImpl

Inheritance Relationships

Derived Types

Class Documentation

class DashboardClientImpl

Subclassed by urcl::DashboardClientImplG5, urcl::DashboardClientImplX

Public Functions

DashboardClientImpl() = default
inline DashboardClientImpl(const std::string &host)
virtual ~DashboardClientImpl() = default
virtual std::string sendAndReceive(const std::string &command) = 0

Sends a command through the socket and waits for an answer.

Parameters:

command – Command that will be sent to the server.

Throws:

UrException – if no response was read from the dashboard server

Returns:

Answer as received by the server cut off any trailing newlines.

virtual bool connect(const size_t max_num_tries = 0, const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10)) = 0

Opens a connection to the dashboard server on the host as specified in the constructor.

Parameters:
  • max_num_tries – Maximum number of connection attempts before counting the connection as failed. Unlimited number of attempts when set to 0.

  • reconnection_time – time in between connection attempts to the server

Returns:

True on successful connection, false otherwise.

virtual void disconnect() = 0

Makes sure no connection to the dashboard server is held inside the object.

virtual timeval getConfiguredReceiveTimeout() const = 0

Gets the configured receive timeout. If receive timeout is unconfigured “normal” socket timeout of 1 second will be returned.

Returns:

configured receive timeout

inline virtual void setReceiveTimeout(const timeval &timeout)

Sets the receive timeout for the socket.

Parameters:

timeout – The timeout to be set

virtual bool sendRequest(const std::string &command, const std::string &expeted_response_pattern = "", const std::string &payload = "") = 0

Sends command and verifies that a valid answer is received.

Parameters:
  • command – Command that will be sent to the server.

  • expected_response_pattern – Expected response as a regex string.

  • payload – Optional payload to be sent with the command.

Returns:

True if the reply to the command is as expected

virtual std::string sendRequestString(const std::string &command, const std::string &expected = "", const std::string &payload = "") = 0

Sends command and compare it with the expected answer.

Parameters:
  • command – Command that will be sent to the server.

  • expected – Expected response as a regex string

  • payload – Optional payload to be sent with the command.

Throws:

UrException – if the received answer does not match the expected one.

Returns:

Answer string as received by the server

virtual DashboardResponse commandPowerOff() = 0

Send Power off command.

virtual DashboardResponse commandPowerOn(const std::chrono::duration<double> timeout = std::chrono::seconds(300)) = 0

Send Power on command.

Parameters:

timeout – Timeout in seconds - The robot might take some time to boot before this call can be made successfully.

virtual DashboardResponse commandBrakeRelease() = 0

Send Brake release command.

virtual DashboardResponse commandLoadProgram(const std::string &program_file_name) = 0

Send Load program command.

Stores the following entries in the data field:

  • ‘program_name’: std::string

Parameters:

program_file_name – The urp program file name with the urp extension

virtual DashboardResponse commandLoadInstallation(const std::string &installation_file_name) = 0

Send Load installation command.

Stores the following entries in the data field:

  • ‘installation_name’: std::string

Parameters:

installation_file_name – The installation file name with the installation extension

virtual DashboardResponse commandPlay() = 0

Send Play program command.

virtual DashboardResponse commandPause() = 0

Send Pause program command.

virtual DashboardResponse commandResume() = 0

Send resume command.

This does only exist for PolyScope X, for e-Series robots “play” is used also for resuming a paused program.

virtual DashboardResponse commandStop() = 0

Send Stop program command.

virtual DashboardResponse commandClosePopup() = 0

Send Close popup command.

virtual DashboardResponse commandCloseSafetyPopup() = 0

Send Close safety popup command.

virtual DashboardResponse commandRestartSafety() = 0

Send Restart Safety command.

virtual DashboardResponse commandUnlockProtectiveStop() = 0

Send Unlock Protective stop popup command.

virtual DashboardResponse commandShutdown() = 0

Send Shutdown command.

virtual DashboardResponse commandQuit() = 0

Send Quit command.

virtual DashboardResponse commandRunning() = 0

Send Running command.

Stores the following entries in the data field:

  • ‘running’: bool

virtual DashboardResponse commandIsProgramSaved() = 0

Send “Is program saved” request command.

Stores the following entries in the data field:

  • ‘saved’: bool

virtual DashboardResponse commandIsInRemoteControl() = 0

Send “Is in remote control” query command.

Stores the following entries in the data field:

  • ‘remote_control’: bool

Throws:

anUrException when called on CB3 robots

virtual DashboardResponse commandPopup(const std::string &popup_text) = 0

Send popup command.

Parameters:

popup_text – The text to be shown in the popup

virtual DashboardResponse commandAddToLog(const std::string &log_text) = 0

Send text to log.

Parameters:

log_text – The text to be sent to the log

virtual DashboardResponse commandPolyscopeVersion() = 0

Get Polyscope version.

Stores the following entries in the data field:

  • ‘polyscope_version’: std::string

virtual DashboardResponse commandGetRobotModel() = 0

Get Robot model.

Stores the following entries in the data field:

  • ‘robot_model’: std::string

virtual DashboardResponse commandGetSerialNumber() = 0

Get Serial number.

Stores the following entries in the data field:

  • ‘serial_number’: std::string

virtual DashboardResponse commandRobotMode() = 0

Get Robot mode.

Stores the following entries in the data field:

  • ‘robot_mode’: std::string

virtual DashboardResponse commandGetLoadedProgram() = 0

Get Loaded Program.

Stores the following entries in the data field:

  • ‘program_name’: std::string

virtual DashboardResponse commandSafetyMode() = 0

Get Safety mode.

Stores the following entries in the data field:

  • ‘safety_mode’: std::string

virtual DashboardResponse commandSafetyStatus() = 0

Get Safety status.

Stores the following entries in the data field:

  • ‘safety_status’: std::string

virtual DashboardResponse commandProgramState() = 0

Get Program state.

Stores the following entries in the data field:

  • ‘program_state’: std::string

  • ’program_name’: std::string

virtual DashboardResponse commandGetOperationalMode() = 0

Get Operational mode.

Stores the following entries in the data field:

  • ‘operational_mode’: std::string

Throws:

anUrException when called on CB3 robots

virtual DashboardResponse commandSetOperationalMode(const std::string &operational_mode) = 0

Send Set operational mode command (Only available for e-series)

Parameters:

operational_mode – The operational mode to set on the robot

Throws:

anUrException when called on CB3 robots

virtual DashboardResponse commandClearOperationalMode() = 0

Send Clear operational mode command.

Throws:

anUrException when called on CB3 robots

virtual DashboardResponse commandSetUserRole(const std::string &user_role) = 0

Send Set user role command (Only available for CB3)

Parameters:

user_role – The user role to set on the robot

Throws:

anUrException when called on e-series robots

virtual DashboardResponse commandGetUserRole() = 0

Send Get user role command (Only available for CB3)

Throws:

anUrException when called on e-series robots

virtual DashboardResponse commandGenerateFlightReport(const std::string &report_type) = 0

Send Generate flight report command.

Parameters:

report_type – The report type to set for the flight report

virtual DashboardResponse commandGenerateSupportFile(const std::string &dir_path) = 0

Send Generate support file command.

Parameters:

dir_path – The path to the directory of an already existing directory location inside the programs directory, where the support file is saved

virtual DashboardResponse commandSaveLog() = 0

Flush the polyscope log to the log_history.txt file.

inline const VersionInformation &getPolyscopeVersion() const

Protected Functions

virtual void assertHasCommand(const std::string &command) const = 0

Protected Attributes

VersionInformation polyscope_version_
std::string host_