[[["ChangeSet", ["Renaming <Gear> to <gear>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def ZeroPosition(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def ZeroPosition(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def RotationDirection(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def RotationDirection(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def Gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def Gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def ZeroPosition(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def ZeroPosition(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def RotationDirection(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def RotationDirection(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828050.8665013]], ["ChangeSet", ["Renaming <ZeroPosition> to <zero_position>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def RotationDirection(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def RotationDirection(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def ZeroPosition(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def ZeroPosition(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def RotationDirection(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def RotationDirection(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828051.179182]], ["ChangeSet", ["Renaming <RotationDirection> to <rotation_direction>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def RotationDirection(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def RotationDirection(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828051.5468695]], ["ChangeSet", ["Renaming <rotateTo> to <rotate_to>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828051.890507]], ["ChangeSet", ["Renaming <setPosition> to <set_position>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828052.2272465]], ["ChangeSet", ["Renaming <Now> to <now>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828052.5785174]], ["ChangeSet", ["Renaming <Kp> to <kp>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828053.0301044]], ["ChangeSet", ["Renaming <Ki> to <ki>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828053.354337]], ["ChangeSet", ["Renaming <Target> to <target>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828053.6585646]], ["ChangeSet", ["Renaming <UpLimit> to <up_limit>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def UpLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def UpLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828053.9382167]], ["ChangeSet", ["Renaming <DownLimit> to <down_limit>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def DownLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def DownLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828054.1946073]], ["ChangeSet", ["Renaming <LimitSwitch> to <limit_switch>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def LimitSwitch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def LimitSwitch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828054.4344614]], ["ChangeSet", ["Renaming <Now> to <now>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828054.7066872]], ["ChangeSet", ["Renaming <Kp> to <kp>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828054.9942648]], ["ChangeSet", ["Renaming <Ki> to <ki>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828055.3227997]], ["ChangeSet", ["Renaming <Target> to <target>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828055.6192527]], ["ChangeSet", ["Renaming <Acceleration> to <acceleration>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def Acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def Acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828055.9140065]], ["ChangeSet", ["Renaming <Deceleration> to <deceleration>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def Deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def Deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828056.2104216]], ["ChangeSet", ["Renaming <SpeedLimit> to <speed_limit>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def SpeedLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def SpeedLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828056.4826658]], ["ChangeSet", ["Renaming <Now> to <now>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def Now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828056.7851622]], ["ChangeSet", ["Renaming <Kp> to <kp>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def Kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def Kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828057.2503734]], ["ChangeSet", ["Renaming <Ki> to <ki>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def Ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def Ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828057.73835]], ["ChangeSet", ["Renaming <Target> to <target>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def Target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def Target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828058.0892122]], ["ChangeSet", ["Renaming <CurrentLimit> to <current_limit>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def CurrentLimit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def CurrentLimit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828058.4177034]], ["ChangeSet", ["Renaming <rotateTo> to <rotate_to>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotateTo(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828058.7058518]], ["ChangeSet", ["Renaming <setPosition> to <set_position>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def setPosition(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828059.0016246]], ["ChangeSet", ["Renaming <initZeroPosition> to <init_zero_position>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def initZeroPosition(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828059.3145025]], ["ChangeSet", ["Renaming <PositionMode> to <position_mode>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def PositionMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828059.6345403]], ["ChangeSet", ["Renaming <SpeedMode> to <speed_mode>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def SpeedMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828059.9292045]], ["ChangeSet", ["Renaming <CurrentMode> to <current_mode>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def current_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def CurrentMode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828060.2177985]], ["ChangeSet", ["Renaming <udp2can_float> to <Udp2canFloat>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass Udp2canFloat(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = Udp2canFloat()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = Udp2canFloat.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def current_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass udp2can_float(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_float()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_float.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def current_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828060.5236704]], ["ChangeSet", ["Renaming <udp2can_int> to <Udp2canInt>", [["ChangeContents", ["__init__.py", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass Udp2canFloat(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = Udp2canFloat()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = Udp2canFloat.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Udp2canInt(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = Udp2canInt()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = Udp2canInt.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def current_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n", "# from . import Amber_actuator\nimport socket\nfrom ctypes import *\n\n#\n# Created by Tianren Song on 23-9-12.\n# Amberobotics Tuning Tool\n#\n\n\nclass Udp2canFloat(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_float),  # ctypes array\n    ]\n\n\ndef float_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = Udp2canFloat()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = Udp2canFloat.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass udp2can_int(Structure):  # ctypes struct for receive\n    _pack_ = 1  # Override Structure align\n    _fields_ = [\n        (\"actuator_ID\", c_uint8),\n        (\"verb\", c_uint8),\n        (\"cmd\", c_uint8),\n        (\"data\", c_uint32),  # ctypes array\n    ]\n\n\ndef int_data_through_udp(ip_addr, actuator_id, verb, cmd, data=0):\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    s.bind((\"0.0.0.0\", 12321))\n    fcandata = udp2can_int()\n    fcandata.verb = verb\n    fcandata.cmd = cmd\n    fcandata.actuator_ID = actuator_id\n    fcandata.data = data\n    s.settimeout(1)\n    s.sendto(fcandata, (ip_addr, 24001))\n    data, addr = s.recvfrom(1024)\n    # print(\"Receiving: \", data.hex())\n    payload_r = udp2can_int.from_buffer_copy(data)\n    return [payload_r.actuator_ID, payload_r.data]\n\n\nclass Attribute:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def version(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 1)\n        return hex(result[1])\n\n    @property\n    def mode(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 2)\n        return result[1]\n\n    @Mode.setter\n    def mode(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, data)\n        return result\n\n    @property\n    def pole_number(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 3)\n        return result[1]\n\n    @PoleNumber.setter\n    def pole_number(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 3, data)\n        return result\n\n    @property\n    def gear(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 6)\n        return result[1]\n\n    @Gear.setter\n    def gear(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 6, data)\n        return result\n\n    @property\n    def zero_position(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 5)\n        return result[1]\n\n    @ZeroPosition.setter\n    def zero_position(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 5, data)\n        return result\n\n    @property\n    def rotation_direction(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 4)\n        return result[1]\n\n    @RotationDirection.setter\n    def rotation_direction(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 4, data)\n        return result\n\n\nclass Position:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 12)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 12, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 13)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 13, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 11)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, data)\n        return result\n\n    @property\n    def up_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 14)\n        return result[1]\n\n    @UpLimit.setter\n    def up_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 14, data)\n        return result\n\n    @property\n    def down_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 15)\n        return result[1]\n\n    @DownLimit.setter\n    def down_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 15, data)\n        return result\n\n    @property\n    def limit_switch(self):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 0, 16)\n        return result[1]\n\n    @LimitSwitch.setter\n    def limit_switch(self, data):\n        result = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 16, data)\n        return result\n\n\nclass Speed:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 20)\n        return result[1]\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 22)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 22, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 23)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 23, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 21)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 21, data)\n        return result\n\n    @property\n    def acceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 24)\n        return result[1]\n\n    @Acceleration.setter\n    def acceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 24, data)\n        return result\n\n    @property\n    def deceleration(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 25)\n        return result[1]\n\n    @Deceleration.setter\n    def deceleration(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 25, data)\n        return result\n\n    @property\n    def speed_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 26)\n        return result[1]\n\n    @SpeedLimit.setter\n    def speed_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 26, data)\n        return result\n\n\nclass Current:\n    def __init__(self, ip_addr=\"127.0.0.1\", actuator_id=1):\n        # self._position = None\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n\n    @property\n    def now(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 30)\n\n    @property\n    def kp(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 32)\n        return result[1]\n\n    @Kp.setter\n    def kp(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 32, data)\n        return result\n\n    @property\n    def ki(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 33)\n        return result[1]\n\n    @Ki.setter\n    def ki(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 33, data)\n        return result\n\n    @property\n    def target(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 31)\n        return result[1]\n\n    @Target.setter\n    def target(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 31, data)\n        return result\n\n    @property\n    def current_limit(self):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 34)\n        return result[1]\n\n    @CurrentLimit.setter\n    def current_limit(self, data):\n        result = float_data_through_udp(self.ip_addr, self.actuator_id, 1, 34, data)\n        return result\n\n\nclass AmberActuator:\n    def __init__(self, actuator_id=1, ip_addr=\"127.0.0.1\"):\n        self.ip_addr = ip_addr\n        self.actuator_id = actuator_id\n        self.position = Position(ip_addr, actuator_id)\n        self.speed = Speed(ip_addr, actuator_id)\n        self.current = Current(ip_addr, actuator_id)\n        self.attribute = Attribute(ip_addr, actuator_id)\n\n    def rotate_to(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def set_position(self, degree):\n        return float_data_through_udp(self.ip_addr, self.actuator_id, 1, 11, degree)\n\n    def rotate(self, delta):\n        now = float_data_through_udp(self.ip_addr, self.actuator_id, 0, 10)\n        return float_data_through_udp(\n            self.ip_addr, self.actuator_id, 1, 11, delta + now[1]\n        )\n\n    def init_zero_position(self):\n        return int_data_through_udp(self.ip_addr, self.actuator_id, 1, 40, 0)\n\n    def position_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 2)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def speed_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 3)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n    def current_mode(self):\n        var1 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 1)\n        if var1[0] == self.actuator_id:\n            var2 = int_data_through_udp(self.ip_addr, self.actuator_id, 1, 2, 4)\n            if var2[0] == self.actuator_id:\n                return var2\n        return -1\n\n\nif __name__ == \"__main__\":\n    amber_robot = AmberActuator()\n"]]], 1695828060.8194704]]], []]