Class RTDEClient

Class Documentation

class RTDEClient

The RTDEClient class manages communication over the RTDE interface. It contains the RTDE handshake and read and write functionality to and from the robot.

Public Functions

RTDEClient() = delete
RTDEClient(std::string robot_ip, comm::INotifier &notifier, const std::string &output_recipe_file, const std::string &input_recipe_file, double target_frequency = 0.0)

Creates a new RTDEClient object, including a used URStream and Pipeline to handle the communication with the robot.

Parameters:
  • robot_ip – The IP of the robot

  • notifier – The notifier to use in the pipeline

  • output_recipe_file – Path to the file containing the output recipe

  • input_recipe_file – Path to the file containing the input recipe

  • target_frequency – Frequency to run at. Defaults to 0.0 which means maximum frequency.

RTDEClient(std::string robot_ip, comm::INotifier &notifier, const std::vector<std::string> &output_recipe, const std::vector<std::string> &input_recipe, double target_frequency = 0.0)

Creates a new RTDEClient object, including a used URStream and Pipeline to handle the communication with the robot.

Parameters:
  • robot_ip – The IP of the robot

  • notifier – The notifier to use in the pipeline

  • output_recipe – Vector containing the output recipe

  • input_recipe – Vector containing the input recipe

  • target_frequency – Frequency to run at. Defaults to 0.0 which means maximum frequency.

~RTDEClient()
bool init(const size_t max_num_tries = 0, const std::chrono::milliseconds reconnection_time = std::chrono::seconds(10))

Sets up RTDE communication with the robot. The handshake includes negotiation of the used protocol version and setting of input and output recipes.

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:

Success of the handshake

bool start()

Triggers the robot to start sending RTDE data packages in the negotiated format.

Returns:

Success of the requested start

bool pause()

Pauses RTDE data package communication.

Returns:

Whether the RTDE data package communication was paused successfully

std::unique_ptr<rtde_interface::DataPackage> getDataPackage(std::chrono::milliseconds timeout)

Reads the pipeline to fetch the next data package.

Parameters:

timeout – Time to wait if no data package is currently in the queue

Returns:

Unique ptr to the package, if a package was fetched successfully, nullptr otherwise

inline double getMaxFrequency() const

Getter for the maximum frequency the robot can publish RTDE data packages with.

Returns:

The maximum frequency

inline double getTargetFrequency() const

Getter for the target frequency that the robot will publish RTDE data packages with.

Returns:

The target frequency

inline VersionInformation getVersion()

Getter for the UR control version received from the robot.

Returns:

The VersionInformation received from the robot

std::string getIP() const

Returns the IP address (of the machine running this driver) used for the socket connection.

Returns:

The IP address as a string (e.g. “192.168.0.1”)

RTDEWriter &getWriter()

Getter for the RTDE writer, which is used to send data via the RTDE interface to the robot.

Returns:

A reference to the used RTDEWriter

inline std::vector<std::string> getOutputRecipe()

Getter for the RTDE output recipe.

Returns:

The output recipe