staubli_driver_ros2 main
ROS2 control driver for Staubli robots
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
staubli_robot_driver Namespace Reference

Classes

class  DiagnosticDataMessage
 Diagnostic data. More...
 
struct  FrameHeader
 Frame header structure. More...
 
class  Message
 Generic message structure. More...
 
struct  MessageStatus
 Status struct to hold message status information. More...
 
class  MockRobotServer
 Mock robot server to simulate a Staubli robot for testing purposes. More...
 
class  RealTimeSocketInterface
 Bilateral real-time socket interface for pub/sub communication. More...
 
class  RealTimeSocketSubscriber
 Real-time socket subscriber class template. More...
 
class  RobotCommandMessage
 Robot command message. More...
 
class  RobotDriver
 Main interface for controlling Staubli robots. More...
 
class  RobotStateMessage
 Robot state message. More...
 
class  Socket
 Abstract interface for communication with the robot. More...
 
class  SocketFactory
 Factory for creating communication interfaces. More...
 
class  StaubliHardwareInterface
 
class  TCPSocket
 Class for handling bidirectional TCP communication. More...
 
class  TCPSocketFactory
 Factory implementation for TCP communication. More...
 
class  UDPSocket
 Class for handling bidirectional UDP communication. More...
 
class  UDPSocketFactory
 Factory implementation for UDP communication. More...
 

Enumerations

enum class  MessageType : uint8_t { INVALID = 0x00 , ROBOT_STATE = 0x01 , ROBOT_COMMAND = 0x02 , DIAGNOSTIC_DATA = 0x03 }
 Message types for communication. More...
 
enum class  CommandType : uint8_t {
  INVALID = 0x00 , STOP = 0x01 , JOINT_POSITION = 0x02 , JOINT_VELOCITY = 0x03 ,
  JOINT_TORQUE = 0x04 , DECELERATION_JOINT_POSITION = 0x0A , DECELERATION_JOINT_VELOCITY = 0x0B
}
 Command types. More...
 
enum class  OperationMode : uint8_t { UNKNOWN = 0x00 , MANUAL = 0x01 , AUTOMATIC = 0x02 , REMOTE = 0x03 }
 Operation modes. More...
 
enum class  SafetyStatus : uint8_t {
  NO_SAFETY_STOP = 0x00 , WAIT_FOR_RESTART = 0x01 , SS1 = 0x02 , SS2 = 0x03 ,
  WAIT_FOR_WMS = 0x04
}
 Safety status. More...
 
enum class  StatusFlag : uint16_t {
  POWER_ON = 0x0001 , BRAKES_RELEASED = 0x0002 , MOTION_POSSIBLE = 0x0004 , IN_MOTION = 0x0008 ,
  ERROR_STATE = 0x0010 , ESTOP_PRESSED = 0x0020
}
 Status flag (bit masks) More...
 
enum class  ValidFieldFlag : uint16_t {
  JOINT_POSITIONS = 0x0001 , JOINT_VELOCITIES = 0x0002 , JOINT_TORQUES = 0x0004 , FT_SENSOR = 0x0008 ,
  DIGITAL_INPUTS = 0x0010 , ANALOG_INPUTS = 0x0020
}
 Valid fields (bit masks) More...
 

Functions

size_t serialize_type (const uint8_t &value, uint8_t *buffer)
 
size_t serialize_type (const uint16_t &value, uint8_t *buffer)
 
size_t serialize_type (const uint32_t &value, uint8_t *buffer)
 
size_t serialize_type (const float &value, uint8_t *buffer)
 
size_t serialize_type (const double &value, uint8_t *buffer)
 Specialization for double: serialize_type as float to save space.
 
size_t deserialize_type (const uint8_t *buffer, uint8_t &value)
 
size_t deserialize_type (const uint8_t *buffer, uint16_t &value)
 
size_t deserialize_type (const uint8_t *buffer, uint32_t &value)
 
