Public Member Functions | Private Member Functions | Private Attributes | List of all members
urcl::rtde_interface::RTDEWriter Class Reference

The RTDEWriter class offers an abstraction layer to send data to the robot via the RTDE interface. Several simple to use functions to create data packages to send exist, which are then sent to the robot in an additional thread. More...

#include <rtde_writer.h>

Public Member Functions

void init (uint8_t recipe_id)
 Starts the writer thread, which periodically clears the queue to write packages to the robot. More...
 
 RTDEWriter ()=delete
 
 RTDEWriter (comm::URStream< RTDEPackage > *stream, const std::vector< std::string > &recipe)
 Creates a new RTDEWriter object using a given URStream and recipe. More...
 
void run ()
 The writer thread loop, continually serializing and sending packages to the robot. More...
 
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. More...
 
bool sendInputBitRegister (uint32_t register_id, bool value)
 Creates a package to request setting a new value for an input_bit_register. More...
 
bool sendInputDoubleRegister (uint32_t register_id, double value)
 Creates a package to request setting a new value for an input_double_register. More...
 
bool sendInputIntRegister (uint32_t register_id, int32_t value)
 Creates a package to request setting a new value for an input_int_register. More...
 
bool sendSpeedSlider (double speed_slider_fraction)
 Creates a package to request setting a new value for the speed slider. More...
 
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. More...
 
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. More...
 
bool sendToolDigitalOutput (uint8_t output_pin, bool value)
 Creates a package to request setting a new value for one of the tool output pins. More...
 
 ~RTDEWriter ()
 

Private Member Functions

uint8_t pinToMask (uint8_t pin)
 

Private Attributes

DataPackage package_
 
std::mutex package_mutex_
 
moodycamel::BlockingReaderWriterQueue< std::unique_ptr< DataPackage > > queue_
 
std::vector< std::string > recipe_
 
uint8_t recipe_id_
 
bool running_
 
comm::URStream< RTDEPackage > * stream_
 
std::thread writer_thread_
 

Detailed Description

The RTDEWriter class offers an abstraction layer to send data to the robot via the RTDE interface. Several simple to use functions to create data packages to send exist, which are then sent to the robot in an additional thread.

Definition at line 48 of file rtde_writer.h.

Constructor & Destructor Documentation

urcl::rtde_interface::RTDEWriter::RTDEWriter ( )
delete
urcl::rtde_interface::RTDEWriter::RTDEWriter ( comm::URStream< RTDEPackage > *  stream,
const std::vector< std::string > &  recipe 
)

Creates a new RTDEWriter object using a given URStream and recipe.

Parameters
streamThe URStream to use for communication with the robot
recipeThe recipe to use for communication

Definition at line 34 of file rtde_writer.cpp.

urcl::rtde_interface::RTDEWriter::~RTDEWriter ( )
inline

Definition at line 60 of file rtde_writer.h.

Member Function Documentation

void urcl::rtde_interface::RTDEWriter::init ( uint8_t  recipe_id)

Starts the writer thread, which periodically clears the queue to write packages to the robot.

Parameters
recipe_idThe recipe id to use, so the robot correctly identifies the used recipe

Definition at line 39 of file rtde_writer.cpp.

uint8_t urcl::rtde_interface::RTDEWriter::pinToMask ( uint8_t  pin)
private

Definition at line 196 of file rtde_writer.cpp.

void urcl::rtde_interface::RTDEWriter::run ( )

The writer thread loop, continually serializing and sending packages to the robot.

Definition at line 47 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendConfigurableDigitalOutput ( uint8_t  output_pin,
bool  value 
)

Creates a package to request setting a new value for one of the configurable digital output pins.

Parameters
output_pinThe pin to change
valueThe new value
Returns
Success of the package creation

Definition at line 114 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendInputBitRegister ( uint32_t  register_id,
bool  value 
)

Creates a package to request setting a new value for an input_bit_register.

Parameters
register_idThe id of the register that should be changed [64..127]
valueThe new value
Returns
Success of the package creation

Definition at line 206 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendInputDoubleRegister ( uint32_t  register_id,
double  value 
)

Creates a package to request setting a new value for an input_double_register.

Parameters
register_idThe id of the register that should be changed [24..47]
valueThe new value
Returns
Success of the package creation

Definition at line 242 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendInputIntRegister ( uint32_t  register_id,
int32_t  value 
)

Creates a package to request setting a new value for an input_int_register.

Parameters
register_idThe id of the register that should be changed [24..47]
valueThe new value
Returns
Success of the package creation

Definition at line 224 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendSpeedSlider ( double  speed_slider_fraction)

Creates a package to request setting a new value for the speed slider.

Parameters
speed_slider_fractionThe new speed slider fraction as a value between 0.0 and 1.0
Returns
Success of the package creation

Definition at line 65 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendStandardAnalogOutput ( uint8_t  output_pin,
double  value 
)

Creates a package to request setting a new value for one of the standard analog output pins.

Parameters
output_pinThe pin to change
valueThe new value
Returns
Success of the package creation

Definition at line 172 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendStandardDigitalOutput ( uint8_t  output_pin,
bool  value 
)

Creates a package to request setting a new value for one of the standard digital output pins.

Parameters
output_pinThe pin to change
valueThe new value
Returns
Success of the package creation

Definition at line 85 of file rtde_writer.cpp.

bool urcl::rtde_interface::RTDEWriter::sendToolDigitalOutput ( uint8_t  output_pin,
bool  value 
)

Creates a package to request setting a new value for one of the tool output pins.

Parameters
output_pinThe pin to change
valueThe new value
Returns
Success of the package creation

Definition at line 143 of file rtde_writer.cpp.

Member Data Documentation

DataPackage urcl::rtde_interface::RTDEWriter::package_
private

Definition at line 164 of file rtde_writer.h.

std::mutex urcl::rtde_interface::RTDEWriter::package_mutex_
private

Definition at line 165 of file rtde_writer.h.

moodycamel::BlockingReaderWriterQueue<std::unique_ptr<DataPackage> > urcl::rtde_interface::RTDEWriter::queue_
private

Definition at line 161 of file rtde_writer.h.

std::vector<std::string> urcl::rtde_interface::RTDEWriter::recipe_
private

Definition at line 159 of file rtde_writer.h.

uint8_t urcl::rtde_interface::RTDEWriter::recipe_id_
private

Definition at line 160 of file rtde_writer.h.

bool urcl::rtde_interface::RTDEWriter::running_
private

Definition at line 163 of file rtde_writer.h.

comm::URStream<RTDEPackage>* urcl::rtde_interface::RTDEWriter::stream_
private

Definition at line 158 of file rtde_writer.h.

std::thread urcl::rtde_interface::RTDEWriter::writer_thread_
private

Definition at line 162 of file rtde_writer.h.


The documentation for this class was generated from the following files:


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26