Go to the documentation of this file.
28 #ifndef UR_CLIENT_LIBRARY_UR_UR_DRIVER_H_INCLUDED
29 #define UR_CLIENT_LIBRARY_UR_UR_DRIVER_H_INCLUDED
218 [[deprecated(
"Initializing a UrDriver object with an argument list is deprecated. Please use UrDriver(const "
219 "UrDriverConfiguration& config) instead. This function will be removed in May 2027.")]]
220 UrDriver(
const std::string& robot_ip,
const std::string& script_file,
const std::string& output_recipe_file,
221 const std::string& input_recipe_file, std::function<
void(
bool)> handle_program_state,
bool headless_mode,
222 std::unique_ptr<ToolCommSetup> tool_comm_setup,
const uint32_t reverse_port = 50001,
223 const uint32_t script_sender_port = 50002,
int servoj_gain = 2000,
double servoj_lookahead_time = 0.03,
224 bool non_blocking_read =
false,
const std::string& reverse_ip =
"",
const uint32_t trajectory_port = 50003,
225 const uint32_t script_command_port = 50004)
279 [[deprecated(
"Initializing a UrDriver object with an argument list is deprecated. Please use UrDriver(const "
280 "UrDriverConfiguration& config) instead. This function will be removed in May 2027.")]]
281 UrDriver(
const std::string& robot_ip,
const std::string& script_file,
const std::string& output_recipe_file,
282 const std::string& input_recipe_file, std::function<
void(
bool)> handle_program_state,
bool headless_mode,
283 std::unique_ptr<ToolCommSetup> tool_comm_setup,
const uint32_t reverse_port,
284 const uint32_t script_sender_port,
int servoj_gain,
double servoj_lookahead_time,
bool non_blocking_read,
285 const std::string& reverse_ip,
const uint32_t trajectory_port,
const uint32_t script_command_port,
286 double force_mode_damping,
double force_mode_gain_scaling = 0.5)
343 [[deprecated(
"Initializing a UrDriver object with an argument list is deprecated. Please use UrDriver(const "
344 "UrDriverConfiguration& config) instead. This function will be removed in May 2027.")]]
345 UrDriver(
const std::string& robot_ip,
const std::string& script_file,
const std::string& output_recipe_file,
346 const std::string& input_recipe_file, std::function<
void(
bool)> handle_program_state,
bool headless_mode,
347 std::unique_ptr<ToolCommSetup> tool_comm_setup,
const std::string& calibration_checksum,
348 const uint32_t reverse_port = 50001,
const uint32_t script_sender_port = 50002,
int servoj_gain = 2000,
349 double servoj_lookahead_time = 0.03,
bool non_blocking_read =
false,
const std::string& reverse_ip =
"",
350 const uint32_t trajectory_port = 50003,
const uint32_t script_command_port = 50004,
351 double force_mode_damping = 0.025,
double force_mode_gain_scaling = 0.5)
407 [[deprecated(
"Initializing a UrDriver object with an argument list is deprecated. Please use UrDriver(const "
408 "UrDriverConfiguration& config) instead. This function will be removed in May 2027.")]]
409 UrDriver(
const std::string& robot_ip,
const std::string& script_file,
const std::string& output_recipe_file,
410 const std::string& input_recipe_file, std::function<
void(
bool)> handle_program_state,
bool headless_mode,
411 const std::string& calibration_checksum =
"",
const uint32_t reverse_port = 50001,
412 const uint32_t script_sender_port = 50002,
int servoj_gain = 2000,
double servoj_lookahead_time = 0.03,
413 bool non_blocking_read =
false,
const std::string& reverse_ip =
"",
const uint32_t trajectory_port = 50003,
414 const uint32_t script_command_port = 50004,
double force_mode_damping = 0.025,
415 double force_mode_gain_scaling = 0.5)
481 const float blend_radius = 0.052);
498 const float goal_time = 0.0,
const float blend_radius = 0.052);
511 const vector6d_t& accelerations,
const float goal_time = 0.0);
523 const float goal_time = 0.0);
632 const unsigned int type,
const vector6d_t& limits,
double damping_factor);
664 const unsigned int type,
const vector6d_t& limits,
double damping_factor,
665 double gain_scaling_factor);
688 [[deprecated(
"Starting force mode without specifying the force mode damping factor and gain scale factor has been "
689 "deprecated. These values should be given with each function call.")]]
bool
691 const unsigned int type,
const vector6d_t& limits);
764 std::deque<urcl::primary_interface::ErrorCode>
getErrorCodes();
813 [[deprecated(
"Set keepaliveCount is deprecated, instead set the robot receive timeout directly in the write "
859 void resetRTDEClient(
const std::vector<std::string>& output_recipe,
const std::vector<std::string>& input_recipe,
860 double target_frequency = 0.0,
bool ignore_unavailable_outputs =
false);
876 void resetRTDEClient(
const std::string& output_recipe_filename,
const std::string& input_recipe_filename,
877 double target_frequency = 0.0,
bool ignore_unavailable_outputs =
false);
949 #endif // ifndef UR_CLIENT_LIBRARY_UR_UR_DRIVER_H_INCLUDED
std::vector< std::string > getRTDEOutputRecipe()
Getter for the RTDE output recipe used in the RTDE client.
UrDriver(const std::string &robot_ip, const std::string &script_file, const std::string &output_recipe_file, const std::string &input_recipe_file, std::function< void(bool)> handle_program_state, bool headless_mode, std::unique_ptr< ToolCommSetup > tool_comm_setup, const std::string &calibration_checksum, const uint32_t reverse_port=50001, const uint32_t script_sender_port=50002, int servoj_gain=2000, double servoj_lookahead_time=0.03, bool non_blocking_read=false, const std::string &reverse_ip="", const uint32_t trajectory_port=50003, const uint32_t script_command_port=50004, double force_mode_damping=0.025, double force_mode_gain_scaling=0.5)
Constructs a new UrDriver object.
ControlMode
Control modes as interpreted from the script runnning on the robot.
std::string output_recipe_file
Filename where the output recipe is stored in.
The RTDEWriter class offers an abstraction layer to send data to the robot via the RTDE interface....
std::unique_ptr< control::TrajectoryPointInterface > trajectory_interface_
std::function< void(bool)> handle_program_state
Function handle to a callback on program state changes.
void resetRTDEClient(const std::vector< std::string > &output_recipe, const std::vector< std::string > &input_recipe, double target_frequency=0.0, bool ignore_unavailable_outputs=false)
Reset the RTDE client. As during initialization the driver will start RTDE communication with the max...
std::string input_recipe_file
Filename where the input recipe is stored in.
void startRTDECommunication()
Starts the RTDE communication.
UrDriver(const std::string &robot_ip, const std::string &script_file, const std::string &output_recipe_file, const std::string &input_recipe_file, std::function< void(bool)> handle_program_state, bool headless_mode, std::unique_ptr< ToolCommSetup > tool_comm_setup, const uint32_t reverse_port, const uint32_t script_sender_port, int servoj_gain, double servoj_lookahead_time, bool non_blocking_read, const std::string &reverse_ip, const uint32_t trajectory_port, const uint32_t script_command_port, double force_mode_damping, double force_mode_gain_scaling=0.5)
Constructs a new UrDriver object.
bool setPayload(const float mass, const vector3d_t &cog)
Set the payload mass and center of gravity. Note: It requires the external control script to be runni...
TrajectoryResult
Types for encoding trajectory execution result.
bool endForceMode()
Stop force mode and put the robot into normal operation mode.
std::string robot_ip
IP-address under which the robot is reachable.
double force_mode_gain_scale_factor_
Structure for configuration parameters of a UrDriver object.
uint32_t trajectory_port
Port used for sending trajectory points to the robot in case of trajectory forwarding.
ToolVoltage
Possible values for the tool voltage.
bool stopControl()
Sends a stop command to the socket interface which will signal the program running on the robot to no...
void registerToolContactResultCallback(std::function< void(control::ToolContactResult)> tool_contact_result_cb)
Register a callback for the robot-based tool contact execution completion.
rtde_interface::RTDEWriter & getRTDEWriter()
Getter for the RTDE writer used to write to the robot's RTDE interface.
UrDriver(const std::string &robot_ip, const std::string &script_file, const std::string &output_recipe_file, const std::string &input_recipe_file, std::function< void(bool)> handle_program_state, bool headless_mode, const std::string &calibration_checksum="", const uint32_t reverse_port=50001, const uint32_t script_sender_port=50002, int servoj_gain=2000, double servoj_lookahead_time=0.03, bool non_blocking_read=false, const std::string &reverse_ip="", const uint32_t trajectory_port=50003, const uint32_t script_command_port=50004, double force_mode_damping=0.025, double force_mode_gain_scaling=0.5)
Constructs a new UrDriver object.
std::unique_ptr< ToolCommSetup > tool_comm_setup
Configuration for using the tool communication.
ToolContactResult
Types for encoding until tool contact execution result.
uint32_t script_command_port
Port used for forwarding script commands to the robot.
bool writeJointCommand(const vector6d_t &values, const comm::ControlMode control_mode, const RobotReceiveTimeout &robot_receive_timeout=RobotReceiveTimeout::millisec(20))
Writes a joint command together with a keepalive signal onto the socket being sent to the robot.
std::array< double, 6 > vector6d_t
virtual ~UrDriver()=default
void setupReverseInterface(const uint32_t reverse_port)
void setKeepaliveCount(const uint32_t count)
Set the Keepalive count. This will set the number of allowed timeout reads on the robot.
std::chrono::milliseconds rtde_initialization_timeout
Time in between initialization attempts of the RTDE interface.
size_t socket_connection_attempts_
bool startForceMode(const vector6d_t &task_frame, const vector6uint32_t &selection_vector, const vector6d_t &wrench, const unsigned int type, const vector6d_t &limits, double damping_factor)
Start the robot to be controlled in force mode.
static RobotReceiveTimeout millisec(const unsigned int milliseconds=20)
Create a RobotReceiveTimeout object with a specific timeout given in milliseconds.
TrajectoryControlMessage
Control messages for forwarding and aborting trajectories.
std::unique_ptr< rtde_interface::DataPackage > getDataPackage()
Access function to receive the latest data package sent from the robot through RTDE interface.
std::array< uint32_t, 6 > vector6uint32_t
bool writeTrajectoryPoint(const vector6d_t &positions, const bool cartesian, const float goal_time=0.0, const float blend_radius=0.052)
Writes a trajectory point onto the dedicated socket.
bool sendScript(const std::string &program)
Sends a custom script program to the robot.
uint32_t reverse_port
Port that will be opened by the driver to allow direct communication between the driver and the robot...
int servoj_gain
Proportional gain for arm joints following target position, range [100,2000].
double servoj_lookahead_time_
std::unique_ptr< control::ReverseInterface > reverse_interface_
std::chrono::milliseconds socket_reconnection_timeout_
Parent class for notifiers.
std::string calibration_checksum
bool isTrajectoryInterfaceConnected() const
bool writeFreedriveControlMessage(const control::FreedriveControlMessage freedrive_action, const RobotReceiveTimeout &robot_receive_timeout=RobotReceiveTimeout::millisec(200))
Writes a control message in freedrive mode.
comm::INotifier notifier_
VersionInformation robot_version_
std::string reverse_ip
IP address that the reverse_port will get bound to.
UrDriver(const UrDriverConfiguration &config)
Constructs a new UrDriver object.
void registerTrajectoryInterfaceDisconnectedCallback(std::function< void(const int)> fun)
void stopPrimaryClientCommunication()
double servoj_lookahead_time
Time [S], range [0.03,0.2] smoothens servoj calls with this lookahead time.
std::unique_ptr< rtde_interface::RTDEClient > rtde_client_
bool writeTrajectorySplinePoint(const vector6d_t &positions, const vector6d_t &velocities, const vector6d_t &accelerations, const float goal_time=0.0)
Writes a trajectory spline point for quintic spline interpolation onto the dedicated socket.
bool writeKeepalive(const RobotReceiveTimeout &robot_receive_timeout=RobotReceiveTimeout::millisec(1000))
Write a keepalive signal only.
bool checkCalibration(const std::string &checksum)
Checks if the kinematics information in the used model fits the actual robot.
size_t rtde_initialization_attempts
Number of attempts to initialize (given a successful socket connection) the RTDE interface.
uint32_t script_sender_port
The driver will offer an interface to receive the program's URScript on this port....
std::function< void(bool)> handle_program_state_
std::deque< urcl::primary_interface::ErrorCode > getErrorCodes()
Retrieves previously raised error codes from PrimaryClient. After calling this, recorded errors will ...
std::unique_ptr< control::ScriptSender > script_sender_
std::chrono::milliseconds socket_reconnection_timeout
Time in between connection attempts to sockets such as the primary or RTDE interface.
std::chrono::milliseconds rtde_initialization_timeout_
std::unique_ptr< control::ScriptCommandInterface > script_command_interface_
UrDriver(const std::string &robot_ip, const std::string &script_file, const std::string &output_recipe_file, const std::string &input_recipe_file, std::function< void(bool)> handle_program_state, bool headless_mode, std::unique_ptr< ToolCommSetup > tool_comm_setup, const uint32_t reverse_port=50001, const uint32_t script_sender_port=50002, int servoj_gain=2000, double servoj_lookahead_time=0.03, bool non_blocking_read=false, const std::string &reverse_ip="", const uint32_t trajectory_port=50003, const uint32_t script_command_port=50004)
Constructs a new UrDriver object.
void registerTrajectoryDoneCallback(std::function< void(control::TrajectoryResult)> trajectory_done_cb)
Register a callback for the robot-based trajectory execution completion.
size_t socket_reconnect_attempts
Number of attempts to reconnect to sockets such as the primary or RTDE interface.
std::string full_robot_program_
bool endToolContact()
This will stop the robot from looking for a tool contact, it will also enable sending move commands t...
uint32_t getControlFrequency() const
bool zeroFTSensor()
Zero the force torque sensor (only availbe on e-Series). Note: It requires the external control scrip...
const VersionInformation & getVersion()
Returns version information about the currently connected robot.
void startPrimaryClientCommunication()
Starts the primary client.
bool headless_mode
Parameter to control if the driver should be started in headless mode.
double force_mode_damping
std::array< double, 3 > vector3d_t
std::shared_ptr< urcl::primary_interface::PrimaryClient > getPrimaryClient()
bool isReverseInterfaceConnected() const
bool startToolContact()
This will make the robot look for tool contact in the tcp directions that the robot is currently movi...
static std::string readScriptFile(const std::string &filename)
double force_mode_gain_scaling
bool writeMotionPrimitive(const std::shared_ptr< control::MotionPrimitive > motion_instruction)
Writes a motion command to the trajectory point interface.
This is the main class for interfacing the driver.
void init(const UrDriverConfiguration &config)
RobotReceiveTimeout class containing a timeout configuration.
bool sendRobotProgram()
Sends the external control program to the robot.
FreedriveControlMessage
Control messages for starting and stopping freedrive mode.
std::shared_ptr< urcl::primary_interface::PrimaryClient > primary_client_
size_t rtde_initialization_attempts_
std::string script_file
URScript file that should be sent to the robot.
bool setToolVoltage(const ToolVoltage voltage)
Set the tool voltage. Note: It requires the external control script to be running or the robot to be ...
bool writeTrajectoryControlMessage(const control::TrajectoryControlMessage trajectory_action, const int point_number=0, const RobotReceiveTimeout &robot_receive_timeout=RobotReceiveTimeout::millisec(200))
Writes a control message in trajectory forward mode.
double force_mode_damping_factor_
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