### Get Gripper Teaching Pendant Parameters Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Example of querying and printing the teaching pendant parameters. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.AGX_GRIPPER) robot.connect() param = end_effector.get_gripper_teaching_pendant_param() if param is not None: print( param.msg.teaching_range_per, param.msg.max_range_config, param.msg.teaching_friction, ) print(param.hz, param.timestamp) ``` -------------------------------- ### Install Dependencies and SDK Source: https://github.com/agilexrobotics/pyagxarm/blob/master/README.md Install the required python-can library and the pyAgxArm package from source. ```shell pip3 install python-can ``` ```shell git clone https://github.com/agilexrobotics/pyAgxArm.git cd pyAgxArm pip3 install . ``` -------------------------------- ### Get Gripper Control States Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Example of connecting to the robot and reading the current gripper state. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.AGX_GRIPPER) robot.connect() gcs = end_effector.get_gripper_ctrl_states() if gcs is not None: print("width(m)=", gcs.msg.width, "force(N)=", gcs.msg.force) print("status_code=", gcs.msg.status_code, "set_zero=", gcs.msg.set_zero) print("hz=", gcs.hz, "timestamp=", gcs.timestamp) ``` -------------------------------- ### Install CAN Tools Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/can_user.md Install the necessary utilities for CAN module configuration. ```shell sudo apt update && sudo apt install can-utils ethtool ``` -------------------------------- ### Connect to Robot and Start Data Reading Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Establishes a connection to the robot and optionally starts the data reading thread. The data reading thread is started by default. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.AGX_GRIPPER) robot.connect() ``` -------------------------------- ### Calibrate Joint Usage Example Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Example demonstrating how to disable a joint, manually position it, and trigger the calibration process. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() joint_index = 1 robot.disable(joint_index) time.sleep(0.2) input("请手动将关节移动到零位位置后按回车继续...") if robot.calibrate_joint(joint_index): print("calibrate_joint success") ``` -------------------------------- ### Arc Motion move_c() Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Example of configuring the arm and executing an arc move using start, midpoint, and end poses. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.set_speed_percent(100) sp = [0.2, 0.0, 0.3, 0.0, 1.5708, 0.0] mp = [0.2, 0.05, 0.35, 0.0, 1.5708, 0.0] ep = [0.2, 0.0, 0.4, 0.0, 1.5708, 0.0] robot.move_c(sp, mp, ep) # 等待运动结束(带 5s 超时) time.sleep(0.5) start_t = time.monotonic() while True: status = robot.get_arm_status() if status is not None and status.msg.motion_status == 0: print("已到达目标位置") break if time.monotonic() - start_t > 5.0: print("等待运动结束超时(5s)") break time.sleep(0.1) ``` -------------------------------- ### Connect - connect() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Establishes the connection and starts the data reading thread. ```APIDOC ## Connect — `connect()` ### Description Establish the connection and start the data reading thread. ### Method Signature ```python connect(self, start_read_thread: bool = True) -> None ``` ### Parameters #### Optional Parameters - **start_read_thread** (bool) - Whether to start the data reading thread, default `True` ### Usage Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() ``` ``` -------------------------------- ### Connect to Robotic Arm and Start Reading Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Establishes a connection to the robotic arm and starts the data reading thread. The `start_read_thread` parameter defaults to True. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() # start_read_thread=True by default ``` -------------------------------- ### POST /connect Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Establishes the connection to the hardware and optionally starts the data reading thread. ```APIDOC ## POST connect ### Description Creates the connection and starts the data reading thread. ### Method POST ### Parameters #### Request Body - **start_read_thread** (bool) - Optional - Whether to start the data reading thread, default True ### Request Example { "start_read_thread": true } ``` -------------------------------- ### Execute Arc Motion with Start, Midpoint, and End Poses Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Utilize `move_c` for arc movements, specifying start, midpoint, and end poses. Robot must be enabled and speed configured. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.set_speed_percent(100) sp = [0.2, 0.0, 0.3, 0.0, 1.5708, 0.0] mp = [0.2, 0.05, 0.35, 0.0, 1.5708, 0.0] ep = [0.2, 0.0, 0.4, 0.0, 1.5708, 0.0] robot.move_c(sp, mp, ep) ``` -------------------------------- ### Move Gripper Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Example of moving the gripper to specific width and force settings. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.AGX_GRIPPER) robot.connect() # 张开到 5cm,力 1N end_effector.move_gripper(width=0.05, force=1.0) time.sleep(1.0) # 闭合(宽度 0) end_effector.move_gripper(width=0.0, force=1.0) ``` -------------------------------- ### Set Installation Position Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Configures the installation position of the robotic arm. This is used to define the arm's mounting orientation. ```APIDOC ## POST /set_installation_pos ### Description Sets the installation position of the robotic arm. This configuration is crucial for defining the arm's mounting orientation. ### Method POST ### Endpoint /set_installation_pos ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **position** (string) - Required - The installation position. Accepted values are typically predefined constants like 'HORIZONTAL', 'VERTICAL', etc. ### Request Example ```json { "position": "HORIZONTAL" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Set Installation Position Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Sets the installation position of the robotic arm. Supports horizontal, left-facing, and right-facing orientations. ```APIDOC ## POST /set_installation_pos ### Description Sets the installation position of the robotic arm. Supports horizontal, left-facing, and right-facing orientations. ### Method POST ### Endpoint /set_installation_pos ### Parameters #### Query Parameters - **pos** (string) - Optional - Installation orientation, valid values: 'horizontal' / 'left' / 'right', default: 'horizontal' ### Request Example ```json { "pos": "horizontal" } ``` ### Response #### Success Response (200) - **None** (None) - No specific return value, indicates success. #### Response Example ```json null ``` ``` -------------------------------- ### Execute Point-to-Point Motion Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Example of moving the arm to a target pose and monitoring completion status. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.set_speed_percent(100) robot.move_p([-0.4, -0.0, 0.4, 1.5708, 0.0, 0.0]) # Wait for motion to finish (with 5s timeout) time.sleep(0.5) start_t = time.monotonic() while True: status = robot.get_arm_status() if status is not None and status.msg.motion_status == 0: print("Reached target position") break if time.monotonic() - start_t > 5.0: print("Wait for motion timeout (5s)") break time.sleep(0.1) ``` -------------------------------- ### Set Robotic Arm Installation Position Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Define the installation position of the robotic arm using `set_installation_pos`. Use predefined constants like `HORIZONTAL`. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() robot.set_installation_pos(robot.OPTIONS.INSTALLATION_POS.HORIZONTAL) ``` -------------------------------- ### GET get_firmware Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Read the robotic arm firmware information. ```APIDOC ## GET get_firmware ### Description Read the robotic arm firmware information (software version / hardware version / production date, etc.). ### Parameters #### Query Parameters - **timeout** (float) - Optional - Timeout for waiting for feedback (seconds), default 1.0 - **min_interval** (float) - Optional - Minimum request interval (seconds), default 1.0 ### Response - **software_version** (str) - Software version - **hardware_version** (str) - Hardware version - **production_date** (str) - Production date - **node_type** (str) - Node type - **node_number** (int) - Node number ``` -------------------------------- ### Execute Joint Motion (Follower Mode) Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Example of initializing the arm and sending joint target angles in JS mode. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.move_js([0.0] * robot.joint_nums) ``` -------------------------------- ### Get Gripper Teaching Pendant Parameters Definition Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Function signature for querying teaching pendant configuration parameters. ```python get_gripper_teaching_pendant_param( self, timeout: float = 1.0, min_interval: float = 1.0 ) -> Optional[MessageAbstract[ArmMsgFeedbackGripperTeachingPendantParam]] ``` -------------------------------- ### Set Joint Acceleration Limits Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Example demonstrating how to configure the maximum acceleration for a specific joint. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() success = robot.set_joint_acc_limits(joint_index=1, max_joint_acc=5.0) print("set_joint_acc_limits success =", success) ``` -------------------------------- ### Create Connection Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/revo2/revo2_api.md Establishes the connection to the end effector and optionally starts the data reading thread. ```APIDOC ## Create Connection — `connect()` ### Description Creates the connection and starts the data reading thread. ### Method `robot.connect(start_read_thread: bool = True)` ### Parameters #### Query Parameters - **start_read_thread** (bool) - Optional - Whether to start the data reading thread. Defaults to `True`. ### Request Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.REVO2) robot.connect() ``` ``` -------------------------------- ### Set Follower Mode Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Configures the arm as a follower in a Leader-Follower setup. ```python set_follower_mode(self) -> None ``` ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() robot.set_follower_mode() ``` -------------------------------- ### Execute Linear Motion Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Example of performing a linear motion to a target pose with status polling. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.set_speed_percent(100) robot.move_l([-0.4, -0.2, 0.4, 1.5708, 0.0, 0.0]) # Wait for motion to finish (with 5s timeout) time.sleep(0.5) start_t = time.monotonic() while True: status = robot.get_arm_status() if status is not None and status.msg.motion_status == 0: print("Reached target position") break if time.monotonic() - start_t > 5.0: print("Wait for motion timeout (5s)") break time.sleep(0.1) ``` -------------------------------- ### Set Joint Angle and Velocity Limits Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Examples showing how to set both angle and velocity limits simultaneously or just the velocity limit. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() # 同时设置角度和速度限制 success = robot.set_joint_angle_vel_limits( joint_index=1, min_angle_limit=-2.618, max_angle_limit=2.618, max_joint_spd=3.0, ) print("set_joint_angle_vel_limits success =", success) # 仅设置最大速度限制(不改角度限制) success = robot.set_joint_angle_vel_limits(joint_index=1, max_joint_spd=3.0) print("set_joint_angle_vel_limits(max_joint_spd) success =", success) ``` -------------------------------- ### Connect to the Robotic Arm Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Establish the connection to the robotic arm and optionally start the data reading thread. This method initializes communication with the arm. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() ``` -------------------------------- ### GET get_gripper_ctrl_states() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Reads the feedback/echo status of the leader arm's gripper control commands. ```APIDOC ## GET get_gripper_ctrl_states() ### Description Reads the feedback/echo status of the leader arm's gripper control commands (current width, force, status code, homing command echo, etc.). ### Response - **width** (float) - Current gripper opening width, unit: m, range: [0.0, 0.1] - **force** (float) - Current gripping force, unit: N, range: [0.0, 3.0] - **status_code** (int) - Status code related to the control command - **set_zero** (int) - Homing/zero calibration field ``` -------------------------------- ### GET get_gripper_teaching_pendant_param() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Queries gripper teaching pendant parameters such as teaching range, max range config, and teaching friction. ```APIDOC ## GET get_gripper_teaching_pendant_param() ### Description Queries gripper teaching pendant parameters (such as teaching range, max range config, teaching friction). This interface sends a query frame and waits for the corresponding feedback. ### Parameters #### Query Parameters - **timeout** (float) - Optional - Feedback wait timeout (seconds), default 1.0 - **min_interval** (float) - Optional - Minimum request interval (seconds), default 1.0 ### Response - **teaching_range_per** (int) - Teaching range (percentage-style value), range: [100, 200] - **max_range_config** (float) - Max range config, unit: m - **teaching_friction** (int) - Teaching friction, range: 1..10 ``` -------------------------------- ### Linear Motion move_l() Usage Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Example of configuring the arm and executing a linear move. Note that this command cannot be used to continuously send target points. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while not robot.enable(): time.sleep(0.01) robot.set_speed_percent(100) robot.move_l([0.1, 0.0, 0.3, 0.0, 1.570796326794896619, 0.0]) # 等待运动结束(带 5s 超时) time.sleep(0.5) start_t = time.monotonic() while True: status = robot.get_arm_status() if status is not None and status.msg.motion_status == 0: print("已到达目标位置") break if time.monotonic() - start_t > 5.0: print("等待运动结束超时(5s)") break time.sleep(0.1) ``` -------------------------------- ### Initialization and Connection Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Methods for creating the arm configuration, initializing the driver instance, and establishing a connection. ```APIDOC ## create_agx_arm_config() ### Description Creates the configuration object required for initializing the robotic arm. ## AgxArmFactory.create_arm(config) ### Description Creates an instance of the arm driver using the provided configuration. ## connect() ### Description Establishes the connection to the robotic arm hardware. ## init_effector() ### Description Initializes the end effector connected to the arm. ``` -------------------------------- ### Circular Movement - move_c() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Plans and executes a circular trajectory using three target end-effector poses: start, middle, and end. ```APIDOC ## POST /api/robot/move_c ### Description Plans and executes a circular trajectory using three target end-effector poses: start, middle, and end. ### Method POST ### Endpoint /api/robot/move_c ### Parameters #### Request Body - **start_pose** (list[float]) - Required - Start pose [x, y, z, roll, pitch, yaw] in meters/radians. Pose range: roll/yaw ∈ [-π, π], pitch ∈ [-π/2, π/2]. - **mid_pose** (list[float]) - Required - Middle point pose [x, y, z, roll, pitch, yaw] in meters/radians. Pose range: roll/yaw ∈ [-π, π], pitch ∈ [-π/2, π/2]. - **end_pose** (list[float]) - Required - End pose [x, y, z, roll, pitch, yaw] in meters/radians. Pose range: roll/yaw ∈ [-π, π], pitch ∈ [-π/2, π/2]. ### Request Example ```json { "start_pose": [-0.4, -0.2, 0.4, 1.5708, 0.0, 0.0], "mid_pose": [-0.4, 0.0, 0.45, 1.5708, 0.0, 0.0], "end_pose": [-0.4, 0.2, 0.4, 1.5708, 0.0, 0.0] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Get Leader Arm Joint Angles Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Retrieve the joint angles of the leader arm for controlling a follower arm using `get_leader_joint_angles`. This example continuously fetches and prints the angles. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() robot.set_leader_mode() while True: mja = robot.get_leader_joint_angles() if mja is not None: print(mja.msg) time.sleep(0.005) ``` -------------------------------- ### Arc Motion - move_c() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Performs arc trajectory planning and execution using three target flange poses: start, midpoint, and end. ```APIDOC ## move_c(start_pose, mid_pose, end_pose) ### Description Perform arc trajectory planning and execution using three target flange poses: start / midpoint / end. ### Parameters #### Request Body - **start_pose** (list[float]) - Required - Start pose [x, y, z, roll, pitch, yaw] (m / rad). - **mid_pose** (list[float]) - Required - Midpoint pose [x, y, z, roll, pitch, yaw] (m / rad). - **end_pose** (list[float]) - Required - End pose [x, y, z, roll, pitch, yaw] (m / rad). ``` -------------------------------- ### GET get_joint_enable_status Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Get the enable status of a specified joint motor. ```APIDOC ## GET get_joint_enable_status ### Description Get the enable status of a specified joint motor. ### Parameters #### Path Parameters - **joint_index** (int) - Required - Joint index: 1~6 queries a single joint; 255 queries all joints ### Response - **status** (bool) - True means enabled, False means not enabled or no feedback available. ``` -------------------------------- ### Python Example: Hybrid Control of Robot End Effector Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/revo2/revo2_api.md Demonstrates initializing the robot, connecting, and then using `position_time_ctrl` for hybrid control. First, set a target position for the thumb tip, then specify the time (in 10ms units) for it to reach that position. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.REVO2) robot.connect() # 拇指尖移动到位置 100,然后设置 2 秒到位(200 * 10ms) end_effector.position_time_ctrl(mode="pos", thumb_tip=100) end_effector.position_time_ctrl(mode="time", thumb_tip=200) ``` -------------------------------- ### Create Connection Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/revo2/revo2_api.md Establishes the connection and initiates the background data reading thread. ```python connect(self, start_read_thread: bool = True) -> None ``` ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.REVO2) robot.connect() ``` -------------------------------- ### Get Data Monitoring Receive Frequency Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Retrieves the data monitoring receive frequency in Hertz (Hz). A short delay after connecting is advised to get an accurate reading. ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() time.sleep(0.5) print("robotic arm fps =", robot.get_fps(), "Hz") ``` -------------------------------- ### GET /get_flange_pose Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Retrieves the pose of the end-effector flange. ```APIDOC ## GET /get_flange_pose ### Description Retrieves the pose of the end-effector flange (the mechanical interface for tools). ### Method GET ### Endpoint get_flange_pose() ### Response #### Success Response (200) - **pose** (list[float]) - A list of 6 floats [x, y, z, roll, pitch, yaw]. x, y, z are in meters; roll, pitch, yaw are in radians. ``` -------------------------------- ### Activate Multiple CAN Modules Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/can_user.md Run the multi-activation script after configuring the port mappings. ```bash bash can_muti_activate.sh ``` -------------------------------- ### Create Configuration - create_agx_arm_config() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Generates the configuration dictionary required by the robotic arm for subsequent Driver instance creation. ```APIDOC ## Create Configuration — `create_agx_arm_config()` ### Description Generate the configuration dictionary required by the robotic arm for subsequent Driver instance creation. ### Method Signature ```python create_agx_arm_config( robot: Literal["nero", "piper", "piper_h", "piper_l", "piper_x"], comm: Literal["can"] = "can", firmeware_version: str = "default", **kwargs, ) -> dict ``` ### Parameters #### Required Parameters - **robot** (str) - Robotic arm model. Options: `"nero"` / `"piper"` / `"piper_h"` / `"piper_l"` / `"piper_x"` #### Optional Parameters - **comm** (str) - Communication type. Options: `"can"` (default). Note: `comm` is not the CAN channel name; the CAN channel is specified by `channel` - **firmeware_version** (str) - Controller firmware version, default `"default"` #### Optional Keyword Arguments (`**kwargs`) - **joint_limits** (dict) - Custom joint limits (unit: rad). Defaults are assigned automatically; manually entered limits are not currently applied to actual control. See example below - **channel** (str) - CAN channel name, default `"can0"` - **interface** (str) - CAN interface type, default `"socketcan"`. On Linux, the official CAN module must use `"socketcan"`; on macOS, use a serial CAN module and set to `"slcan"` - **bitrate** (int) - CAN baud rate, default `1000000` (1 Mbps) - **enable_check_can** (bool) - Whether to check the CAN module when creating the Comm instance, default `True` - **auto_connect** (bool) - Whether to automatically create the CAN Bus instance, default `True` - **timeout** (float) - CAN Bus read/write timeout (seconds), default `1.0` ### Return Value - **dict** - Configuration dictionary for the robotic arm. ### Example Return Structure ```json { "robot": "nero", "comm": { "type": "can", "can": { "channel": "can0", "interface": "socketcan", "bitrate": 1000000, "enable_check_can": true, "auto_connect": true, "timeout": 1.0 } }, "joint_names": ["joint1", "joint2", "joint3", "joint4", "joint5", "joint6", "joint7"], "joint_limits": { "joint1": [-2.705261, 2.705261], "joint2": [-1.745330, 1.745330], "joint3": [-2.757621, 2.757621], "joint4": [-1.012291, 2.146755], "joint5": [-2.757621, 2.757621], "joint6": [-0.733039, 0.959932], "joint7": [-1.570797, 1.570797] } } ``` ### Usage Example ```python from pyAgxArm import create_agx_arm_config cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") print(cfg) ``` ``` -------------------------------- ### GET get_joint_enable_status() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Checks the enable status of a joint motor. ```APIDOC ## GET get_joint_enable_status() ### Description Get the enable status of the specified joint motor. ### Method Python Method ### Parameters #### Path Parameters - **joint_index** (int) - Required - Joint index: 1~7 queries a single joint; 255 queries all joints. ### Response - **status** (bool) - True means enabled, False means not enabled or no feedback available. ``` -------------------------------- ### Create Arm Driver Instance Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/revo2/revo2_api.md Creates an arm driver instance with the specified configuration. Accepts different robot types and communication configurations. ```APIDOC ## Create Arm Driver Instance — `AgxArmFactory.create_arm()` ### Description Creates an arm driver instance based on the provided configuration. ### Method `AgxArmFactory.create_arm(cfg)` ### Parameters #### Request Body - **cfg** (object) - Required - Configuration object for the arm driver. Use `create_agx_arm_config` to create this object. - **robot** (str) - Required - Specifies the robot model. Accepted values: `"nero"`, `"piper"`, `"piper_h"`, `"piper_l"`, `"piper_x"`. - **comm** (str) - Required - Communication protocol. Accepted values: `"can"`, `"ethernet"`. - **channel** (str) - Required - Communication channel identifier (e.g., `"can0"`, `"192.168.1.100"`). ### Request Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) ``` ``` -------------------------------- ### GET /get_motor_states Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Reads high-speed feedback for a specific joint motor. ```APIDOC ## GET /get_motor_states ### Description Reads high-speed feedback (position, velocity, current, torque) for a specified joint. ### Method GET ### Endpoint get_motor_states(joint_index) ### Parameters #### Path Parameters - **joint_index** (int) - Required - The joint index, range 1-6. ### Response #### Success Response (200) - **position** (float) - Motor position (rad) - **velocity** (float) - Motor velocity (rad/s) - **current** (float) - Motor current (A) - **torque** (float) - Motor torque (N·m) ``` -------------------------------- ### GET /get_joint_angles Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Retrieves the current angles of all robotic arm joints. ```APIDOC ## GET /get_joint_angles ### Description Retrieves the current angles of all joints. ### Method GET ### Endpoint get_joint_angles() ### Response #### Success Response (200) - **angles** (list[float]) - A list of 6 floats representing joint angles [j1, j2, j3, j4, j5, j6] in radians. ``` -------------------------------- ### Initialize and Connect Nero Arm via CAN Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/first_time_user_guide_can.md Use this to initialize the Nero arm configuration for CAN communication and establish a connection. Ensure the CAN interface and channel are correctly specified. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory robot_cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0", interface="socketcan") robot = AgxArmFactory.create_arm(robot_cfg) robot.connect() robot.set_normal_mode() ``` -------------------------------- ### Get Joint Angles Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Retrieves the current angle of each joint in radians. ```APIDOC ## GET /agxarm/joint_angles ### Description Get the current angle of each joint. ### Method GET ### Endpoint /agxarm/joint_angles ### Response #### Success Response (200) - **msg** (list[float]) - A list of 6 float values representing the angles of joints j1 to j6 in radians. - **hz** (float) - The frequency of the feedback. - **timestamp** (float) - The timestamp of the feedback. ### Response Example ```json { "msg": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6], "hz": 200.0, "timestamp": 1678886400.123456 } ``` ``` -------------------------------- ### Configure Multiple CAN Modules Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/can_user.md Define the mapping of USB ports to target interface names and baud rates within the activation script. ```bash USB_PORTS["3-1.4:1.0"]="can_left:1000000" USB_PORTS["3-1.1:1.0"]="can_right:1000000" ``` -------------------------------- ### GET get_driver_states() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Reads low-speed driver feedback for a specific joint. ```APIDOC ## GET get_driver_states() ### Description Read the low-speed driver feedback for the specified joint (voltage / temperature / bus current / driver status bits). ### Method Python Method ### Parameters #### Path Parameters - **joint_index** (int) - Required - Joint index, range: 1~7 ### Response - **vol** (float) - Driver voltage - **foc_temp** (float) - Driver temperature (°C) - **motor_temp** (float) - Motor temperature (°C) - **bus_current** (float) - Bus current (A) - **foc_status** (object) - Driver status bits ``` -------------------------------- ### GET get_motor_states() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Reads high-speed motor feedback for a specific joint. ```APIDOC ## GET get_motor_states() ### Description Read the high-speed motor feedback for the specified joint (position / velocity / current / torque). ### Method Python Method ### Parameters #### Path Parameters - **joint_index** (int) - Required - Joint index, range: 1~7 ### Response - **position** (float) - Motor position (rad) - **velocity** (float) - Motor velocity (rad/s) - **current** (float) - Motor current (A) - **torque** (float) - Motor torque (N·m) ``` -------------------------------- ### Configuration and Connection Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt APIs for configuring and establishing a connection with the robotic arm. ```APIDOC ## create_agx_arm_config ### Description Generate the configuration dictionary for creating a robotic arm Driver instance. ### Method `create_agx_arm_config` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from pyAgxArm import create_agx_arm_config # Basic configuration for Piper arm cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") # Configuration for Nero arm with custom settings cfg = create_agx_arm_config( robot="nero", comm="can", channel="can0", bitrate=1000000, timeout=1.0 ) ``` ### Response None ## AgxArmFactory.create_arm ### Description Create the robotic arm Driver instance using factory method. ### Method `AgxArmFactory.create_arm` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) ``` ### Response None ## connect ### Description Establish connection and start data reading thread. ### Method `robot.connect()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() # start_read_thread=True by default ``` ### Response None ## init_effector ### Description Initialize end effector Driver and return the effector instance. ### Method `robot.init_effector()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) end_effector = robot.init_effector(robot.OPTIONS.EFFECTOR.AGX_GRIPPER) robot.connect() ``` ### Response None ``` -------------------------------- ### Get Joint Angles Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Retrieves the current angles of all joints in radians. ```APIDOC ## Get Joint Angles — `get_joint_angles()` ### Description Get the current angles of all joints. ### Method GET ### Endpoint `/api/robot/joint_angles` ### Parameters None ### Response #### Success Response (200) - **MessageAbstract[list[float]]** (object) - An object containing joint angles. - **msg** (list[float]) - A list of 7 float values representing the angles of joints j1 to j7 in radians. - **hz** (float) - Receive frequency for this message type (tracked by SDK), unit: Hz. - **timestamp** (float) - Message timestamp (recorded by SDK), unit: s. ### Response Example ```json { "msg": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7], "hz": 200.0, "timestamp": 1678886401.123456 } ``` ``` -------------------------------- ### Get Joint Count Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Retrieves the number of joints in the robotic arm. ```APIDOC ## Get Joint Count — `joint_nums` ### Description Get the number of joints of the robotic arm (e.g., 7 for Nero). ### Method GET ### Endpoint `/api/robot/joint_count` ### Parameters None ### Response #### Success Response (200) - **joint_nums** (int) - The number of joints in the robotic arm. ### Response Example ```json { "joint_nums": 7 } ``` ``` -------------------------------- ### Create Arm Driver Instance Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Creates a robotic arm Driver instance using a factory method. Requires a configuration dictionary generated by `create_agx_arm_config()`. ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="piper", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) ``` -------------------------------- ### Create Arm Driver Instance - AgxArmFactory.create_arm() Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Creates the corresponding robotic arm Driver instance via a factory method based on the configuration dictionary. ```APIDOC ## Create Arm Driver Instance — `AgxArmFactory.create_arm()` ### Description Create the corresponding robotic arm Driver instance via factory method based on the configuration dictionary. ### Method Signature ```python create_arm(cls, config: dict, **kwargs) -> T ``` ### Parameters #### Required Parameters - **config** (dict) - Configuration dictionary generated by `create_agx_arm_config()` ### Return Value - **Driver** - Different arm models, communication methods, and firmware versions correspond to different instances. ### Usage Example ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) ``` ``` -------------------------------- ### Get Joint Angles Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Retrieves the current joint angles in radians. ```python get_joint_angles(self) -> MessageAbstract[list[float]] | None ``` ```python import time from pyAgxArm import create_agx_arm_config, AgxArmFactory cfg = create_agx_arm_config(robot="nero", comm="can", channel="can0") robot = AgxArmFactory.create_arm(cfg) robot.connect() while True: ja = robot.get_joint_angles() if ja is not None: print(ja.msg) print(ja.hz, ja.timestamp) time.sleep(0.005) ``` -------------------------------- ### GET /get_arm_status Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/nero/nero_api.md Retrieves the current operational status of the robotic arm. ```APIDOC ## GET /get_arm_status ### Description Retrieves the current status of the robotic arm, returning a MessageAbstract object containing the arm's state. ### Method GET ### Endpoint get_arm_status() ### Response #### Success Response (200) - **status** (MessageAbstract) - The current status object of the arm. ``` -------------------------------- ### Import Module Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Import necessary classes and functions from the pyAgxArm library. ```APIDOC ## Import Module ```python from pyAgxArm import create_agx_arm_config, AgxArmFactory ``` ``` -------------------------------- ### Navigate to Script Directory Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/can_user.md Change the current working directory to the location of the CAN configuration scripts on Ubuntu. ```shell cd pyAgxArm/scripts/ubuntu ``` -------------------------------- ### POST /AgxArmFactory/create_arm Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/effector/agx_gripper/agx_gripper_api.md Creates a robotic arm driver instance based on a configuration dictionary. ```APIDOC ## POST AgxArmFactory.create_arm ### Description Creates the corresponding robotic arm Driver instance via a factory method based on the configuration dictionary. ### Method POST ### Parameters #### Request Body - **config** (dict) - Required - Configuration dictionary generated by create_agx_arm_config() ### Request Example { "config": {"robot": "piper", "comm": "can", "channel": "can0"} } ``` -------------------------------- ### Get Crash Protection Rating Source: https://github.com/agilexrobotics/pyagxarm/blob/master/docs/piper/piper_api.md Queries the crash protection rating of each joint. ```APIDOC ## GET /api/crash-protection/rating ### Description Query the crash protection rating of each joint (list returned by the controller). ### Method GET ### Endpoint /api/crash-protection/rating ### Parameters #### Query Parameters - **timeout** (float) - Optional - Timeout for waiting for feedback (seconds), default 1.0; 0.0 means non-blocking - **min_interval** (float) - Optional - Minimum request interval (seconds), default 1.0 ### Response #### Success Response (200) - **msg** (list[int]) - Crash protection rating list (in joint order), where each item is an int (range: 0~8). Higher rating means more sensitive. ### Response Example ```json { "msg": [1, 2, 1, 3, 2, 1], "hz": 100.0, "timestamp": 1678886400.0 } ``` ``` -------------------------------- ### GET /get_joint_angle_vel_limits Source: https://context7.com/agilexrobotics/pyagxarm/llms.txt Query joint angle and velocity limits for a specific joint. ```APIDOC ## GET /get_joint_angle_vel_limits ### Description Query joint angle and velocity limits for a specific joint. ### Method GET ### Endpoint /get_joint_angle_vel_limits ### Parameters #### Query Parameters - **joint_index** (int) - Required - The index of the joint to query. ### Response #### Success Response (200) - **msg** (object) - Contains the limit information. - **min_angle_limit** (float) - The minimum angle limit for the joint. - **max_angle_limit** (float) - The maximum angle limit for the joint. - **min_joint_spd** (float) - The minimum joint speed. - **max_joint_spd** (float) - The maximum joint speed. #### Response Example ```json { "msg": { "min_angle_limit": -3.14, "max_angle_limit": 3.14, "min_joint_spd": 0.1, "max_joint_spd": 2.0 } } ``` ```