33 namespace rtde_interface
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<int>(value);
227 uint8_t output_type = 0;
230 success = success &&
package_.
setData(
"standard_analog_output_type", output_type);
231 success = success &&
package_.
setData(
"standard_analog_output_0", value);
232 success = success &&
package_.
setData(
"standard_analog_output_1", value);
258 if (register_id < 64 || register_id > 127)
260 std::stringstream ss;
261 ss <<
"Input bit register goes from 64 to 127. The register id to change is " <<
static_cast<int>(register_id);
267 std::stringstream ss;
268 ss <<
"input_bit_register_" << register_id;
284 if (register_id < 24 || register_id > 47)
286 std::stringstream ss;
287 ss <<
"Input int register goes from 24 to 47. The register id to change is " <<
static_cast<int>(register_id);
293 std::stringstream ss;
294 ss <<
"input_int_register_" << register_id;
310 if (register_id < 24 || register_id > 47)
312 std::stringstream ss;
313 ss <<
"Input double register goes from 24 to 47. The register id to change is " <<
static_cast<int>(register_id);
319 std::stringstream ss;
320 ss <<
"input_double_register_" << register_id;
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...
#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.
The stream is an abstraction of the TCPSocket that offers reading a full UR data package out of the s...
comm::URStream< RTDEPackage > * stream_
std::mutex package_mutex_
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...
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_DEBUG(...)
uint8_t pinToMask(uint8_t pin)
std::vector< std::string > recipe_
void run()
The writer thread loop, continually serializing and sending packages to the robot.
bool sendStandardAnalogOutput(uint8_t output_pin, double value)
Creates a package to request setting a new value for one of the standard analog output pins...
std::thread writer_thread_
bool sendInputBitRegister(uint32_t register_id, bool value)
Creates a package to request setting a new value for an input_bit_register.
bool sendInputDoubleRegister(uint32_t register_id, double value)
Creates a package to request setting a new value for an input_double_register.
The DataPackage class handles communication in the form of RTDE data packages both to and from the ro...
void initEmpty()
Initializes to contained list with empty values based on the recipe.
moodycamel::BlockingReaderWriterQueue< std::unique_ptr< DataPackage > > queue_
bool setData(const std::string &name, T &val)
Set a data field in the DataPackage.
bool sendSpeedSlider(double speed_slider_fraction)
Creates a package to request setting a new value for the speed slider.