Go to the documentation of this file.
33 namespace rtde_interface
36 : stream_(stream), recipe_(recipe), queue_{ 32 }, running_(
false), package_(recipe_)
53 std::unique_ptr<DataPackage> package;
56 if (
queue_.waitDequeTimed(package, 1000000))
59 size = package->serializePackage(buffer);
60 stream_->write(buffer, size, written);
68 if (speed_slider_fraction > 1.0 || speed_slider_fraction < 0.0)
71 ss <<
"Speed slider fraction should be between 0 and 1. The speed slider fraction is "
72 <<
static_cast<int>(speed_slider_fraction);
81 success = success &&
package_.
setData(
"speed_slider_fraction", speed_slider_fraction);
100 ss <<
"Standard digital output pins goes from 0 to 7. The output pin to change is " <<
static_cast<int>(output_pin);
108 uint8_t digital_output;
111 digital_output = 255;
118 success = success &&
package_.
setData(
"standard_digital_output", digital_output);
136 std::stringstream ss;
137 ss <<
"Configurable digital output pins goes from 0 to 7. The output pin to change is "
138 <<
static_cast<int>(output_pin);
146 uint8_t digital_output;
149 digital_output = 255;
156 success = success &&
package_.
setData(
"configurable_digital_output", digital_output);
174 std::stringstream ss;
175 ss <<
"Tool digital output pins goes from 0 to 1. The output pin to change is " <<
static_cast<int>(output_pin);
183 uint8_t digital_output;
186 digital_output = 255;
193 success = success &&
package_.
setData(
"tool_digital_output", digital_output);
211 std::stringstream ss;
212 ss <<
"Standard analog output goes from 0 to 1. The output pin to change is " <<
static_cast<int>(output_pin);
216 if (value > 1.0 || value < 0.0)
218 std::stringstream ss;
219 ss <<
"Analog output value should be between 0 and 1. The value is " <<
static_cast<double>(value);
231 auto output_type_bits = [](
const uint8_t pin,
const uint8_t type) {
return type << pin; };
232 uint8_t output_type = output_type_bits(output_pin,
toUnderlying(type));
233 success = success &&
package_.
setData(
"standard_analog_output_type", output_type);
235 success = success &&
package_.
setData(
"standard_analog_output_0", value);
236 success = success &&
package_.
setData(
"standard_analog_output_1", value);
262 if (register_id < 64 || register_id > 127)
264 std::stringstream ss;
265 ss <<
"Input bit register goes from 64 to 127. The register id to change is " <<
static_cast<int>(register_id);
271 std::stringstream ss;
272 ss <<
"input_bit_register_" << register_id;
288 if (register_id < 24 || register_id > 47)
290 std::stringstream ss;
291 ss <<
"Input int register goes from 24 to 47. The register id to change is " <<
static_cast<int>(register_id);
297 std::stringstream ss;
298 ss <<
"input_int_register_" << register_id;
314 if (register_id < 24 || register_id > 47)
316 std::stringstream ss;
317 ss <<
"Input double register goes from 24 to 47. The register id to change is " <<
static_cast<int>(register_id);
323 std::stringstream ss;
324 ss <<
"input_double_register_" << register_id;
The stream is an abstraction of the TCPSocket that offers reading a full UR data package out of the s...
uint8_t pinToMask(uint8_t pin)
std::thread writer_thread_
The DataPackage class handles communication in the form of RTDE data packages both to and from the ro...
bool sendSpeedSlider(double speed_slider_fraction)
Creates a package to request setting a new value for the speed slider.
moodycamel::BlockingReaderWriterQueue< std::unique_ptr< DataPackage > > queue_
bool sendToolDigitalOutput(uint8_t output_pin, bool value)
Creates a package to request setting a new value for one of the tool output pins.
#define URCL_LOG_ERROR(...)
bool sendInputIntRegister(uint32_t register_id, int32_t value)
Creates a package to request setting a new value for an input_int_register.
#define URCL_LOG_DEBUG(...)
bool setData(const std::string &name, T &val)
Set a data field in the DataPackage.
bool sendInputDoubleRegister(uint32_t register_id, double value)
Creates a package to request setting a new value for an input_double_register.
bool sendConfigurableDigitalOutput(uint8_t output_pin, bool value)
Creates a package to request setting a new value for one of the configurable digital output pins.
void run()
The writer thread loop, continually serializing and sending packages to the robot.
std::mutex package_mutex_
bool sendStandardDigitalOutput(uint8_t output_pin, bool value)
Creates a package to request setting a new value for one of the standard digital output pins.
void init(uint8_t recipe_id)
Starts the writer thread, which periodically clears the queue to write packages to the robot.
comm::URStream< RTDEPackage > * stream_
constexpr std::underlying_type< E >::type toUnderlying(const E e) noexcept
Converts an enum type to its underlying type.
bool sendStandardAnalogOutput(uint8_t output_pin, double value, const AnalogOutputType type=AnalogOutputType::SET_ON_TEACH_PENDANT)
Creates a package to request setting a new value for one of the standard analog output pins.
bool sendInputBitRegister(uint32_t register_id, bool value)
Creates a package to request setting a new value for an input_bit_register.
void initEmpty()
Initializes to contained list with empty values based on the recipe.
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