Flexiv TDK APIs 2.1
Loading...
Searching...
No Matches
flexiv::tdk::DeviceTeleopLan Class Reference

Teleoperation control interface to use device to teleop one or more robots connected to the same LAN. More...

#include <device_teleop_lan.hpp>

Public Member Functions

 DeviceTeleopLan (const std::vector< std::string > &robot_sn_vec)
 [Blocking] Create an instance of the control interface. More than one pair of [device-robot] can be controlled at the same time, see parameter [robot_sn_vec].
void Init (ZeroFTSensor zero_ft_sensor=ZeroFTSensor::Enable)
 [Blocking] Get all robots ready for teleoperation. The following actions will happen in sequence: a) enable robot,b) clear fault if any, c) zero force/torque sensors.
void Start (const std::vector< std::shared_ptr< MotionControlCmds > > &cmds)
 [Blocking] Start the teleoperation control loop.
void Stop ()
 [Blocking] Stop the teleoperation control loop and make all robots hold their pose.
void SetRobotMaxContactWrench (unsigned int idx, JointGroup group, const std::array< double, kCartDoF > &max_wrench)
 [Non-blocking] Set maximum contact wrench for the specified robot. The controller will regulate its output to maintain contact wrench (force and moment) with the environment under the set values.
void SetNullSpacePostures (unsigned int idx, JointGroup group, const std::vector< double > &ref_positions)
 [Blocking] Set reference joint positions used in the robot's null-space posture control module for the specified robot. Call this only after Start() is triggered.
bool fault (unsigned int idx) const
 [Non-blocking] Fault state of the specified robot.
bool any_fault (void) const
 [Non-blocking] Whether any of the connected robots is in fault state.
std::vector< bool > ClearFault (unsigned int timeout_sec=30)
 [Blocking] Try to clear minor or critical fault of the robot without a power cycle.
const std::array< bool, kIOPorts > digital_inputs (unsigned int idx) const
 [Non-blocking] Current reading from all digital input ports (16 on the control box + 2 inside the wrist connector) of the specified robot.
std::shared_ptr< Robot > instance (unsigned int idx) const
 [Non-blocking] Pointer to the underlying rdk::Robot instances of the robot.

Detailed Description

Definition at line 21 of file device_teleop_lan.hpp.

Constructor & Destructor Documentation

◆ DeviceTeleopLan()

flexiv::tdk::DeviceTeleopLan::DeviceTeleopLan ( const std::vector< std::string > & robot_sn_vec)
Parameters
[in]robot_sn_vecSerial number of all robots to run teleoperation on. Each robot can be bind to an external device. For example, provide 2 robot serial numbers to start a dual-arm teleoperation that involves 2 robots and 2 devices. The accepted format is: "Enlight-L-123456".
Exceptions
std::invalid_argumentif the format of any element in [robot_sn_vec] is invalid.
std::runtime_errorif error occurred during construction.
std::logic_errorif one of the connected robots does not have a valid TDK license; or the version of this TDK library is incompatible with one of the connected robots; or model of any connected robot is not supported.
Warning
This constructor blocks until the initialization sequence is successfully finished and connection with all robots is established.

Member Function Documentation

◆ any_fault()

bool flexiv::tdk::DeviceTeleopLan::any_fault ( void ) const
Returns
True: at least one robot has fault; false: none has fault.

◆ ClearFault()

std::vector< bool > flexiv::tdk::DeviceTeleopLan::ClearFault ( unsigned int timeout_sec = 30)
Parameters
[in]timeout_secMaximum time in seconds to wait for the fault to be successfully cleared. Normally, a minor fault should take no more than 3 seconds to clear, and a critical fault should take no more than 30 seconds to clear.
Returns
True: successfully cleared fault; false: failed to clear fault.
For each element in the pair vector, true: successfully cleared fault or no fault for this robot, false: failed to clear fault for this robot. The pattern of the pair vector is the same as the constructor parameter [robot_sn_vec].
Exceptions
std::runtime_errorif failed to deliver the request to the connected robot.
Note
This function blocks until the fault is successfully cleared or [timeout_sec] has elapsed.
Warning
Clearing a critical fault through this function without a power cycle requires a dedicated device, which may not be installed in older robot models.

◆ digital_inputs()

