Flexiv TDK APIs 1.7
Loading...
Searching...
No Matches
flexiv::tdk::GripperRemoteControl Class Reference

Remote gripper control interface for the TransparentCartesianTeleopWAN teleoperation scenario. When the follower robot has a gripper installed and configured, the operator interacting with the leader robot can control the follower's gripper through this interface. More...

#include <gripper_remote_control.hpp>

Public Member Functions

 GripperRemoteControl (const TransparentCartesianTeleopWAN &teleop, const NetworkCfgPro &network_cfg_pro, bool verbose=true)
 [Blocking] Create an instance using TDK Professional Edition networking via a TDK Server credential file. Standard Edition TCP peer-to-peer is not supported.
bool fault (unsigned int idx) const
 [Non-blocking] Whether the robot of the current role in the specified robot pair is in fault state.
GripperStates states (unsigned int idx)
 [Blocking on leader side] Latest gripper states. On the follower side the states are read directly from the local gripper (non-blocking); on the leader side the latest states received over WAN are returned, and an exception is thrown if no states have been received yet or the received states are stale.
GripperParams params (unsigned int idx)
 [Blocking on leader side] Latest gripper params. Same data source as states().
void Enable (unsigned int idx, const std::string &gripper_name)
 [Blocking] Remotely enable the named gripper on the follower robot, issued via RPC with explicit acknowledgment. The follower will enable its robot first if needed.
void Disable (unsigned int idx)
 [Blocking] Remotely disable the gripper on the follower robot, issued via RPC with explicit acknowledgment.
void Init (unsigned int idx)
 [Blocking] Remotely trigger the initialization of the enabled gripper on the follower robot, issued via RPC with explicit acknowledgment. This step is not needed for grippers that automatically initialize upon power-on.
void EnableLocal (unsigned int idx, const std::string &gripper_name)
 [Blocking] Locally enable the named gripper on the follower robot, so that it becomes remotely controllable without waiting for the leader's Enable RPC. Typically called once at follower startup. Idempotent: if the same gripper is already enabled, this call is a no-op.
void Move (unsigned int idx, double width, double velocity, double force_limit)
 [Non-blocking] Remotely command the follower's gripper to move the fingers with position control. The command is published to the follower on a reliable topic.
void Grasp (unsigned int idx, double force)
 [Non-blocking] Remotely command the follower's gripper to grasp with direct force control. The command is published to the follower on a reliable topic. Requires the enabled gripper to support direct force control.
void Stop (unsigned int idx)
 [Non-blocking] Remotely stop and hold the follower's gripper. The command is published to the follower on a reliable topic.
std::shared_ptr< Robot > instance (unsigned int idx) const
 [Non-blocking] Pointer to the underlying rdk::Robot instance of the current role, shared with the referenced TransparentCartesianTeleopWAN instance.

Detailed Description

Note
This interface reuses the rdk::Robot connection owned by a TransparentCartesianTeleopWAN instance on the same machine (leader side or follower side), no extra RDK client is created. Gripper commands and states are fully decoupled from the robot teleop: the arm teleoperation does NOT need to be initialized or started for the gripper remote control to work.
Motion commands (Move/Grasp/Stop) are published from leader to follower; lifecycle commands (Enable/Disable/Init) are issued from leader to follower via RPC with explicit acknowledgment; gripper states and params are published from follower to leader.
Warning
A robot can have only one enabled gripper, and it must be managed by exactly one rdk::Gripper instance. This interface owns that instance on the follower robot; do NOT create other rdk::Gripper instances or enable/disable grippers through other tools (e.g. Elements) on the follower robot while this interface is in use.
Examples
transparent_cartesian_teleop_wan_pro.cpp.

Definition at line 36 of file gripper_remote_control.hpp.

Constructor & Destructor Documentation

◆ GripperRemoteControl()

flexiv::tdk::GripperRemoteControl::GripperRemoteControl ( const TransparentCartesianTeleopWAN & teleop,
const NetworkCfgPro & network_cfg_pro,
bool verbose = true )
Parameters
[in]teleopTransparentCartesianTeleopWAN instance.
[in]network_cfg_proNetwork configuration containing the path to client.conf.
[in]verboseWhether to print verbose logs.
Exceptions
std::invalid_argumentif the network configuration is invalid or [teleop] has no connected robot pair.
std::runtime_errorif error occurred during construction.
std::logic_errorif the connected robot does not have a TDK professional license.
Warning
The referenced [teleop] instance must be constructed before this interface and must outlive it. This constructor does not wait for the WAN connection with the remote side to be established.

