sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas::RobotDriverClient Class Reference

Client interface for robot driver ROS topics. More...

#include <sas_robot_driver_client.hpp>

Inheritance diagram for sas::RobotDriverClient:
sas::Object

Public Types

enum class  MODE_BLACKLIST_FLAG { JOINT_CONTROL =0 , JOINT_MONITORING , WATCHDOG_CONTROL }
 Flags used to blacklist client modes when constructing the client.
 

Public Member Functions

 RobotDriverClient (const RobotDriverClient &)=delete
 
 RobotDriverClient (const std::shared_ptr< Node > &node, const std::string topic_prefix="GET_FROM_NODE", const std::vector< MODE_BLACKLIST_FLAG > &blacklisted_modes=std::vector< MODE_BLACKLIST_FLAG >{})
 Construct a new RobotDriverClient.
 
void send_target_joint_positions (const VectorXd &target_joint_positions)
 Publish target joint positions.
 
void send_target_joint_velocities (const VectorXd &target_joint_velocities)
 Publish target joint velocities.
 
void send_target_joint_forces (const VectorXd &target_joint_forces)
 Publish target joint forces/torques.
 
void send_homing_signal (const VectorXi &homing_signal)
 Send a homing signal to the robot.
 
void send_clear_positions_signal (const VectorXi &clear_positions_signal)
 Send a signal to clear positions on the controller side.
 
void send_watchdog_trigger (const bool &watchdog_trigger_status, const double &period_in_seconds=1.0, const double &maximum_acceptable_delay=0.5)
 Trigger the watchdog from the client.
 
void send_shutdown_signal ()
 Request a shutdown via the robot driver topics.
 
VectorXd get_joint_positions () const
 Get the last received joint positions.
 
VectorXd get_joint_velocities () const
 Get the last received joint velocities.
 
VectorXd get_joint_forces () const
 Get the last received joint forces.
 
std::tuple< VectorXd, VectorXd > get_joint_limits () const
 Retrieve the joint limits as a tuple (min, max).
 
VectorXi get_home_states () const
 Get the last received home states vector.
 
bool is_enabled (const RobotDriver::Functionality &supported_functionality=RobotDriver::Functionality::PositionControl) const
 Check whether the client is enabled for a given functionality.
 
std::string get_topic_prefix () const
 Get the configured topic prefix.
 

Detailed Description

Client interface for robot driver ROS topics.

RobotDriverClient provides helpers to publish target joint commands and control signals, and to subscribe to feedback topics such as joint states, joint limits and home state. It supports optional mode blacklisting to disable certain functionalities from the client side.

Constructor & Destructor Documentation

◆ RobotDriverClient()

sas::RobotDriverClient::RobotDriverClient ( const std::shared_ptr< Node > &  node,
const std::string  topic_prefix = "GET_FROM_NODE",
const std::vector< MODE_BLACKLIST_FLAG > &  blacklisted_modes = std::vector<MODE_BLACKLIST_FLAG>{} 
)

Construct a new RobotDriverClient.

Parameters
nodeShared pointer to the rclcpp::Node used for communication.
topic_prefixTopic prefix used to compose topic/service names. Defaults to "GET_FROM_NODE".
blacklisted_modesOptional list of modes to blacklist/disable on the client side.

Member Function Documentation

◆ get_home_states()

VectorXi sas::RobotDriverClient::get_home_states ( ) const

Get the last received home states vector.

Returns
VectorXi Home states per joint.

◆ get_joint_forces()

VectorXd sas::RobotDriverClient::get_joint_forces ( ) const

Get the last received joint forces.

Returns
VectorXd Joint forces vector.

◆ get_joint_limits()

std::tuple< VectorXd, VectorXd > sas::RobotDriverClient::get_joint_limits ( ) const

Retrieve the joint limits as a tuple (min, max).

Returns
std::tuple<VectorXd, VectorXd> Pair of vectors (min_limits, max_limits).

◆ get_joint_positions()

VectorXd sas::RobotDriverClient::get_joint_positions ( ) const

Get the last received joint positions.

Returns
VectorXd Joint positions vector.

◆ get_joint_velocities()

VectorXd sas::RobotDriverClient::get_joint_velocities ( ) const

Get the last received joint velocities.

Returns
VectorXd Joint velocities vector.

◆ get_topic_prefix()

std::string sas::RobotDriverClient::get_topic_prefix ( ) const

Get the configured topic prefix.

Returns
std::string Topic prefix used by this client.

◆ is_enabled()

bool sas::RobotDriverClient::is_enabled ( const RobotDriver::Functionality supported_functionality = RobotDriver::Functionality::PositionControl) const

Check whether the client is enabled for a given functionality.

Parameters
supported_functionalityThe functionality to check (default: PositionControl).
Returns
true if enabled, false otherwise.

◆ send_clear_positions_signal()

void sas::RobotDriverClient::send_clear_positions_signal ( const VectorXi &  clear_positions_signal)

Send a signal to clear positions on the controller side.

Parameters
clear_positions_signalVector of integers representing clear position commands per joint.

◆ send_homing_signal()

void sas::RobotDriverClient::send_homing_signal ( const VectorXi &  homing_signal)

Send a homing signal to the robot.

Parameters
homing_signalVector of integers representing homing signals per joint.

◆ send_shutdown_signal()

void sas::RobotDriverClient::send_shutdown_signal ( )

Request a shutdown via the robot driver topics.

RobotDriverClient::send_shutdown_signal this method sends a signal to stop the server.

◆ send_target_joint_forces()

void sas::RobotDriverClient::send_target_joint_forces ( const VectorXd &  target_joint_forces)

Publish target joint forces/torques.

Parameters
target_joint_forcesVector containing desired joint forces/torques.

◆ send_target_joint_positions()

void sas::RobotDriverClient::send_target_joint_positions ( const VectorXd &  target_joint_positions)

Publish target joint positions.

Parameters
target_joint_positionsVector containing desired joint positions.

◆ send_target_joint_velocities()

void sas::RobotDriverClient::send_target_joint_velocities ( const VectorXd &  target_joint_velocities)

Publish target joint velocities.

Parameters
target_joint_velocitiesVector containing desired joint velocities.

◆ send_watchdog_trigger()

void sas::RobotDriverClient::send_watchdog_trigger ( const bool &  watchdog_trigger_status,
const double &  period_in_seconds = 1.0,
const double &  maximum_acceptable_delay = 0.5 
)

Trigger the watchdog from the client.

RobotDriverClient::send_watchdog_trigger sends the Watchdog trigger.

Parameters
watchdog_trigger_statustrue keep watchdog alive, false to kill.
period_in_secondsWatchdog period in seconds (default: 1.0).
maximum_acceptable_delayMaximum acceptable delay in seconds for the watchdog (default: 0.5).
watchdog_trigger_statusThe desired status for the Watchdog
period_in_secondsThe desired period in seconds.
maximum_acceptable_delay.The maximum allowed difference between the timepoint sent by the client and the timepoint registered by the server. This delay could be related to unsynchronised clocks between different computers or network delays.

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