size_t deserialize_type (const uint8_t *buffer, float &value)
 
size_t deserialize_type (const uint8_t *buffer, double &value)
 Specialization for double: deserialize_type from float.
 
template<typename T , std::size_t N>
size_t serialize_array (const std::array< T, N > &arr, uint8_t *buffer)
 Serialize an array of type T into a byte buffer.
 
template<typename T , std::size_t N>
size_t deserialize_array (const uint8_t *buffer, std::array< T, N > &arr)
 Deserialize an array of type T from a byte buffer.
 
bool set_command_stop (RobotCommandMessage &msg)
 
bool set_command_joint_position (RobotCommandMessage &msg, std::vector< double > joint_positions)
 
bool set_command_joint_velocity (RobotCommandMessage &msg, std::vector< double > joint_velocities)
 
bool set_sequence_number (RobotCommandMessage &msg, RobotStateMessage &state)
 
bool prepare_robot_command_message (RobotCommandMessage &msg, RobotStateMessage &state)
 Clear and prepare a RobotCommandMessage.
 

Variables

constexpr uint16_t MAGIC_NUMBER = 0xABCD
 Magic number to identify the protocol.
 
constexpr uint8_t PROTOCOL_VERSION = 1
 Protocol version.
 
constexpr uint16_t DEFAULT_CONTROL_PORT = 8080
 Default port for the control socket.
 
constexpr uint16_t DEFAULT_DIAGNOSTICS_PORT = 8081
 Default port for the diagnostics socket.
 
constexpr size_t MAX_FRAME_SEQUENCE_NUMBER = std::numeric_limits<uint16_t>::max()
 Maximal sequence number before wrap-around.
 
constexpr size_t MAX_SOCKET_PACKET_SIZE = 1024
 Maximum packet size (bytes) for socket communication.
 

Enumeration Type Documentation

◆ MessageType

Message types for communication.

Enumerator
INVALID 
ROBOT_STATE 
ROBOT_COMMAND 
DIAGNOSTIC_DATA 

◆ CommandType

Command types.

Enumerator
INVALID 
STOP 
JOINT_POSITION 
JOINT_VELOCITY 
JOINT_TORQUE 
DECELERATION_JOINT_POSITION 
DECELERATION_JOINT_VELOCITY 

◆ OperationMode

Operation modes.

Enumerator
UNKNOWN 
MANUAL 
AUTOMATIC 
REMOTE 

◆ SafetyStatus

Safety status.

Enumerator
NO_SAFETY_STOP 
WAIT_FOR_RESTART 
SS1 
SS2 
WAIT_FOR_WMS 

◆ StatusFlag

Status flag (bit masks)

Enumerator
POWER_ON 
BRAKES_RELEASED 
MOTION_POSSIBLE 
IN_MOTION 
ERROR_STATE 
ESTOP_PRESSED 

◆ ValidFieldFlag

Valid fields (bit masks)

Enumerator
JOINT_POSITIONS 
JOINT_VELOCITIES 
JOINT_TORQUES 
FT_SENSOR 
DIGITAL_INPUTS 
ANALOG_INPUTS 

Function Documentation

◆ serialize_type() [1/5]

size_t staubli_robot_driver::serialize_type ( const uint8_t value,
uint8_t buffer 
)
inline

◆ serialize_type() [2/5]

size_t staubli_robot_driver::serialize_type ( const uint16_t value,
uint8_t buffer 
)
inline

◆ serialize_type() [3/5]

size_t staubli_robot_driver::serialize_type ( const uint32_t value,
uint8_t buffer 
)
inline

◆ serialize_type() [4/5]

size_t staubli_robot_driver::serialize_type ( const float value,
uint8_t buffer 
)
inline

◆ serialize_type() [5/5]

size_t staubli_robot_driver::serialize_type ( const double value,
uint8_t buffer 
)
inline

