Skip to content

4.15 Extension Management

Overview

The Extension module manages third-party plug-ins on the robot controller. It can retrieve the controller’s IP, list/view installed plug-ins, enable/disable them, and invoke their services.
Using the extension interface you can centrally control plug-in life-cycle from the host PC and send commands to extend robot functionality.

4.15.1 Get the Robot's IP Address

Method Nameextension.get_robot_ip() -> str
DescriptionReturns the corresponding robot IP address based on the environment where the SDK is running
Request ParametersNone
Return Valuestr: IP address (may be None)
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

IP Acquisition Logic:

This method automatically determines and returns the appropriate IP address based on the environment where the SDK is running:

  1. Industrial Teaching Pendant Environment: Returns the controller's IP address
  2. Collaborative AP Board Environment:
    • DHCP mode: Returns the router's IP address (default gateway)
    • Static IP mode: Returns the configured static IP address
  3. Cloud Environment: Returns the cloud's internal IP address
  4. Other Environments: Returns None

Note

  • This method is primarily used in extension or teaching pendant environments where connection to the robot controller is required

4.15.2 Get Extension List

Method Nameextension.get_list() → tuple[list[ExtensionInfo], StatusCodeEnum]
DescriptionRetrieves information for all extensions currently installed on the robot.
Request ParametersNone
Return Valuelist[ExtensionInfo] : list of extension information.
StatusCodeEnum : execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.7.0.0+
Industrial (Bronze): not supported

4.15.3 Get Extension Details

Method Nameextension.get( name : str) → tuple[ExtensionInfo, StatusCodeEnum]
DescriptionQueries detailed information of a single extension by its name.
Request Parametersname : extension name.
Return ValueExtensionInfo : detailed extension information.
StatusCodeEnum : execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.7.0.0+
Industrial (Bronze): not supported

4.15.4 Toggle Extension Enable Status

Method Nameextension.toggle( name : str) → StatusCodeEnum
DescriptionToggles the enabled/disabled state of the specified extension.
Request Parametersname : extension name.
Return ValueStatusCodeEnum : execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.7.0.0+
Industrial (Bronze): not supported

4.15.5 Call Simple-Service Extension Command

Method Nameextension.call_service( name : str, command : str, params : dict = None) → tuple[Any, StatusCodeEnum]
DescriptionInvokes a simple-service command provided by the specified extension and returns its execution result.
Request Parametersname : extension name.
command : extension command name.
params : command parameters (optional, defaults to None).
Return ValueAny : execution result of the extension command.
StatusCodeEnum : execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.7.0.0+
Industrial (Bronze): not supported

Example Code

extension/extension_operation.py
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 插件使用示例 / Example of extension usage
"""

from Agilebot import Arm, StatusCodeEnum

# [ZH] 初始化捷勃特机器人
# [EN] Initialize the Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to the Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if the connection is successful
if ret == StatusCodeEnum.OK:
    print("机器人连接成功 / Robot connection successful")
else:
    print(f"机器人连接失败,错误代码 / Robot connection failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

res, ret = arm.extension.get("MathService")
if ret == StatusCodeEnum.OK:
    print("获取插件信息成功 / Get extension information successfully")
    print(f"插件信息 / Extension information: {res}")
else:
    print(f"获取插件信息失败,错误代码 / Get extension information failed, error code: {ret.errmsg}")

ret = arm.extension.toggle("MathService")
if ret == StatusCodeEnum.OK:
    print("切换插件状态成功 / Toggle extension status successfully")
else:
    print(f"切换插件状态失败,错误代码 / Toggle extension status failed, error code: {ret.errmsg}")

res, ret = arm.extension.call_service("MathService", "add", dict([["a", 1], ["b", 2]]))
if ret == StatusCodeEnum.OK:
    print("调用插件服务成功 / Call extension service successfully")
    print(f"调用插件服务结果 / Call extension service result: {res}")
else:
    print(f"调用插件服务失败,错误代码 / Call extension service failed, error code: {ret.errmsg}")