const std::array< bool, kIOPorts > flexiv::tdk::DeviceTeleopLan::digital_inputs ( unsigned int idx) const
Parameters
[in]idxIndex of the robot to read from. This index is the same as the index of the constructor parameter [robot_sn_vec].
Returns
A pair of boolean arrays whose index corresponds to that of the digital input ports of the corresponding robot in the pair. True: port high; false: port low.
Exceptions
std::invalid_argumentif [idx] exceeds total number of robots.

◆ fault()

bool flexiv::tdk::DeviceTeleopLan::fault ( unsigned int idx) const
Parameters
[in]idxIndex of the robot to get fault state for. This index is the same as the index of the constructor parameter [robot_sn_vec].
Returns
Fault state of the robot respectively in the robot vector. True: has fault; false: no fault.
Exceptions
std::invalid_argumentif [idx] exceeds total number of robots.

◆ Init()

void flexiv::tdk::DeviceTeleopLan::Init ( ZeroFTSensor zero_ft_sensor = ZeroFTSensor::Enable)
Parameters
[in]zero_ft_sensorWhether to calibrate force/torque sensor.
Exceptions
std::runtime_errorif the initialization sequence failed.
Note
This function blocks until the initialization sequence is finished.
Warning
This process involves sensor zeroing, please make sure the robot is not in contact with anything during the process.

◆ instance()

std::shared_ptr< Robot > flexiv::tdk::DeviceTeleopLan::instance ( unsigned int idx) const
Parameters
[in]idxIndex of the robot pair to get states for. This index is the same as the index of the constructor parameter [robot_sn_vec].
Returns
Pointer to rdk::Robot instances.

◆ SetNullSpacePostures()

void flexiv::tdk::DeviceTeleopLan::SetNullSpacePostures ( unsigned int idx,
JointGroup group,
const std::vector< double > & ref_positions )
Parameters
[in]idxIndex of the robot to set null-space posture for. This index is the same as the index of the constructor parameter [robot_pairs_sn].
[in]groupJoint group of the robot to set null-space posture for.
[in]ref_positionsReference joint positions for the null-space posture control of robot: \( q_{ns} \in \mathbb{R}^{n \times 1} \). Unit: \( [rad] \).
Exceptions
std::invalid_argumentif [idx] exceeds total number of robots.
std::invalid_argumentif [ref_positions] contains any value outside joint limits or size of input vector does not match robot DoF.
std::logic_errorif the teleoperation control loop is not started.
std::runtime_errorif failed to deliver the request to the connected robots.
Note
This function blocks until the request is successfully delivered.
Null-space posture control
Similar to human arm, a robotic arm with redundant joint-space degree(s) of freedom (DoF > 6) can change its overall posture without affecting the ongoing primary task. This is achieved through a technique called "null-space control". After the reference joint positions of a desired robot posture are set using this function, the robot's null-space control module will try to pull the arm as close to this posture as possible without affecting the primary Cartesian motion-force control task.

◆ SetRobotMaxContactWrench()

void flexiv::tdk::DeviceTeleopLan::SetRobotMaxContactWrench ( unsigned int idx,
JointGroup group,
const std::array< double, kCartDoF > & max_wrench )
Parameters
[in]idxIndex of the robot to read from. This index is the same as the index of the constructor parameter [robot_sn_vec].
[in]groupJoint group of the robot to set maximum contact wrench for.
[in]max_wrenchMaximum contact wrench (force and moment): \( F_max \in \mathbb{R}^{6 \times 1} \). Consists of \( \mathbb{R}^{3 \times 1} \) maximum force and \(\mathbb{R}^{3 \times 1} \) maximum moment: \( [f_x, f_y, f_z, m_x, m_y, m_z]^T \). Unit: \( [N]~[Nm] \).
Exceptions
std::invalid_argumentif [max_wrench] contains any negative value.
std::logic_errorif teleop is not initialized.

◆ Start()

void flexiv::tdk::DeviceTeleopLan::Start ( const std::vector< std::shared_ptr< MotionControlCmds > > & cmds)
Parameters
[in]cmdsMotion control commands data for all robots. The size of the vector should match with the robot_sn_vec.
Exceptions
std::runtime_errorif failed to start the teleoperation control loop.
std::logic_errorif initialization sequence hasn't been triggered yet using Init().
std::logic_errorif size of cmds failed to match with the [robot_sn_vec].
Note
This function blocks until the control loop has started running. The user might need to implement further blocking after this function returns.

◆ Stop()

void flexiv::tdk::DeviceTeleopLan::Stop ( )
Exceptions
std::runtime_errorif failed to stop the teleoperation control loop.
Note
This function blocks until the control loop has stopped running and all robots in hold.

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