Member Function Documentation

◆ Disable()

void flexiv::tdk::GripperRemoteControl::Disable ( unsigned int idx)
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif the RPC timed out or the follower failed to disable the gripper.
Note
This function blocks until the follower acknowledges the command or the RPC times out.

◆ Enable()

void flexiv::tdk::GripperRemoteControl::Enable ( unsigned int idx,
const std::string & gripper_name )
Parameters
[in]idxIndex of the robot pair.
[in]gripper_nameName of the gripper to enable, as configured in Elements -> Device on the follower robot.
Exceptions
std::invalid_argumentif [idx] is outside the valid range or [gripper_name] is empty.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif the RPC timed out or the follower failed to enable the gripper.
Note
This function blocks until the follower acknowledges the command or the RPC times out.

◆ EnableLocal()

void flexiv::tdk::GripperRemoteControl::EnableLocal ( unsigned int idx,
const std::string & gripper_name )
Parameters
[in]idxIndex of the robot pair.
[in]gripper_nameName of the gripper to enable, as configured in Elements -> Device on the follower robot.
Exceptions
std::invalid_argumentif [idx] is outside the valid range or [gripper_name] is empty.
std::logic_errorif this instance is not initialized as follower robot.
std::runtime_errorif the follower robot cannot be brought to operational state or failed to enable the gripper.
Note
The follower robot will be enabled first if not yet operational.

◆ fault()

bool flexiv::tdk::GripperRemoteControl::fault ( unsigned int idx) const
Parameters
[in]idxIndex of the robot pair. This index is the same as the index of the [robot_pairs_sn] parameter of the TransparentCartesianTeleopWAN constructor.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
Returns
True: robot has fault; false: robot normal.

◆ Grasp()

void flexiv::tdk::GripperRemoteControl::Grasp ( unsigned int idx,
double force )
Parameters
[in]idxIndex of the robot pair.
[in]forceTarget gripping force. Positive: closing force, negative: opening force. Valid range: [GripperParams::min_force, GripperParams::max_force]. Unit: \( [N] \).
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif failed to publish the command to the WAN topic.
Warning
Note the sign convention of [force] is opposite to that of GripperStates::force.

◆ Init()

void flexiv::tdk::GripperRemoteControl::Init ( unsigned int idx)
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif the RPC timed out or the follower failed to trigger the initialization.
Note
This function blocks until the follower acknowledges the command or the RPC times out. The follower does not wait for the initialization sequence to finish.

◆ instance()

std::shared_ptr< Robot > flexiv::tdk::GripperRemoteControl::instance ( unsigned int idx) const
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
Returns
Pointer to rdk::Robot instance.

◆ Move()

void flexiv::tdk::GripperRemoteControl::Move ( unsigned int idx,
double width,
double velocity,
double force_limit )
Parameters
[in]idxIndex of the robot pair.
[in]widthTarget opening width. Valid range: [GripperParams::min_width, GripperParams::max_width]. Unit: \( [m] \).
[in]velocityClosing/opening velocity, cannot be 0. Valid range: [GripperParams::min_vel, GripperParams::max_vel]. Unit: \( [m/s] \).
[in]force_limitMaximum contact force during movement. Valid range: [GripperParams::min_force, GripperParams::max_force]. Unit: \( [N] \).
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif failed to publish the command to the WAN topic.
Note
The command ranges are validated on the follower side against the actual gripper params. Use params() to query the valid ranges beforehand.

◆ params()

GripperParams flexiv::tdk::GripperRemoteControl::params ( unsigned int idx)
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_error(follower) if no gripper is enabled.
std::runtime_error(leader) if no states received yet or the states are stale.
Returns
Latest gripper params: min/max width [m], min/max velocity [m/s], min/max force [N]. Note: on the leader side the [name] field is empty.

◆ states()

GripperStates flexiv::tdk::GripperRemoteControl::states ( unsigned int idx)
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_error(follower) if no gripper is enabled.
std::runtime_error(leader) if no states received yet or the states are stale.
Returns
Latest gripper states: width [m], force [N] (positive: opening force, negative: closing force), is_moving.
Examples
transparent_cartesian_teleop_wan_pro.cpp.

◆ Stop()

void flexiv::tdk::GripperRemoteControl::Stop ( unsigned int idx)
Parameters
[in]idxIndex of the robot pair.
Exceptions
std::invalid_argumentif [idx] is outside the valid range.
std::logic_errorif this instance is not initialized as leader robot.
std::runtime_errorif failed to publish the command to the WAN topic.

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