Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
urcl::control::ReverseInterface Class Reference

The ReverseInterface class handles communication to the robot. It starts a server and waits for the robot to connect via its URCaps program. More...

#include <reverse_interface.h>

Inheritance diagram for urcl::control::ReverseInterface:
Inheritance graph
[legend]

Public Member Functions

 ReverseInterface ()=delete
 
 ReverseInterface (uint32_t port, std::function< void(bool)> handle_program_state)
 Creates a ReverseInterface object including a TCPServer. More...
 
virtual void setKeepaliveCount (const uint32_t &count)
 Set the Keepalive count. This will set the number of allowed timeout reads on the robot. More...
 
virtual bool write (const vector6d_t *positions, const comm::ControlMode control_mode=comm::ControlMode::MODE_IDLE)
 Writes needed information to the robot to be read by the URCaps program. More...
 
bool writeFreedriveControlMessage (const FreedriveControlMessage freedrive_action)
 Writes needed information to the robot to be read by the URScript program. More...
 
bool writeTrajectoryControlMessage (const TrajectoryControlMessage trajectory_action, const int point_number=0)
 Writes needed information to the robot to be read by the URScript program. More...
 
virtual ~ReverseInterface ()=default
 Disconnects possible clients so the reverse interface object can be safely destroyed. More...
 

Static Public Attributes

static const int32_t MULT_JOINTSTATE = 1000000
 

Protected Member Functions

template<typename T >
size_t append (uint8_t *buffer, T &val)
 
virtual void connectionCallback (const int filedescriptor)
 
virtual void disconnectionCallback (const int filedescriptor)
 
virtual void messageCallback (const int filedescriptor, char *buffer, int nbytesrecv)
 

Protected Attributes

int client_fd_
 
std::function< void(bool)> handle_program_state_
 
uint32_t keepalive_count_
 
comm::TCPServer server_
 

Static Protected Attributes

static const int MAX_MESSAGE_LENGTH = 8
 

Detailed Description

The ReverseInterface class handles communication to the robot. It starts a server and waits for the robot to connect via its URCaps program.

Definition at line 68 of file reverse_interface.h.

Constructor & Destructor Documentation

◆ ReverseInterface() [1/2]

urcl::control::ReverseInterface::ReverseInterface ( )
delete

◆ ReverseInterface() [2/2]

urcl::control::ReverseInterface::ReverseInterface ( uint32_t  port,
std::function< void(bool)>  handle_program_state 
)

Creates a ReverseInterface object including a TCPServer.

Parameters
portPort the Server is started on
handle_program_stateFunction handle to a callback on program state changes.

Definition at line 35 of file reverse_interface.cpp.

◆ ~ReverseInterface()

virtual urcl::control::ReverseInterface::~ReverseInterface ( )
virtualdefault

Disconnects possible clients so the reverse interface object can be safely destroyed.

Member Function Documentation

◆ append()

template<typename T >
size_t urcl::control::ReverseInterface::append ( uint8_t *  buffer,
T &  val 
)
inlineprotected

Definition at line 138 of file reverse_interface.h.

◆ connectionCallback()

void urcl::control::ReverseInterface::connectionCallback ( const int  filedescriptor)
protectedvirtual

◆ disconnectionCallback()

void urcl::control::ReverseInterface::disconnectionCallback ( const int  filedescriptor)
protectedvirtual

◆ messageCallback()

void urcl::control::ReverseInterface::messageCallback ( const int  filedescriptor,
char *  buffer,
int  nbytesrecv 
)
protectedvirtual

◆ setKeepaliveCount()

virtual void urcl::control::ReverseInterface::setKeepaliveCount ( const uint32_t &  count)
inlinevirtual

Set the Keepalive count. This will set the number of allowed timeout reads on the robot.

Parameters
countNumber of allowed timeout reads on the robot.

Definition at line 122 of file reverse_interface.h.

◆ write()

bool urcl::control::ReverseInterface::write ( const vector6d_t positions,
const comm::ControlMode  control_mode = comm::ControlMode::MODE_IDLE 
)
virtual

Writes needed information to the robot to be read by the URCaps program.

Parameters
positionsA vector of joint targets for the robot
control_modeControl mode assigned to this command. See documentation of comm::ControlMode for details on possible values.
Returns
True, if the write was performed successfully, false otherwise.

Definition at line 47 of file reverse_interface.cpp.

◆ writeFreedriveControlMessage()

bool urcl::control::ReverseInterface::writeFreedriveControlMessage ( const FreedriveControlMessage  freedrive_action)

Writes needed information to the robot to be read by the URScript program.

Parameters
freedrive_action1 if freedrive mode is to be started, -1 if it should be stopped and 0 to keep it running
Returns
True, if the write was performed successfully, false otherwise.

Definition at line 126 of file reverse_interface.cpp.

◆ writeTrajectoryControlMessage()

bool urcl::control::ReverseInterface::writeTrajectoryControlMessage ( const TrajectoryControlMessage  trajectory_action,
const int  point_number = 0 
)

Writes needed information to the robot to be read by the URScript program.

Parameters
trajectory_action1 if a trajectory is to be started, -1 if it should be stopped
point_numberThe number of points of the trajectory to be executed
Returns
True, if the write was performed successfully, false otherwise.

Definition at line 90 of file reverse_interface.cpp.

Member Data Documentation

◆ client_fd_

int urcl::control::ReverseInterface::client_fd_
protected

Definition at line 134 of file reverse_interface.h.

◆ handle_program_state_

std::function<void(bool)> urcl::control::ReverseInterface::handle_program_state_
protected

Definition at line 147 of file reverse_interface.h.

◆ keepalive_count_

uint32_t urcl::control::ReverseInterface::keepalive_count_
protected

Definition at line 148 of file reverse_interface.h.

◆ MAX_MESSAGE_LENGTH

const int urcl::control::ReverseInterface::MAX_MESSAGE_LENGTH = 8
staticprotected

Definition at line 145 of file reverse_interface.h.

◆ MULT_JOINTSTATE

const int32_t urcl::control::ReverseInterface::MULT_JOINTSTATE = 1000000
static

Definition at line 71 of file reverse_interface.h.

◆ server_

comm::TCPServer urcl::control::ReverseInterface::server_
protected

Definition at line 135 of file reverse_interface.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 Tue Jul 4 2023 02:09:47