Specialization for double: serialize_type as float to save space.

◆ deserialize_type() [1/5]

size_t staubli_robot_driver::deserialize_type ( const uint8_t buffer,
uint8_t value 
)
inline

◆ deserialize_type() [2/5]

size_t staubli_robot_driver::deserialize_type ( const uint8_t buffer,
uint16_t value 
)
inline

◆ deserialize_type() [3/5]

size_t staubli_robot_driver::deserialize_type ( const uint8_t buffer,
uint32_t value 
)
inline

◆ deserialize_type() [4/5]

size_t staubli_robot_driver::deserialize_type ( const uint8_t buffer,
float value 
)
inline

◆ deserialize_type() [5/5]

size_t staubli_robot_driver::deserialize_type ( const uint8_t buffer,
double value 
)
inline

Specialization for double: deserialize_type from float.

◆ serialize_array()

template<typename T , std::size_t N>
size_t staubli_robot_driver::serialize_array ( const std::array< T, N > &  arr,
uint8_t buffer 
)

Serialize an array of type T into a byte buffer.

Warning
The size of the buffer is not checked...
Template Parameters
TUnderlying type of the array elements
NNumber of elements in the array
Parameters
arrArray to serialize
bufferBuffer to write to
Returns
size_t Number of bytes written to the buffer

◆ deserialize_array()

template<typename T , std::size_t N>
size_t staubli_robot_driver::deserialize_array ( const uint8_t buffer,
std::array< T, N > &  arr 
)

Deserialize an array of type T from a byte buffer.

Warning
The size of the buffer is not checked...
Template Parameters
TUnderlying type of the array elements
NNumber of elements in the array
Parameters
bufferBuffer to read from
arrArray to deserialize
Returns
size_t Number of bytes read from the buffer

◆ set_command_stop()

bool staubli_robot_driver::set_command_stop ( RobotCommandMessage msg)

◆ set_command_joint_position()

bool staubli_robot_driver::set_command_joint_position ( RobotCommandMessage msg,
std::vector< double joint_positions 
)

◆ set_command_joint_velocity()

bool staubli_robot_driver::set_command_joint_velocity ( RobotCommandMessage msg,
std::vector< double joint_velocities 
)

◆ set_sequence_number()

bool staubli_robot_driver::set_sequence_number ( RobotCommandMessage msg,
RobotStateMessage state 
)

◆ prepare_robot_command_message()

bool staubli_robot_driver::prepare_robot_command_message ( RobotCommandMessage msg,
RobotStateMessage state 
)

Clear and prepare a RobotCommandMessage.

Parameters
msgMessage to clear
stateLast read robot state (to set sequence number)

Variable Documentation

◆ MAGIC_NUMBER

constexpr uint16_t staubli_robot_driver::MAGIC_NUMBER = 0xABCD
constexpr

Magic number to identify the protocol.

◆ PROTOCOL_VERSION

constexpr uint8_t staubli_robot_driver::PROTOCOL_VERSION = 1
constexpr

Protocol version.

◆ DEFAULT_CONTROL_PORT

constexpr uint16_t staubli_robot_driver::DEFAULT_CONTROL_PORT = 8080
constexpr

Default port for the control socket.

◆ DEFAULT_DIAGNOSTICS_PORT

constexpr uint16_t staubli_robot_driver::DEFAULT_DIAGNOSTICS_PORT = 8081
constexpr

Default port for the diagnostics socket.

◆ MAX_FRAME_SEQUENCE_NUMBER

constexpr size_t staubli_robot_driver::MAX_FRAME_SEQUENCE_NUMBER = std::numeric_limits<uint16_t>::max()
constexpr

Maximal sequence number before wrap-around.

◆ MAX_SOCKET_PACKET_SIZE

constexpr size_t staubli_robot_driver::MAX_SOCKET_PACKET_SIZE = 1024
constexpr

Maximum packet size (bytes) for socket communication.