![]() |
Flexiv RDK APIs
2.1
|
Main interface to control the robot, containing several function categories and background services. More...
#include <robot.hpp>
Public Member Functions | |
| Robot (const std::string &robot_sn, bool verbose=true, bool lite=false) | |
| [Blocking] Instantiate the robot control interface. RDK services will be started and establish connection with the target robot. More... | |
| bool | lite () const |
| [Non-blocking] Whether this rdk::Robot instance is a lite one. More... | |
| bool | connected () const |
| [Non-blocking] Whether the connection with the robot is established. More... | |
| RobotInfo | info () const |
| [Non-blocking] General information about the robot. More... | |
| Mode | mode () const |
| [Non-blocking] Current control mode of the robot. More... | |
| std::map< JointGroup, RobotStates > | states () const |
| [Non-blocking] Current states data of all existing joint groups of the robot. More... | |
| std::map< JointGroup, RobotActions > | actions () const |
| [Non-blocking] Current actions data of all existing joint groups of the robot. More... | |
| std::map< JointGroup, bool > | stopped () const |
| [Non-blocking] Whether specific joint groups of the robot have come to a complete stop. More... | |
| bool | all_stopped () const |
| [Non-blocking] Whether all joint groups of the robot have come to a complete stop. More... | |
| bool | operational () const |
| [Non-blocking] Whether the robot is ready to be operated, which requires the following conditions to be met: enabled, brakes fully released, in auto mode, no fault, and not in reduced state. More... | |
| OperationalStatus | operational_status () const |
| [Non-blocking] Current operational status of the robot. More... | |
| bool | busy () const |
| [Non-blocking] Whether the robot is busy. This includes any user commanded operations that requires the robot to execute. For example, plans, primitives, Cartesian and joint motions, etc. More... | |
| bool | fault () const |
| [Non-blocking] Whether the robot is in fault state. More... | |
| bool | reduced () const |
| [Non-blocking] Whether the robot is in reduced state. More... | |
| bool | recovery () const |
| [Non-blocking] Whether the robot is in recovery state. More... | |
| bool | estop_released () const |
| [Non-blocking] Whether all connected emergency stops (E-stops) are released. More... | |
| bool | enabling_device_on () const |
| [Non-blocking] Whether the 3-position enabling device (e.g. enabling button on the motion bar) is in the ON position (the middle position). More... | |
| bool | reached_timeliness_failure_limit () const |
| [Non-blocking] Whether the timeliness failure limit has been reached within a 1-second moving window. More... | |
| std::vector< RobotEvent > | event_log () const |
| [Non-blocking] Robot events stored since the last successful instantiation of this class. More... | |
| void | ServoOn () |
| [Blocking] Servo on the robot. If E-stop is released and there's no fault, the robot will release brakes, and becomes operational a few seconds later. More... | |
| void | Home (const std::vector< JointGroup > &groups={}) |
| [Blocking] Move the specified joint groups to the home posture using Home primitive. More... | |
| void | Brake (bool engage) |
| [Blocking] Force robot brakes to engage or release during normal operation. Restrictions apply, see warning. More... | |
| void | SwitchMode (Mode mode) |
| [Blocking] Switch the robot to a new control mode and wait for the mode transition to finish. More... | |
| void | Stop () |
| [Blocking] Stop the robot and transit its control mode to IDLE. More... | |
| bool | ClearFault (unsigned int timeout_sec=30) |
| [Blocking] Try to clear minor or critical fault for the robot without a power cycle. More... | |
| void | SetGlobalVariables (const std::map< std::string, FlexivDataTypes > &global_vars) |
| [Blocking] Set values to global variables that already exist in the robot. More... | |
| std::map< std::string, FlexivDataTypes > | global_variables () const |
| [Blocking] Existing global variables and their current values. More... | |
| void | SetTimelinessFailureLimit (double percentage=2.0) |
| [Non-blocking] Set the maximum tolerable percentage of real-time commands that arrived the robot too late within a 1-second moving window. This only applies to the real-time control modes and functions marked as "Real-time (RT)" will throw an exception when this limit is reached. More... | |
| void | ExecutePlan (unsigned int index, bool continue_exec=false, bool block_until_started=true) |
| [Blocking] Execute a plan by specifying its index. More... | |
| void | ExecutePlan (const std::string &name, bool continue_exec=false, bool block_until_started=true) |
| [Blocking] Execute a plan by specifying its name. More... | |
| void | PausePlan (bool toggle) |
| [Blocking] Pause or resume the execution of the current plan. More... | |
| void | StopPlan () |
| [Blocking] Stop the execution of the current plan. More... | |
| std::vector< std::string > | plan_list () const |
| [Blocking] A list of all available plans. More... | |
| PlanInfo | plan_info () const |
| [Blocking] Detailed information about the executing plan. Contains plan name, primitive name, node name, node path, node path time period, etc. More... | |
| void | SetBreakpointMode (bool is_enabled) |
| [Blocking] Enable or disable the breakpoint mode during plan execution. When enabled, the executing plan will pause at the pre-defined breakpoints. Use StepBreakpoint() to continue the execution and pause at the next breakpoint. More... | |
| void | StepBreakpoint () |
| [Blocking] If breakpoint mode is enabled, step to the next breakpoint. The plan execution will continue and pause at the next breakpoint. More... | |
| void | SetVelocityScale (unsigned int velocity_scale) |
| [Blocking] Set overall velocity scale of robot motions during plan and primitive execution. More... | |
| void | ExecutePrimitive (const std::map< JointGroup, PrimitiveArgs > &primitive_args, bool block_until_started=true) |
| [Blocking] Execute primitive(s) on specified joint group(s). More... | |
| std::map< JointGroup, PrimitiveStates > | primitive_states () const |
| [Blocking] States data of the primitive(s) that are currently running. More... | |
| void | StreamJointTorque (const std::map< JointGroup, RtJointTorqueCmd > &cmds) |
| [Non-blocking] Continuously stream joint torque commands of the specified joint group(s) to the robot. The commands are tracked by a high-performance joint torque controller. More... | |
| void | StreamJointPosition (const std::map< JointGroup, RtJointPositionCmd > &cmds) |
| [Non-blocking] Continuously stream joint position, velocity, and acceleration commands of the specified joint group(s) to the robot. The commands are tracked by either the joint impedance controller or the joint position controller, depending on the control mode. More... | |
| void | SendJointPosition (const std::map< JointGroup, NrtJointPositionCmd > &cmds) |
| [Non-blocking] Discretely send joint position and velocity commands of the specified joint group(s) to the robot. An internal motion generator will smoothen the discrete commands, which are then tracked by either the joint impedance controller or the joint position controller, depending on the control mode. More... | |
| void | SetJointImpedance (JointGroup group, const std::vector< double > &K_q, const std::vector< double > &Z_q={}) |
| [Blocking] Set impedance properties of the robot's joint motion controller used in the joint impedance control modes. More... | |
| void | SetMaxContactTorque (JointGroup group, const std::vector< double > &max_torques) |
| [Blocking] Set maximum contact torques for the robot's joint motion controller used in the joint impedance control modes. The controller will regulate its output to maintain contact torques with the environment under the set values. More... | |
| void | SetJointInertiaScale (JointGroup group, const std::vector< double > &inertia_scales) |
| [Blocking] Set inertia shaping scales for the robot's joint motion controller used in the joint impedance control modes. More... | |
| void | StreamCartesianMotionForce (const std::map< JointGroup, RtCartesianCmd > &cmds) |
| [Non-blocking] Continuously stream Cartesian motion and/or force commands of the specified joint group(s) to the robot. The commands are tracked by a unified motion-force controller that allows force control in zero or more Cartesian axes and motion control in the other axes. More... | |
| void | SendCartesianMotionForce (const std::map< JointGroup, NrtCartesianCmd > &cmds) |
| [Non-blocking] Discretely send Cartesian motion and/or force commands of the specified joint group(s) to the robot. An internal motion generator will smoothen the discrete commands, which are then tracked by a unified motion-force controller that allows force control in zero or more Cartesian axes and motion control in the other axes. The robot's internal motion generator will smoothen the discrete commands. More... | |
| void | SendCartesianMotionForceMultiWaypoint (const std::map< JointGroup, NrtCartesianMultiWaypointCmd > &cmds) |
| [Non-blocking] Discretely send Cartesian multi-waypoint motion and/or force commands for the robot to track using non-real-time super primitives. More... | |
| void | SetCartesianImpedance (JointGroup group, const std::array< double, kCartDoF > &K_x, const std::array< double, kCartDoF > &Z_x={0.7, 0.7, 0.7, 0.7, 0.7, 0.7}) |
| [Blocking] Set impedance properties of the robot's Cartesian motion controller used in the Cartesian motion-force control modes. More... | |
| void | SetMaxContactWrench (JointGroup group, const std::array< double, kCartDoF > &max_wrench) |
| [Blocking] Set maximum contact wrench for the motion control part of the Cartesian motion-force control modes. The controller will regulate its output to maintain contact wrench (force and moment) with the environment under the set values. More... | |
| void | SetNullSpacePosture (JointGroup group, const std::vector< double > &ref_positions) |
| [Blocking] Set reference joint positions for the null-space posture control module used in the Cartesian motion-force control modes. More... | |
| void | SetNullSpaceObjectives (JointGroup group, double linear_manipulability=0.0, double angular_manipulability=0.0, double ref_positions_tracking=0.5) |
| [Blocking] Set weights of the three optimization objectives while computing the robot's null-space posture. Change the weights to optimize robot performance for different use cases. More... | |
| void | SetForceControlAxis (JointGroup group, const std::array< bool, kCartDoF > &enabled_axes, const std::array< double, kCartDoF/2 > &max_linear_vel={1.0, 1.0, 1.0}) |
| [Blocking] Set Cartesian axes to enable force control while in the Cartesian motion-force control modes. Axes not enabled for force control will be motion-controlled. More... | |
| void | SetForceControlFrame (JointGroup group, CoordType root_coord, const std::array< double, kPoseSize > &T_in_root={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}) |
| [Blocking] Set reference frame for force control while in the Cartesian motion-force control modes. The force control frame is defined by specifying its transformation with regard to the root coordinate. More... | |
| void | SetPassiveForceControl (JointGroup group, bool is_enabled) |
| [Blocking] Enable or disable passive force control for the Cartesian motion-force control modes. When enabled, an open-loop force controller will be used to feed forward the target wrench, i.e. passive force control. When disabled, a closed-loop force controller will be used to track the target wrench, i.e. active force control. More... | |
| void | SetDigitalOutputs (const std::map< unsigned int, bool > &digital_outputs) |
| [Blocking] Set one or more digital output ports, including 16 on the control box plus 2 inside each wrist connector. More... | |
| std::array< bool, kIOPorts > | digital_inputs () const |
| [Non-blocking] Current reading from all digital input ports, including 16 on the control box plus 2 in each wrist connector. More... | |
| std::array< bool, kIOPorts > | digital_outputs () const |
| [Non-blocking] Current reading from all digital output ports, including 16 on the control box plus 2 in each wrist connector. More... | |
Friends | |
| class | Device |
| class | FileIO |
| class | Gripper |
| class | Maintenance |
| class | Model |
| class | Safety |
| class | Tool |
| class | WorkCoord |
Main interface to control the robot, containing several function categories and background services.
| flexiv::rdk::Robot::Robot | ( | const std::string & | robot_sn, |
| bool | verbose = true, |
||
| bool | lite = false |
||
| ) |
[Blocking] Instantiate the robot control interface. RDK services will be started and establish connection with the target robot.
| [in] | robot_sn | Serial number of the robot to connect. The accepted formats are: "Enlight-L-123456" and "Enlight L-123456". See ProductModel enum for all supported models. |
| [in] | verbose | Enable/disable info and warning prints. |
| [in] | lite | Whether to create a lite instance. See details below. A normal instance must have already connected to the robot for lite instances to function properly. |
| std::invalid_argument | if the format of [robot_sn] is invalid. |
| std::runtime_error | if the initialization sequence failed. |
| std::logic_error | if the connected robot does not have a valid RDK license, or is incompatible with this RDK library version, or is an unsupported product model. |
| std::map<JointGroup, RobotActions> flexiv::rdk::Robot::actions | ( | ) | const |
[Non-blocking] Current actions data of all existing joint groups of the robot.
| bool flexiv::rdk::Robot::all_stopped | ( | ) | const |
[Non-blocking] Whether all joint groups of the robot have come to a complete stop.
| void flexiv::rdk::Robot::Brake | ( | bool | engage | ) |
[Blocking] Force robot brakes to engage or release during normal operation. Restrictions apply, see warning.
| [in] | engage | True: engage brakes; false: release brakes. |
| std::logic_error | if the connected robot is not a medical model or is moving. |
| std::runtime_error | if failed to engage/release the brakes. |
| bool flexiv::rdk::Robot::busy | ( | ) | const |
[Non-blocking] Whether the robot is busy. This includes any user commanded operations that requires the robot to execute. For example, plans, primitives, Cartesian and joint motions, etc.
| bool flexiv::rdk::Robot::ClearFault | ( | unsigned int | timeout_sec = 30 | ) |
[Blocking] Try to clear minor or critical fault for the robot without a power cycle.
| [in] | timeout_sec | Maximum 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. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| bool flexiv::rdk::Robot::connected | ( | ) | const |
[Non-blocking] Whether the connection with the robot is established.
| std::array<bool, kIOPorts> flexiv::rdk::Robot::digital_inputs | ( | ) | const |
[Non-blocking] Current reading from all digital input ports, including 16 on the control box plus 2 in each wrist connector.
| std::array<bool, kIOPorts> flexiv::rdk::Robot::digital_outputs | ( | ) | const |
[Non-blocking] Current reading from all digital output ports, including 16 on the control box plus 2 in each wrist connector.
| bool flexiv::rdk::Robot::enabling_device_on | ( | ) | const |
[Non-blocking] Whether the 3-position enabling device (e.g. enabling button on the motion bar) is in the ON position (the middle position).
| bool flexiv::rdk::Robot::estop_released | ( | ) | const |
[Non-blocking] Whether all connected emergency stops (E-stops) are released.
| std::vector<RobotEvent> flexiv::rdk::Robot::event_log | ( | ) | const |
[Non-blocking] Robot events stored since the last successful instantiation of this class.
| void flexiv::rdk::Robot::ExecutePlan | ( | const std::string & | name, |
| bool | continue_exec = false, |
||
| bool | block_until_started = true |
||
| ) |
[Blocking] Execute a plan by specifying its name.
| [in] | name | Name of the plan to execute, can be obtained via plan_list(). |
| [in] | continue_exec | Whether to continue executing the plan when the RDK program is closed or the connection is lost. |
| [in] | block_until_started | Whether to wait for the commanded plan to finish loading and start execution before the function returns. Depending on the amount of computation needed to get the plan ready, the loading process typically takes no more than 200 ms. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot or the robot is not operational. |
| void flexiv::rdk::Robot::ExecutePlan | ( | unsigned int | index, |
| bool | continue_exec = false, |
||
| bool | block_until_started = true |
||
| ) |
[Blocking] Execute a plan by specifying its index.
| [in] | index | Index of the plan to execute, can be obtained via plan_list(). |
| [in] | continue_exec | Whether to continue executing the plan when the RDK program is closed or the connection is lost. |
| [in] | block_until_started | Whether to wait for the commanded plan to finish loading and start execution before the function returns. Depending on the amount of computation needed to get the plan ready, the loading process typically takes no more than 200 ms. |
| std::invalid_argument | if [index] is outside the valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot or the robot is not operational. |
| void flexiv::rdk::Robot::ExecutePrimitive | ( | const std::map< JointGroup, PrimitiveArgs > & | primitive_args, |
| bool | block_until_started = true |
||
| ) |
[Blocking] Execute primitive(s) on specified joint group(s).
| [in] | primitive_args | Primitive arguments mapped by joint group. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | block_until_started | Whether to wait for the commanded primitive to finish loading and start execution before the function returns. Depending on the amount of computation needed to get the primitive ready, the loading process typically takes no more than 200 ms. |
| std::invalid_argument | if [primitive_args] contains joint groups that are not existing single-arm joint groups in the connected robot. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot or the robot is not operational. |
| bool flexiv::rdk::Robot::fault | ( | ) | const |
[Non-blocking] Whether the robot is in fault state.
| std::map<std::string, FlexivDataTypes> flexiv::rdk::Robot::global_variables | ( | ) | const |
[Blocking] Existing global variables and their current values.
| std::runtime_error | if failed to get a reply from the connected robot. |
| void flexiv::rdk::Robot::Home | ( | const std::vector< JointGroup > & | groups = {} | ) |
[Blocking] Move the specified joint groups to the home posture using Home primitive.
| [in] | groups | Joint group(s) to home. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. If left empty, home all applicable joint groups. |
| std::invalid_argument | if [groups] contains joint groups that are not existing single-arm joint groups in the connected robot. |
| std::runtime_error | if failed to execute the Home primitive. |
| RobotInfo flexiv::rdk::Robot::info | ( | ) | const |
[Non-blocking] General information about the robot.
| bool flexiv::rdk::Robot::lite | ( | ) | const |
[Non-blocking] Whether this rdk::Robot instance is a lite one.
| Mode flexiv::rdk::Robot::mode | ( | ) | const |
[Non-blocking] Current control mode of the robot.
| bool flexiv::rdk::Robot::operational | ( | ) | const |
[Non-blocking] Whether the robot is ready to be operated, which requires the following conditions to be met: enabled, brakes fully released, in auto mode, no fault, and not in reduced state.
| OperationalStatus flexiv::rdk::Robot::operational_status | ( | ) | const |
[Non-blocking] Current operational status of the robot.
| void flexiv::rdk::Robot::PausePlan | ( | bool | toggle | ) |
[Blocking] Pause or resume the execution of the current plan.
| [in] | toggle | True: pause plan; false: resume plan. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| PlanInfo flexiv::rdk::Robot::plan_info | ( | ) | const |
[Blocking] Detailed information about the executing plan. Contains plan name, primitive name, node name, node path, node path time period, etc.
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to get a reply from the connected robot. |
| std::vector<std::string> flexiv::rdk::Robot::plan_list | ( | ) | const |
[Blocking] A list of all available plans.
| std::runtime_error | if failed to get a reply from the connected robot. |
| std::map<JointGroup, PrimitiveStates> flexiv::rdk::Robot::primitive_states | ( | ) | const |
[Blocking] States data of the primitive(s) that are currently running.
| std::runtime_error | if failed to get a reply from the connected robot. |
| bool flexiv::rdk::Robot::reached_timeliness_failure_limit | ( | ) | const |
[Non-blocking] Whether the timeliness failure limit has been reached within a 1-second moving window.
| bool flexiv::rdk::Robot::recovery | ( | ) | const |
[Non-blocking] Whether the robot is in recovery state.
| bool flexiv::rdk::Robot::reduced | ( | ) | const |
[Non-blocking] Whether the robot is in reduced state.
| void flexiv::rdk::Robot::SendCartesianMotionForce | ( | const std::map< JointGroup, NrtCartesianCmd > & | cmds | ) |
[Non-blocking] Discretely send Cartesian motion and/or force commands of the specified joint group(s) to the robot. An internal motion generator will smoothen the discrete commands, which are then tracked by a unified motion-force controller that allows force control in zero or more Cartesian axes and motion control in the other axes. The robot's internal motion generator will smoothen the discrete commands.
| [in] | cmds | Non-real-time Cartesian motion/force commands mapped by joint group. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm joint group in the connected robot, or if any of the last 4 input parameters is not positive. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::SendCartesianMotionForceMultiWaypoint | ( | const std::map< JointGroup, NrtCartesianMultiWaypointCmd > & | cmds | ) |
[Non-blocking] Discretely send Cartesian multi-waypoint motion and/or force commands for the robot to track using non-real-time super primitives.
| [in] | cmds | Non-real-time Cartesian multi-waypoint commands mapped by joint group. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm joint group in the connected robot, or if any waypoint list is empty or any waypoint's last 4 input parameters is not positive. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::SendJointPosition | ( | const std::map< JointGroup, NrtJointPositionCmd > & | cmds | ) |
[Non-blocking] Discretely send joint position and velocity commands of the specified joint group(s) to the robot. An internal motion generator will smoothen the discrete commands, which are then tracked by either the joint impedance controller or the joint position controller, depending on the control mode.
| [in] | cmds | Non-real-time joint position-velocity-acceleration commands mapped by joint group. Only existing single-arm joint groups and external axis joint groups are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm or external axis joint group in the connected robot, if size of any input vector does not match robot DoF, or [dq_max] or [ddq_max] contains any non-positive value. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::ServoOn | ( | ) |
[Blocking] Servo on the robot. If E-stop is released and there's no fault, the robot will release brakes, and becomes operational a few seconds later.
| std::logic_error | if the robot is not connected or E-stop is not released. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetBreakpointMode | ( | bool | is_enabled | ) |
[Blocking] Enable or disable the breakpoint mode during plan execution. When enabled, the executing plan will pause at the pre-defined breakpoints. Use StepBreakpoint() to continue the execution and pause at the next breakpoint.
| [in] | is_enabled | True: enable; false: disable. By default, breakpoint mode is disabled. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetCartesianImpedance | ( | JointGroup | group, |
| const std::array< double, kCartDoF > & | K_x, | ||
| const std::array< double, kCartDoF > & | Z_x = {0.7, 0.7, 0.7, 0.7, 0.7, 0.7} |
||
| ) |
[Blocking] Set impedance properties of the robot's Cartesian motion controller used in the Cartesian motion-force control modes.
| [in] | group | The joint group to set Cartesian impedance for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | K_x | Cartesian motion stiffness: \( K_x \in \mathbb{R}^{6 \times 1} \). Setting motion stiffness of a motion-controlled Cartesian axis to 0 will make this axis free-floating. Consists of \( \mathbb{R}^{3 \times 1} \) linear stiffness and \( \mathbb{R}^{3 \times 1} \) angular stiffness: \( [k_x, k_y, k_z, k_{Rx}, k_{Ry}, k_{Rz}]^T \). Valid range: [0, RobotInfo::K_x_nom]. Unit: \( [N/m]:[Nm/rad] \). |
| [in] | Z_x | Cartesian motion damping ratio: \( Z_x \in \mathbb{R}^{6 \times 1} \). Consists of \( \mathbb{R}^{3 \times 1} \) linear damping ratio and \( \mathbb{R}^{3 \times 1} \) angular damping ratio: \( [\zeta_x, \zeta_y, \zeta_z, \zeta_{Rx}, \zeta_{Ry}, \zeta_{Rz}]^T \). Valid range: [0.3, 0.8]. The nominal (safe) value is provided as default. |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot, or if [K_x] or [Z_x] contains any value outside the valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetDigitalOutputs | ( | const std::map< unsigned int, bool > & | digital_outputs | ) |
[Blocking] Set one or more digital output ports, including 16 on the control box plus 2 inside each wrist connector.
| [in] | digital_outputs | A map of {port_index, port_value}. For [port_index], the valid range is [0, 17]. For [port_value], true: set port high, false: set port low. For example, {{1, true}, {3, false}, {10, true}}. |
| std::invalid_argument | if any provided port index is outside the valid range. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetForceControlAxis | ( | JointGroup | group, |
| const std::array< bool, kCartDoF > & | enabled_axes, | ||
| const std::array< double, kCartDoF/2 > & | max_linear_vel = {1.0, 1.0, 1.0} |
||
| ) |
[Blocking] Set Cartesian axes to enable force control while in the Cartesian motion-force control modes. Axes not enabled for force control will be motion-controlled.
| [in] | group | The joint group to set force control axes for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | enabled_axes | Flags to enable/disable force control for certain Cartesian axes in the force control reference frame (configured by SetForceControlFrame()). The axis order is \( [X, Y, Z, Rx, Ry, Rz] \). |
| [in] | max_linear_vel | For linear Cartesian axes that are enabled for force control, limit the moving velocity to these values as a protection mechanism in case of contact loss. The axis order is \( [X, Y, Z] \). Valid range: [0.005, 2.0]. Unit: \( [m/s] \). |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot, or if [max_linear_vel] contains any value outside the valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetForceControlFrame | ( | JointGroup | group, |
| CoordType | root_coord, | ||
| const std::array< double, kPoseSize > & | T_in_root = {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0} |
||
| ) |
[Blocking] Set reference frame for force control while in the Cartesian motion-force control modes. The force control frame is defined by specifying its transformation with regard to the root coordinate.
| [in] | group | The joint group to set force control frame for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | root_coord | Reference coordinate of [T_in_root]. |
| [in] | T_in_root | Transformation from [root_coord] to the user-defined force control frame: \( ^{root}T_{force} \in \mathbb{R}^{7 \times 1} \). Consists of \( \mathbb{R}^{3 \times 1} \) position and \( \mathbb{R}^{4 \times 1} \) quaternion: \( [x, y, z, q_w, q_x, q_y, q_z]^T \). Unit: \( [m]:[] \). If root coordinate is a fixed one (e.g. WORLD), then the force control frame will also be fixed; if root coordinate is a moving one (e.g. TCP), then the force control frame will also be moving with the root coordinate. An identity transformation is provided as default. |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot, or if [root_coord] is invalid. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetGlobalVariables | ( | const std::map< std::string, FlexivDataTypes > & | global_vars | ) |
[Blocking] Set values to global variables that already exist in the robot.
| [in] | global_vars | A map of {global_var_name, global_var_value(s)}. Use int 1 and 0 to represent booleans. For example, {{"camera_offset", {0.1, -0.2, 0.3}}, {"start_plan", 1}}. |
| std::length_error | if [global_vars] is empty. |
| std::invalid_argument | if any of the specified global variables does not exist. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetJointImpedance | ( | JointGroup | group, |
| const std::vector< double > & | K_q, | ||
| const std::vector< double > & | Z_q = {} |
||
| ) |
[Blocking] Set impedance properties of the robot's joint motion controller used in the joint impedance control modes.
| [in] | group | The joint group to set impedance properties for. Only existing single-arm joint groups and external axis joint groups are accepted. |
| [in] | K_q | Joint motion stiffness: \( K_q \in \mathbb{R}^{n \times 1} \). Setting motion stiffness of a joint axis to 0 will make this axis free-floating. Valid range: [0, RobotInfo::K_q_nom]. Unit: \( [Nm/rad] \). |
| [in] | Z_q | Joint motion damping ratio: \( Z_q \in \mathbb{R}^{n \times 1} \). Valid range: [0.3, 0.8]. The default value 0.7 will be used if left empty. |
| std::invalid_argument | if [group] is not an existing single-arm or external axis joint group in the connected robot, if [K_q] or [Z_q] contains any value outside the valid range, or if size of any input vector does not match robot DoF. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetJointInertiaScale | ( | JointGroup | group, |
| const std::vector< double > & | inertia_scales | ||
| ) |
[Blocking] Set inertia shaping scales for the robot's joint motion controller used in the joint impedance control modes.
| [in] | group | The joint group to set inertia shaping scales for. Only existing single-arm joint groups and external axis joint groups are accepted. |
| [in] | inertia_scales | Inertia shaping scales: \( \sigma_q \in \mathbb{R}^{n \times 1} \). Valid range: [0.75, 1.0]. The nominal (safe) value is 1.0, which means no shaping. |
| std::invalid_argument | if [group] is not an existing single-arm or external axis joint group in the connected robot, if [inertia_scales] contains any value outside the valid range, or if its size does not match robot DoF. |
| std::logic_error | if the robot is not in an applicable control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetMaxContactTorque | ( | JointGroup | group, |
| const std::vector< double > & | max_torques | ||
| ) |
[Blocking] Set maximum contact torques for the robot's joint motion controller used in the joint impedance control modes. The controller will regulate its output to maintain contact torques with the environment under the set values.
| [in] | group | The joint group to set maximum contact torques for. Only existing single-arm joint groups and external axis joint groups are accepted. |
| [in] | max_torques | Maximum contact torques: \( tau_q \in \mathbb{R}^{n \times 1} \). Valid range: [0, RobotInfo::tau_max]. Unit: \( [Nm] \). |
| std::invalid_argument | if [group] is not an existing single-arm or external axis joint group in the connected robot, if [max_torques] contains any value outside the valid range, or if its size does not match robot DoF. |
| std::logic_error | if the robot is not in an applicable control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetMaxContactWrench | ( | JointGroup | group, |
| const std::array< double, kCartDoF > & | max_wrench | ||
| ) |
[Blocking] Set maximum contact wrench for the motion control part of the Cartesian motion-force control modes. The controller will regulate its output to maintain contact wrench (force and moment) with the environment under the set values.
| [in] | group | The joint group to set maximum contact wrench for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | max_wrench | Maximum 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] \). |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot, or if [max_wrench] contains any negative value. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetNullSpaceObjectives | ( | JointGroup | group, |
| double | linear_manipulability = 0.0, |
||
| double | angular_manipulability = 0.0, |
||
| double | ref_positions_tracking = 0.5 |
||
| ) |
[Blocking] Set weights of the three optimization objectives while computing the robot's null-space posture. Change the weights to optimize robot performance for different use cases.
| [in] | group | The joint group to set null-space objectives for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | linear_manipulability | Increase this weight to improve the robot's capability to translate freely in Cartesian space, i.e. a broader range of potential translation movements. Valid range: [0.0, 1.0]. |
| [in] | angular_manipulability | Increase this weight to improve the robot's capability to rotate freely in Cartesian space, i.e. a broader range of potential rotation movements. Valid range: [0.0, 1.0]. |
| [in] | ref_positions_tracking | Increase this weight to make the robot track closer to the reference joint positions specified using SetNullSpacePosture(). Valid range: [0.1, 1.0]. |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot, or if any of the input parameters is outside its valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetNullSpacePosture | ( | JointGroup | group, |
| const std::vector< double > & | ref_positions | ||
| ) |
[Blocking] Set reference joint positions for the null-space posture control module used in the Cartesian motion-force control modes.
| [in] | group | The joint group to set null-space posture for. Only existing single-arm joint groups and external axis joint groups are accepted. |
| [in] | ref_positions | Reference joint positions for the null-space posture control: \( q_{ns} \in \mathbb{R}^{n \times 1} \). Valid range: [RobotInfo::q_min, RobotInfo::q_max]. Unit: \( [rad] \). |
| std::invalid_argument | if [group] is not an existing single-arm or external axis joint group in the connected robot, if [ref_positions] contains any value outside the valid range, or if its size does not match robot DoF. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetPassiveForceControl | ( | JointGroup | group, |
| bool | is_enabled | ||
| ) |
[Blocking] Enable or disable passive force control for the Cartesian motion-force control modes. When enabled, an open-loop force controller will be used to feed forward the target wrench, i.e. passive force control. When disabled, a closed-loop force controller will be used to track the target wrench, i.e. active force control.
| [in] | group | The joint group to toggle passive force control for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| [in] | is_enabled | True: enable; false: disable. By default, passive force control is disabled and active force control is used. |
| std::invalid_argument | if [group] is not an existing single-arm joint group in the connected robot. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::SetTimelinessFailureLimit | ( | double | percentage = 2.0 | ) |
[Non-blocking] Set the maximum tolerable percentage of real-time commands that arrived the robot too late within a 1-second moving window. This only applies to the real-time control modes and functions marked as "Real-time (RT)" will throw an exception when this limit is reached.
| [in] | percentage | Percentage limit, default to 2%. Valid range: [0, 100]. |
| std::invalid_argument | if [percentage] is outside the valid range. |
| void flexiv::rdk::Robot::SetVelocityScale | ( | unsigned int | velocity_scale | ) |
[Blocking] Set overall velocity scale of robot motions during plan and primitive execution.
| [in] | velocity_scale | Percentage scale to adjust the overall velocity of robot motions. Valid range: [0, 100]. Setting to 100 means to move with 100% of specified motion velocity, and 0 means not moving at all. |
| std::invalid_argument | if [velocity_scale] is outside the valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| std::map<JointGroup, RobotStates> flexiv::rdk::Robot::states | ( | ) | const |
[Non-blocking] Current states data of all existing joint groups of the robot.
| void flexiv::rdk::Robot::StepBreakpoint | ( | ) |
[Blocking] If breakpoint mode is enabled, step to the next breakpoint. The plan execution will continue and pause at the next breakpoint.
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::Stop | ( | ) |
[Blocking] Stop the robot and transit its control mode to IDLE.
| std::runtime_error | if failed to stop the robot. |
| std::map<JointGroup, bool> flexiv::rdk::Robot::stopped | ( | ) | const |
[Non-blocking] Whether specific joint groups of the robot have come to a complete stop.
| void flexiv::rdk::Robot::StopPlan | ( | ) |
[Blocking] Stop the execution of the current plan.
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if failed to deliver the request to the connected robot. |
| void flexiv::rdk::Robot::StreamCartesianMotionForce | ( | const std::map< JointGroup, RtCartesianCmd > & | cmds | ) |
[Non-blocking] Continuously stream Cartesian motion and/or force commands of the specified joint group(s) to the robot. The commands are tracked by a unified motion-force controller that allows force control in zero or more Cartesian axes and motion control in the other axes.
| [in] | cmds | Real-time Cartesian motion/force commands mapped by joint group. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm joint group in the connected robot. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::StreamJointPosition | ( | const std::map< JointGroup, RtJointPositionCmd > & | cmds | ) |
[Non-blocking] Continuously stream joint position, velocity, and acceleration commands of the specified joint group(s) to the robot. The commands are tracked by either the joint impedance controller or the joint position controller, depending on the control mode.
| [in] | cmds | Real-time joint position-velocity-acceleration commands mapped by joint group. Only existing single-arm joint groups and external axis joint groups are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm or external axis joint group in the connected robot, or if size of any input vector does not match robot DoF. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::StreamJointTorque | ( | const std::map< JointGroup, RtJointTorqueCmd > & | cmds | ) |
[Non-blocking] Continuously stream joint torque commands of the specified joint group(s) to the robot. The commands are tracked by a high-performance joint torque controller.
| [in] | cmds | Real-time joint torque commands mapped by joint group. Only existing single-arm joint groups and external axis joint groups are accepted. |
| std::invalid_argument | if [cmds] contains a joint group that is not an existing single-arm or external axis joint group in the connected robot, if size of any input vector does not match robot DoF, or [friction_comp_scale] is outside the valid range. |
| std::logic_error | if the robot is not in the correct control mode. |
| std::runtime_error | if the robot is not operational. |
| void flexiv::rdk::Robot::SwitchMode | ( | Mode | mode | ) |
[Blocking] Switch the robot to a new control mode and wait for the mode transition to finish.
| [in] | mode | Control mode to switch to. |
| std::invalid_argument | if the requested mode is invalid or unlicensed. |
| std::logic_error | if robot is in an unknown control mode or is not operational. |
| std::runtime_error | if failed to transit the robot into the specified control mode after several attempts. |