Class RTDEClient
Defined in File rtde_client.h
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 ¬ifier, const std::string &output_recipe_file, const std::string &input_recipe_file, double target_frequency = 0.0, bool ignore_unavailable_outputs = false)
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.
ignore_unavailable_outputs – Configure the behaviour when a variable of the output recipe is not available from the robot: output is silently ignored if true, a UrException is raised otherwise.
-
RTDEClient(std::string robot_ip, comm::INotifier ¬ifier, const std::vector<std::string> &output_recipe, const std::vector<std::string> &input_recipe, double target_frequency = 0.0, bool ignore_unavailable_outputs = false)
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.
ignore_unavailable_outputs – Configure the behaviour when a variable of the output recipe is not available from the robot: output is silently ignored if true, a UrException is raised otherwise.
-
~RTDEClient()
-
bool init(const size_t max_connection_attempts = 0, const std::chrono::milliseconds reconnection_timeout = comm::TCPSocket::DEFAULT_RECONNECTION_TIME, const size_t max_initialization_attempts = 3, const std::chrono::milliseconds initialization_timeout = std::chrono::seconds(1))
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_connection_attempts – Maximum number of (socket) connection attempts before counting the connection as failed. Unlimited number of attempts when set to 0.
reconnection_timeout – Time in between connection attempts to the socket
max_initialization_attempts – Maximum number of initialization attempts before counting the initialization as failed. Initialization can fail given an established socket connection e.g. when the connected socket does not implement an RTDE interface.
initialization_timeout – Time in between initialization attempts of the RTDE interface
- 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
-
RTDEClient() = delete