### API Method Documentation Example Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/INDEX.md Each API method should include its full C++ signature, parameter table, return type, error codes, and a real-world code example. ```cpp /** * @brief Moves the robot to a specified Cartesian coordinate. * * @param target_pose The target pose (position and orientation) for the robot. * @param speed The speed at which to move. * @return FRRobotError indicating success or failure. * * @details This function commands the robot to move to the given target pose * using the specified speed. Ensure the target pose is reachable * and within the robot's operational limits. * * @code * FRPoses target = {{0.5, 0.2, 0.3}, {0.0, 0.0, 0.0}}; * FRRobotError error = robot.MoveToPose(target, 0.1); * if (error != FRRobotError::Ok) { * std::cerr << "Movement failed: " << error << std::endl; * } * @endcode */ FRRobotError MoveToPose(const FRPoses& target_pose, double speed); ``` -------------------------------- ### Data Type Documentation Example Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/INDEX.md Data types should be defined with a code block, field table, and initialization examples. ```cpp /** * @brief Represents a 3D pose with position and orientation. * * @details Contains position (x, y, z) and orientation (roll, pitch, yaw). * * @struct FRPoses * @param position A FRVector3 representing the Cartesian coordinates. * @param orientation A FRVector3 representing the orientation in Euler angles (roll, pitch, yaw). * * @code * // Initialize a pose * FRPoses pose; * pose.position = {0.1, 0.2, 0.3}; * pose.orientation = {0.0, 0.0, 0.0}; * * // Alternative initialization * FRPoses pose2 = {{0.5, 0.5, 0.5}, {1.57, 0.0, 0.0}}; * @endcode */ typedef struct { FRVector3 position; FRVector3 orientation; } FRPoses; ``` -------------------------------- ### Reference Documentation - Configuration Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Details on SDK configuration options, including network setup, motion parameters, and I/O configuration. ```APIDOC ## Configuration ### Description This section outlines the various configuration options available for the FAIRINO C++ SDK, covering network settings, motion parameters, I/O configuration, and operational constraints. ### Configuration Areas - Network setup. - Motion parameters. - I/O configuration. - Constraints. ``` -------------------------------- ### Core API Reference - Connection & Initialization Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Provides details on RPC setup and controller connection for the FAIRINO C++ SDK. ```APIDOC ## Connection & Initialization ### Description This section covers the Remote Procedure Call (RPC) setup and establishing a connection to the robot controller. ### Topics Covered - RPC setup - Controller connection ``` -------------------------------- ### RobotTime Example Usage Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/types.md Demonstrates how to instantiate and populate a RobotTime structure and convert it to a string representation using the ToString() method. ```cpp RobotTime time; time.year = 2024; time.mouth = 6; time.day = 30; time.hour = 14; time.minute = 30; time.second = 45; time.millisecond = 123; std::string time_str = time.ToString(); // "2024-6-30 14:30:45.123" ``` -------------------------------- ### FRRobot-tool-config.md Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for robot tool configuration methods, including calibration, load configuration, and frame setup. ```APIDOC ## FRRobot Tool Configuration This section covers methods for configuring the robot's end-effector and associated parameters. ### Tool Calibration **Description:** Methods for calibrating the robot's tool. ### Load Configuration **Description:** Methods for setting up the payload and inertia of the tool. ### Frame Setup **Description:** Methods for defining and managing tool coordinate frames. *(... and 20 methods in total)* ``` -------------------------------- ### Instantiate AxleComParam Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/types.md Provides examples for creating an AxleComParam object. Demonstrates initialization with specific RS485 settings and using the default constructor. ```cpp // Standard RS485 configuration: 115200 baud, 8 bits, 1 stop bit, no parity AxleComParam param(7, 8, 1, 0, 100, 3, 50); // Using constructor without parameters AxleComParam default_param; ``` -------------------------------- ### Error Code Documentation Example Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/INDEX.md Error codes should be documented with their name, value, trigger conditions, and handling guidance. ```cpp /** * @brief Indicates that the requested operation timed out. * * @details This error occurs when a command execution exceeds the * predefined timeout limit. Check robot status and network * connectivity. * * @enum FRRobotError::Timeout * @value 5 * * @code * FRRobotError error = robot.ExecuteCommand(cmd, timeout_ms); * if (error == FRRobotError::Timeout) { * std::cerr << "Command timed out. Retrying or checking connection..." << std::endl; * } * @endcode */ Timeout = 5 ``` -------------------------------- ### Set Robot Installation Position Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Configures the robot's mechanical installation position. Use this to inform the system whether the robot is floor-mounted or ceiling/wall-mounted. ```cpp errno_t SetRobotInstallPos(uint8_t install); ``` -------------------------------- ### Teach-by-Demonstration (TBD) in C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Enables manual teaching of robot points by enabling drag teaching mode, recording points, and then computing the tool center point (TCP). Ensure the robot is in manual mode before starting. ```cpp robot.Mode(1); robot.DragTeachSwitch(1); // Move arm freely, then: robot.SetToolPoint(1); robot.SetToolPoint(2); // ... more points robot.ComputeTool(&tcp_pose); robot.DragTeachSwitch(0); ``` -------------------------------- ### SetRobotInstallPos Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Sets the robot's mechanical installation position. This configuration is essential for gravity compensation based on the robot's orientation. ```APIDOC ## SetRobotInstallPos ### Description Sets the robot's mechanical installation position. This configuration is essential for gravity compensation based on the robot's orientation. ### Method ```cpp erro_t SetRobotInstallPos(uint8_t install); ``` ### Parameters #### Path Parameters - **install** (uint8_t) - Required - Installation: 0-floor, 1-ceiling/wall, etc. ### Return Type erro_t (error code) ``` -------------------------------- ### Get SDK Version Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-connection.md Retrieve the version of the C++ SDK. A buffer of at least 64 bytes is required for the version string. ```cpp char version[64]; errno_t ret = robot.GetSDKVersion(version); if (ret == 0) { std::cout << "SDK Version: " << version << std::endl; } ``` -------------------------------- ### SetRobotInstallAngle Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Sets the robot's mechanical installation angles. This is used to specify the robot base frame rotation for gravity compensation. ```APIDOC ## SetRobotInstallAngle ### Description Sets the robot's mechanical installation angles. This is used to specify the robot base frame rotation for gravity compensation. ### Method ```cpp erro_t SetRobotInstallAngle(double yangle, double zangle); ``` ### Parameters #### Path Parameters - **yangle** (double) - Required - Y-axis tilt angle (degrees) - **zangle** (double) - Required - Z-axis rotation angle (degrees) ### Return Type erro_t (error code) ### Example ```cpp // Robot mounted on wall rotated 90 degrees robot.SetRobotInstallAngle(0.0, 90.0); ``` ``` -------------------------------- ### Start Jog Movement Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-motion.md Initiates a manual jog movement for a specific axis or joint. Requires specifying the reference frame, axis/joint number, direction, velocity, acceleration, and maximum distance per click. Velocity and acceleration are percentage-based. ```cpp errno_t StartJOG(uint8_t ref, uint8_t nb, uint8_t dir, float vel, float acc, float max_dis); ``` ```cpp // Jog joint 1 in positive direction at 50% speed errno_t ret = robot.StartJOG(0, 1, 1, 50.0, 100.0, 5.0); ``` -------------------------------- ### Define Recovery Strategies for Specific Errors Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/errors.md Implement specific recovery strategies based on the type of error encountered. This example shows how to attempt a move with a different configuration for inverse kinematics failures or validate parameters for parameter value errors. ```cpp errno_t ret = robot.MoveL(&target, 0, 0, 50.0, 100.0, 100.0, 10.0, 0, &epos, 0, 0, &offset); if (ret == ERR_INVERSE_KINEMATICS_COMPUTE_FAILED) { // Try with different configuration ret = robot.MoveL(&target, 0, 0, 50.0, 100.0, 100.0, 10.0, 0, &epos, 0, 0, &offset, 2); } else if (ret == ERR_PARAM_VALUE) { // Validate parameters std::cerr << "Check motion parameters are within valid ranges" << std::endl; } ``` -------------------------------- ### Real-time Servo Control in C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Implements real-time joint control using servo mode. Starts UDP servo mode, then iteratively calculates and sends target joint positions within a loop, followed by ending the servo mode. A short delay is included for update frequency. ```cpp robot.ServoMoveStart(1); for (int i = 0; i < 100; i++) { JointPos target = calculate_next_position(i); robot.ServoJ(&target, &epos, 0, 0, 0.01, 0, 0); usleep(10000); } robot.ServoMoveEnd(1); ``` -------------------------------- ### Implement Retry Logic with Timeout for RPC Calls Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/errors.md For network-dependent operations like RPC calls, implement retry logic with a timeout to handle transient communication failures. This example retries up to 3 times with a 1-second delay between attempts. ```cpp const int MAX_RETRIES = 3; for (int i = 0; i < MAX_RETRIES; i++) { errno_t ret = robot.RPC("192.168.58.2"); if (ret == 0) break; if (ret == ERR_XMLRPC_COM_FAILED) { std::cerr << "Attempt " << (i+1) << " failed, retrying..." << std::endl; sleep(1); } } ``` -------------------------------- ### Set Tool Coordinate System (SetToolCoord) Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Configures a tool coordinate system using explicit pose data. Use this when the tool's offset from the flange is precisely known. Parameters include tool frame ID, pose, type, installation method, tool ID, and load data index. ```cpp errno_t SetToolCoord(int id, DescPose* coord, int type, int install, int toolID, int loadNum); ``` ```cpp // Set tool 0: 100mm offset in Z from flange DescPose tool_offset(0.0, 0.0, 100.0, 0.0, 0.0, 0.0); errno_t ret = robot.SetToolCoord(0, &tool_offset, 0, 0, -1, 0); ``` -------------------------------- ### Set Robot Installation Angles Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Specifies the robot's mechanical installation angles, particularly for Y-axis tilt and Z-axis rotation. This is essential for precise gravity compensation when the robot is not mounted in the standard floor position. ```cpp errno_t SetRobotInstallAngle(double yangle, double zangle); ``` ```cpp // Robot mounted on wall rotated 90 degrees robot.SetRobotInstallAngle(0.0, 90.0); ``` -------------------------------- ### Initialize Fairino Robot Connection Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Establishes an RPC connection to the robot, sets the mode to auto, enables the robot, and sets the global speed. Handle connection errors by checking the return value. ```cpp FRRobot robot; errno_t ret = robot.RPC("192.168.58.2"); if (ret != 0) { /* handle error */ } robot.Mode(0); // Auto mode robot.RobotEnable(1); // Power on robot.SetSpeed(50); // Global speed 50% ``` -------------------------------- ### Create FRRobot Instance Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-connection.md Instantiate the main robot control interface. This is the first step before establishing communication. ```cpp #include "robot.h" FRRobot robot; ``` -------------------------------- ### Get Default Linear Velocity Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the default linear velocity (TCP speed) of the robot in mm/s. ```cpp errno_t GetDefaultTransVel(float *vel); ``` -------------------------------- ### Typical Robot Initialization Sequence Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/configuration.md Connects to the robot controller, sets it to auto mode, enables servos, configures the tool frame, sets global speed, and closes the connection. Ensure the controller IP address is correct. ```cpp #include "robot.h" #include int main() { FRRobot robot; // 1. Connect to controller errno_t ret = robot.RPC("192.168.58.2"); if (ret != 0) { std::cerr << "Connection failed: " << ret << std::endl; return -1; } // 2. Set robot to auto mode robot.Mode(0); // 3. Enable servos robot.RobotEnable(1); // 4. Set tool frame 0 (TCP offset from flange) DescPose tool_offset(0.0, 0.0, 100.0, 0.0, 0.0, 0.0); robot.SetToolCoord(0, &tool_offset, 0, 0, -1, 0); // 5. Set global speed robot.SetSpeed(50); // 50% speed // 6. Perform motions... // 7. Close connection robot.CloseRPC(); return 0; } ``` -------------------------------- ### Configuration Options Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for configuration parameters available for the FAIRINO C++ SDK. ```APIDOC ## Configuration Options ### Description Details the configuration parameters available for the FAIRINO C++ SDK. ### Parameters (Specific configuration options would be found in configuration.md) ``` -------------------------------- ### Configuration Reference Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for configuring various aspects of the FAIRINO C++ SDK and robot system. ```APIDOC ## Configuration This section details the configuration options for the FAIRINO C++ SDK and robot system. ### configuration.md **Description:** Covers network, motion, I/O, constraint, and system configurations. Provides details on parameter tables, units, ranges, and setup procedures. ``` -------------------------------- ### Fairino C++ SDK File Structure Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Overview of the directory structure for the Fairino C++ SDK, highlighting key header and source files. ```tree libfairino/ ├── src/ │ ├── include/Robot-EN/ │ │ ├── robot.h # Main FRRobot class (5339 lines) │ │ ├── robot_types.h # Data type definitions │ │ ├── robot_error.h # Error codes │ │ └── ... │ ├── src/Robot/ │ │ ├── robot.cpp │ │ ├── robotMotion.cpp │ │ ├── robotIO.cpp │ │ └── ... │ └── ... ├── linux/ │ ├── lib/ # Compiled libraries │ └── include/ └── windows/ ├── lib/ └── include/ ``` -------------------------------- ### Tool Configuration Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for setting up tool and work object coordinate frames, and load weight. ```APIDOC ## SetToolCoord ### Description Set the tool coordinate system. ### Method `errno_t SetToolCoord(...)` ``` ```APIDOC ## SetWObjCoord ### Description Set the world object coordinate system. ### Method `errno_t SetWObjCoord(...)` ``` ```APIDOC ## SetLoadWeight ### Description Set the load weight for the robot. ### Method `errno_t SetLoadWeight(...)` ``` -------------------------------- ### Connection & Initialization Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/INDEX.md Methods for establishing and managing the connection to the robot controller, querying SDK version, and retrieving controller IP. ```APIDOC ## Connection & Initialization ### Description Methods for establishing and managing the connection to the robot controller, querying SDK version, and retrieving controller IP. ### Methods - `FRRobot()`: Constructor - `RPC()`: Connect to robot controller - `CloseRPC()`: Disconnect from robot controller - `GetSDKVersion()`: Query the SDK version - `GetControllerIP()`: Get the IP address of the connected controller ### Key Concepts - Network communication setup - XML-RPC protocol initialization - Default IP: 192.168.58.2 ``` -------------------------------- ### Get Robot System Clock Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the robot's system time in milliseconds. This is useful for timing operations or logging events. ```cpp float system_time; robot.GetSystemClock(&system_time); std::cout << "System time: " << system_time << " ms" << std::endl; ``` -------------------------------- ### Create ExaxisPos Instances Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/types.md Shows how to initialize ExaxisPos objects using their constructors, specifying positions for external axes in millimeters. Default initialization sets all axes to 0.0. ```cpp ExaxisPos ext_axis(0.0, 0.0, 0.0, 0.0); ExaxisPos ext_axis2(100.0, 200.0, 0.0, 0.0); ``` -------------------------------- ### Get Robot Joint Torques Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current torques or forces for each of the 6 joints. The flag indicates blocking or non-blocking mode. ```cpp float torques[6]; errno_t ret = robot.GetJointTorques(0, torques); if (ret == 0) { for (int i = 0; i < 6; i++) { std::cout << "Joint " << (i+1) << " torque: " << torques[i] << " Nm" << std::endl; } } ``` -------------------------------- ### Get Robot Target Payload Weight Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current tool load weight in kilograms. The flag specifies blocking or non-blocking mode. ```cpp float payload_weight; robot.GetTargetPayload(0, &payload_weight); std::cout << "Current load: " << payload_weight << " kg" << std::endl; ``` -------------------------------- ### Create DescPose Instances Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/types.md Demonstrates creating DescPose objects using both the constructor with arguments and by setting individual components after default construction. The position is in mm and orientation in degrees. ```cpp // Create pose with constructor DescPose pose1(400.0, 300.0, 600.0, 0.0, 90.0, 0.0); // Create and set pose component by component DescPose pose2; pose2.tran.x = 500.0; pose2.tran.y = 400.0; pose2.tran.z = 500.0; pose2.rpy.rx = 0.0; pose2.rpy.ry = 45.0; pose2.rpy.rz = 0.0; ``` -------------------------------- ### Get Robot Workpiece Offset Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current workpiece coordinate system (WCS) offset. The flag determines if the operation is blocking or non-blocking. ```cpp DescPose wobj; robot.GetWObjOffset(0, &wobj); ``` -------------------------------- ### Get Robot TCP Offset Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current tool center point (TCP) offset. Use the flag to specify blocking or non-blocking mode. ```cpp DescPose tcp_offset; robot.GetTCPOffset(0, &tcp_offset); std::cout << "TCP offset X: " << tcp_offset.tran.x << " mm" << std::endl; ``` -------------------------------- ### FRRobot-connection.md Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for robot connection methods, including RPC, CloseRPC, GetSDKVersion, and GetControllerIP. ```APIDOC ## FRRobot Connection Methods This section details the methods available for establishing and managing connections with the robot. ### RPC **Description:** Establishes a Remote Procedure Call (RPC) connection to the robot. ### CloseRPC **Description:** Closes the existing RPC connection to the robot. ### GetSDKVersion **Description:** Retrieves the version of the FAIRINO C++ SDK. ### GetControllerIP **Description:** Retrieves the IP address of the robot controller. ``` -------------------------------- ### Get Robot Program State Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-mode-control.md Retrieve the current execution state of the robot program. The state can be stopped, running, or paused. Ensure the state pointer is valid before calling. ```cpp uint8_t prog_state; errno_t ret = robot.GetProgramState(&prog_state); if (ret == 0) { switch (prog_state) { case 1: std::cout << "Program stopped" << std::endl; break; case 2: std::cout << "Program running" << std::endl; break; case 3: std::cout << "Program paused" << std::endl; break; } } ``` -------------------------------- ### FRRobot I/O Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for methods managing robot Input/Output operations. ```APIDOC ## FRRobot I/O Methods ### Description Provides methods for managing robot Input/Output operations, including digital and analog signals. ### Methods - 26 methods for I/O control. ### Parameters (Details for parameters would be found in FRRobot-io.md) ``` -------------------------------- ### I/O Coordination in C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Demonstrates coordinating digital inputs and outputs. Sets a digital output, waits for a specified duration, then waits for a digital input to change state within a timeout, and finally clears the digital output. Ensure correct I/O channel numbers and states are used. ```cpp robot.SetDO(0, 1, 0, 0); robot.WaitMs(100); robot.WaitDI(5, 1, 5000, 0); robot.SetDO(0, 0, 0, 0); ``` -------------------------------- ### GetTCPOffset Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current Tool Center Point (TCP) offset. This method allows you to get the pose of the TCP relative to the robot's base coordinate system. ```APIDOC ## Method: GetTCPOffset ### Description Get current tool center point (TCP) offset. ### Signature ```cpp errno_t GetTCPOffset(uint8_t flag, DescPose *desc_pos); ``` ### Parameters #### Path Parameters * **flag** (uint8_t) - Required - Blocking mode: 0-blocking, 1-non-blocking * **desc_pos** (DescPose*) - Required - Output tool offset pose ### Return Type `errno_t` (error code) ### Example ```cpp DescPose tcp_offset; robot.GetTCPOffset(0, &tcp_offset); std::cout << "TCP offset X: " << tcp_offset.tran.x << " mm" << std::endl; ``` ``` -------------------------------- ### FRRobot-io.md Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for robot Input/Output (I/O) control methods, including digital and analog signals, and configuration functions. ```APIDOC ## FRRobot I/O Control This section details the methods for interacting with the robot's digital and analog I/O. ### SetDO **Description:** Sets the state of a digital output. ### GetDI **Description:** Gets the state of a digital input. ### SetAO **Description:** Sets the value of an analog output. ### GetAI **Description:** Gets the value of an analog input. ### Wait* **Description:** Pauses execution until a specified condition is met (e.g., WaitDI, WaitDO). ### Config functions **Description:** Functions for configuring I/O ports and parameters. *(... and 26 methods in total)* ``` -------------------------------- ### Get Robot Joint Soft Limit Angles Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the software limit angles in degrees for each of the 6 joints. Specify blocking or non-blocking mode using the flag. ```cpp float neg_limits[6], pos_limits[6]; robot.GetJointSoftLimitDeg(0, neg_limits, pos_limits); for (int i = 0; i < 6; i++) { std::cout << "Joint " << (i+1) << ": [" << neg_limits[i] << ", " << pos_limits[i] << "]" << std::endl; } ``` -------------------------------- ### Get Controller IP Address Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-connection.md Retrieve the IP address of the currently connected robot controller. A buffer of at least 32 bytes is required for the IP address string. ```cpp char ip[32]; errno_t ret = robot.GetControllerIP(ip); if (ret == 0) { std::cout << "Controller IP: " << ip << std::endl; } ``` -------------------------------- ### FRRobot Tool Configuration Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for methods related to configuring robot tools and end-effectors. ```APIDOC ## FRRobot Tool Configuration Methods ### Description Provides methods for configuring robot tools and end-effectors, including grippers. ### Methods - Methods for tool configuration. ### Parameters (Details for parameters would be found in FRRobot-tool-config.md) ``` -------------------------------- ### Read End-Effector Analog Input (ToolAI) Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-io.md Reads the analog input from the end-effector. Use this to get sensor data from tools or attachments. The 'block' parameter controls blocking behavior. ```cpp errno_t GetToolAI(int id, uint8_t block, float *result); ``` ```cpp float tool_ai; robot.GetToolAI(0, 0, &tool_ai); ``` -------------------------------- ### FRRobot Constructor Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-connection.md Initializes a new instance of the FRRobot controller interface. ```APIDOC ## FRRobot Constructor ### Description Create a new robot controller interface instance. ### Return Type Instance of FRRobot class ### Example ```cpp #include "robot.h" FRRobot robot; ``` ``` -------------------------------- ### Get Robot Target Payload Center of Gravity Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current tool load center of gravity (COG) in millimeters. Use the flag to select blocking or non-blocking mode. ```cpp DescTran cog; robot.GetTargetPayloadCog(0, &cog); std::cout << "Load COG: (" << cog.x << ", " << cog.y << ", " << cog.z << ")" << std::endl; ``` -------------------------------- ### Get Robot Current Joint Configuration Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-kinematics.md Retrieves the current joint space configuration of the robot. The configuration number indicates elbow-up/down and wrist states, useful for inverse kinematics. ```cpp int current_config; errno_t ret = robot.GetRobotCurJointsConfig(¤t_config); if (ret == 0) { std::cout << "Current joint configuration: " << current_config << std::endl; // Config 0-3: elbow down, Config 4-7: elbow up } ``` -------------------------------- ### FRRobot Connection Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for methods related to establishing and managing robot connections. ```APIDOC ## FRRobot Connection Methods ### Description Provides methods for establishing and managing connections to the robot. ### Methods - `connect` - `disconnect` - `isConnected` - `getErrorMessage` ### Parameters (Details for parameters would be found in FRRobot-connection.md) ``` -------------------------------- ### Create and Initialize JointPos in C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/types.md Demonstrates how to create and initialize a JointPos object using its constructor and by directly assigning values to its members. ```cpp // Create joint position with constructor JointPos pos1(0.0, 45.0, 90.0, 0.0, 45.0, 0.0); // Create and set joint position JointPos pos2; pos2.jPos[0] = 10.0; pos2.jPos[1] = 30.0; pos2.jPos[2] = 60.0; ``` -------------------------------- ### Read Control Box Analog Input (AI) Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-io.md Reads the analog input from the control box. This is used to get sensor readings or feedback from connected devices. The 'block' parameter determines if the read operation is blocking. ```cpp errno_t GetAI(int id, uint8_t block, float *result); ``` ```cpp float ai_value; errno_t ret = robot.GetAI(0, 0, &ai_value); if (ret == 0) { std::cout << "AI0 = " << ai_value << "%" << std::endl; } ``` -------------------------------- ### Core API Reference - Kinematics & Queries Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Documentation for kinematics calculations and robot state queries. ```APIDOC ## Kinematics & Queries ### Description This section provides details on performing forward and inverse kinematics calculations, as well as querying the current state of the robot. ### Features - Forward kinematics. - Inverse kinematics. - State queries. ``` -------------------------------- ### SetToolCoord Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Sets the tool coordinate system using detailed tool parameters. This function allows for precise definition of the tool's position and orientation relative to the robot's flange, along with its type and installation details. ```APIDOC ## SetToolCoord ### Description Set tool coordinate system using tool parameters. ### Method ```cpp erro_t SetToolCoord(int id, DescPose* coord, int type, int install, int toolID, int loadNum); ``` ### Parameters #### Path Parameters - **id** (int) - Required - Tool frame number, range [0~14] - **coord** (DescPose*) - Required - Tool position relative to flange - **type** (int) - Required - 0-tool coordinates, 1-sensor coordinates - **install** (int) - Required - Installation: 0-at robot end, 1-externally mounted - **toolID** (int) - Required - Tool ID (optional, -1 for none) - **loadNum** (int) - Required - Load data index (0~1) ### Request Example ```cpp // Set tool 0: 100mm offset in Z from flange DescPose tool_offset(0.0, 0.0, 100.0, 0.0, 0.0, 0.0); erro_t ret = robot.SetToolCoord(0, &tool_offset, 0, 0, -1, 0); ``` ### Return Type erro_t (error code) ``` -------------------------------- ### FRRobot-kinematics.md Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for robot kinematics methods, including forward/inverse kinematics calculations and state queries. ```APIDOC ## FRRobot Kinematics This section provides details on methods related to robot kinematics. ### Forward Kinematics **Description:** Calculates the end-effector pose based on joint angles. ### Inverse Kinematics **Description:** Calculates the joint angles required to reach a target end-effector pose. ### State Queries **Description:** Methods to query the current state of the robot's kinematics. ### Limits **Description:** Methods related to joint and Cartesian limits. *(... and 17 methods in total)* ``` -------------------------------- ### StartJOG Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-motion.md Initiates a jog (manual point-by-point) movement in a specified coordinate frame. This function allows for fine control over robot movement. ```APIDOC ## Method: StartJOG ### Description Start jogging (manual point-by-point) movement in selected coordinate frame. ### Signature ```cpp erro_t StartJOG(uint8_t ref, uint8_t nb, uint8_t dir, float vel, float acc, float max_dis); ``` ### Parameters #### Path Parameters - **ref** (uint8_t) - Required - Reference frame: 0-joint, 2-base, 4-tool, 8-workpiece - **nb** (uint8_t) - Required - Axis/joint: 1-J1/X, 2-J2/Y, 3-J3/Z, 4-J4/RX, 5-J5/RY, 6-J6/RZ - **dir** (uint8_t) - Required - Direction: 0-negative, 1-positive - **vel** (float) - Required - Velocity percentage, range [0~100] - **acc** (float) - Required - Acceleration percentage, range [0~100] - **max_dis** (float) - Required - Maximum distance per click: degrees for joints, mm for axes ### Return Type erro_t (error code) ### Example ```cpp // Jog joint 1 in positive direction at 50% speed erro_t ret = robot.StartJOG(0, 1, 1, 50.0, 100.0, 5.0); ``` ``` -------------------------------- ### Core API Reference - Tool & Coordinate Config Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Configuration options for tools, coordinate systems, and load parameters. ```APIDOC ## Tool & Coordinate Config ### Description This section details the configuration of the robot's end-effector, including tool center point (TCP) setup, workpiece frames, and load configuration. ### Configuration Options - TCP setup. - Workpiece frames. - Load configuration. ``` -------------------------------- ### Kinematics & State Queries Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/INDEX.md Methods for performing forward and inverse kinematics, querying robot state, and retrieving configuration parameters. ```APIDOC ## Kinematics & State Queries ### Description Methods for performing forward and inverse kinematics, querying robot state, and retrieving configuration parameters. ### Forward/Inverse Kinematics - `GetForwardKin()`: Calculate Cartesian pose from joint angles - `GetInverseKin()`: Calculate joint angles from Cartesian pose - `GetInverseKinRef()`: Calculate joint angles with a reference position - `GetInverseKinHasSolution()`: Check if inverse kinematics has a solution - `GetRobotCurJointConfig()`: Query the current joint configuration ### Position & State Queries - `GetTCPOffset()`: Get the tool center point offset - `GetWObjOffset()`: Get the workpiece frame offset - `GetTargetPayload()`: Get the target load weight - `GetTargetPayloadCog()`: Get the target load center of gravity - `GetJointTorques()`: Get joint forces/torques - `GetJointSoftLimitDeg()`: Get joint angle soft limits in degrees - `GetRobotMotionDone()`: Check if robot motion is completed - `GetSystemClock()`: Get the robot system time - `GetDefaultTransVel()`: Get the default linear velocity ### Key Concepts - Joint configuration space (0-7) - Cartesian vs joint space conversions - Singularity handling - Robot state introspection ``` -------------------------------- ### I/O Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for controlling and querying digital and analog signals. ```APIDOC ## SetDO ### Description Set a digital output signal. ### Method `errno_t SetDO(...)` ``` ```APIDOC ## GetDI ### Description Get the status of a digital input signal. ### Method `errno_t GetDI(...)` ``` ```APIDOC ## SetAO ### Description Set an analog output signal. ### Method `errno_t SetAO(...)` ``` ```APIDOC ## GetAI ### Description Get the value of an analog input signal. ### Method `errno_t GetAI(...)` ``` ```APIDOC ## WaitDI ### Description Wait for a specific digital input state. ### Method `errno_t WaitDI(...)` ``` ```APIDOC ## WaitAI ### Description Wait for an analog input to reach a specific value. ### Method `errno_t WaitAI(...)` ``` -------------------------------- ### Establish Robot Connection via RPC Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-connection.md Connect to the robot controller using its IP address over the XML-RPC protocol. Ensure the controller is online and the IP address is correct. ```cpp FRRobot robot; errno_t ret = robot.RPC("192.168.58.2"); if (ret != 0) { std::cerr << "Failed to connect to robot: " << ret << std::endl; return; } ``` -------------------------------- ### State Query Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for inspecting the current state of the robot. ```APIDOC ## GetTCPOffset ### Description Get the TCP offset configuration. ### Method `errno_t GetTCPOffset(...)` ``` ```APIDOC ## GetWObjOffset ### Description Get the world object offset configuration. ### Method `errno_t GetWObjOffset(...)` ``` ```APIDOC ## GetRobotMotionDone ### Description Check if the robot motion is completed. ### Method `errno_t GetRobotMotionDone(...)` ``` -------------------------------- ### Configure ServoJ Real-time Parameters Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/configuration.md Sets real-time parameters for ServoJ. Recommended cmdT is 0.001 to 0.016 seconds. Gain and filterT are typically disabled. ```cpp errno_t ServoJ(JointPos *joint_pos, ExaxisPos* axisPos, float acc, float vel, float cmdT, float filterT, float gain, int id = 0, int comType = 0); ``` -------------------------------- ### FRRobot-motion.md Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for robot motion control methods, including various movement types like MoveJ, MoveL, MoveC, and more. ```APIDOC ## FRRobot Motion Control This section covers the extensive set of methods for controlling robot motion. ### MoveJ **Description:** Executes a joint-space linear move. ### MoveL **Description:** Executes a Cartesian space linear move. ### MoveC **Description:** Executes a Cartesian space circular move. ### Spline **Description:** Executes a motion along a spline path. ### Servo **Description:** Enables servo control for continuous motion. ### JOG **Description:** Allows for jog (manual) control of the robot. ### Circle **Description:** Defines and executes a circular path. ### Spiral **Description:** Executes a spiral motion path. *(... and 20+ other motion methods)* ``` -------------------------------- ### Core API Reference - Digital/Analog I/O Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Information on controlling digital and analog inputs and outputs. ```APIDOC ## Digital/Analog I/O ### Description This section covers the control and monitoring of digital and analog input/output signals for the robot. ### Capabilities - Digital input/output control. - Analog input/output control. ``` -------------------------------- ### Connection Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for establishing and closing communication with the robot controller. ```APIDOC ## RPC ### Description Connect to the robot controller via IP address. ### Method `errno_t RPC(const char *ip)` ### Parameters * **ip** (const char *) - The IP address of the robot controller. ``` ```APIDOC ## CloseRPC ### Description Disconnect from the robot controller. ### Method `errno_t CloseRPC()` ``` ```APIDOC ## GetSDKVersion ### Description Retrieves the version of the SDK. ### Method `errno_t GetSDKVersion()` ``` -------------------------------- ### Enter/Exit Drag Teaching Mode - C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-mode-control.md Use DragTeachSwitch to enable or disable drag teaching mode. Ensure the robot is in manual mode before enabling drag teaching. State 0 exits, and state 1 enters. ```cpp // First set to manual mode robot.Mode(1); // Enable drag teaching errno_t ret = robot.DragTeachSwitch(1); if (ret == 0) { std::cout << "Drag teaching enabled - move robot arm freely" << std::endl; } // Later disable drag teaching robot.DragTeachSwitch(0); ``` -------------------------------- ### FRRobot Kinematics Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for methods related to robot kinematics calculations. ```APIDOC ## FRRobot Kinematics Methods ### Description Provides methods for performing kinematics calculations, such as forward and inverse kinematics. ### Methods - 17 methods for kinematics. ### Parameters (Details for parameters would be found in FRRobot-kinematics.md) ``` -------------------------------- ### Simple Motion Sequence in C++ Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Executes a sequence of linear movements to predefined poses. Uses `MoveL` for linear motion and `WaitMs` for pauses between movements. Ensure `DescPose` and `ExaxisPos` are correctly defined. ```cpp DescPose pos1(400, 300, 600, 0, 90, 0); DescPose pos2(500, 200, 550, 0, 90, 0); ExaxisPos epos(0, 0, 0, 0); DescPose no_offset(0, 0, 0, 0, 0, 0); robot.MoveL(&pos1, 0, 0, 50, 100, 100, 10, 0, &epos, 0, 0, &no_offset); robot.WaitMs(500); robot.MoveL(&pos2, 0, 0, 50, 100, 100, 10, 0, &epos, 0, 0, &no_offset); ``` -------------------------------- ### Gripper Control Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for configuring and controlling the robot's gripper. ```APIDOC ## SetGripperConfig ### Description Configure the gripper settings. ### Method `errno_t SetGripperConfig(...)` ``` ```APIDOC ## MoveGripper ### Description Command the gripper to move to a specific position. ### Method `errno_t MoveGripper(...)` ``` ```APIDOC ## GetGripperMotionDone ### Description Check if the gripper motion has completed. ### Method `errno_t GetGripperMotionDone(...)` ``` -------------------------------- ### Connect to Robot Controller via IP Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/configuration.md Connect to the robot controller using its IP address. Ensure network connectivity and proper firewall configuration. ```cpp FRRobot robot; nobool_t ret = robot.RPC("192.168.58.2"); // Connect to controller ``` -------------------------------- ### Configure TPD (Trajectory) Parameters Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/configuration.md Sets parameters for trajectory recording. The sampling period is fixed to 2, 4, or 8 ms. DI and DO selection use bitmaps. ```cpp errno_t SetTPDParam(int type, char name[30], int period_ms, uint16_t di_choose, uint16_t do_choose); ``` -------------------------------- ### Configure Gripper Settings Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/configuration.md Sets gripper configuration. Manufacturer ID, device, software version, and bus number are required. Device, softvesion, and bus are usually set to 0. ```cpp errno_t SetGripperConfig(int company, int device, int softvesion, int bus); ``` -------------------------------- ### Compute TCP from Four Calibration Points (ComputeTcp4) Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/api-reference/FRRobot-tool-config.md Calculates the tool center point (TCP) based on the four calibration points acquired using `SetTcp4RefPoint`. The computed TCP pose is returned. ```cpp errno_t ComputeTcp4(DescPose *tcp_pose); ``` -------------------------------- ### Trajectory Playback Methods Source: https://github.com/fair-innovation/fairino-cpp-sdk/blob/main/_autodocs/README.md Methods for loading and playing back recorded trajectories. ```APIDOC ## LoadTPD ### Description Load a recorded trajectory data file. ### Method `errno_t LoadTPD(...)` ``` ```APIDOC ## MoveTPD ### Description Execute a loaded trajectory. ### Method `errno_t MoveTPD(...)` ``` ```APIDOC ## SetTPDParam ### Description Set parameters for trajectory playback. ### Method `errno_t SetTPDParam(...)` ```