Skip to content

Settings

This page contains information on all functions present within settings.py and aims to give a clear understanding both of what these functions do and the requirements for any data to be input into them.

These functions will allow you to get and change the value of a variety of settings for the arm.

Functions

arm_settings

Source code in actions\settings.py
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
class arm_settings():
    def __init__(self, arm:XArmAPI):
        self.arm = arm

    def set_state(self, state=0):
        """
        Set the xArm state

        Args:
            state: default 0

                - 0: motion state

                - 3: pause state

                - 4: stop state

                - 6: deceleration stop state

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_state(state=state)

    def set_mode(self, mode=0, detection_param=0):
        """
        Set the xArm mode

        Args:
            mode: default 0

                0: position control

                1: servo motion

                Note: the use of the set_servo_angle_j interface must first be set to this

                Note: the use of the set_servo_cartesian interface must first be set to this

                2: joint teaching

                Note: use this mode to ensure that the arm has been identified and the control box and arm used for identification are one-to-one.

                3: cartesian teaching (invalid)

                4: joint velocity control

                5: cartesian velocity control

                6: joint online trajectory planning

                7: cartesian online trajectory planning

            detection_param: Teaching detection parameters, default is 0

                0: motion detection on

                1: motion detection off

                Note:

                1. only available if firmware_version >= 1.10.1

                2. only available if set_mode(2)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_mode(mode=mode, detection_param=detection_param)

    def motion_enable(self, enable=True, servo_id=None):
        """
        Enable motion

        Args:
            enable: True/False

            servo_id: 1-(Number of axes), None(8)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.motion_enable(servo_id=servo_id, enable=enable)

    def set_pause_time(self, sltime, wait=False):
        """
        Set the arm pause time, xArm will pause sltime second

        Args:
            sltime: sleep time,unit:(s)second

            wait: wait or not, default is False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_pause_time(sltime=sltime, wait=wait)

    def get_version(self):
        """
        Get the xArm firmware version

        Returns:
            out (tuple[int, str]): tuple((code, version)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            version (str): firmware version, such as '6,9, ,XX0000,v2.4.0'
        """
        return self.arm.get_version()

    def get_state(self):
        """
        Get state

        Returns:
            out (tuple[int, int]): tuple((code, state)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            state (int): state
                - 1: in motion
                - 2: sleeping
                - 3: suspended
                - 4: stopping
        """
        return self.arm.get_state()

    def get_is_moving(self):
        """
        Check if the arm is moving or not

        Returns:
            out (bool): True/False
        """
        return self.arm.get_is_moving()

    def get_cmdnum(self):
        """
        Get the cmd count in cache

        Returns:
            out (tuple[int, int]): tuple((code, cmd_num)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            cmd_num (int): command count in cache
        """
        return self.arm.get_cmdnum()

    def get_position(self, is_radian=None):
        """
        Get the cartesian position

        Note:
            1. If the value(roll/pitch/yaw) you want returned should be in radians, set is_radian to True
              ex: code, pos = arm.get_position(is_radian=True)

        Args:
            is_radian: if the returned value (only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, list]): tuple((code, [x, y, z, roll, pitch, yaw])), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.get_position(is_radian=is_radian)

    def get_servo_angle(self, servo_id=None, is_radian=None, is_real=False):
        """
        Get the servo angle

        Note:
            1. If the value you want returned should be in radians, set is_radian to True
              ex: code, angles = arm.get_servo_angle(is_radian=True)
            2. If you want to return only the angle of a single joint, please set the parameter servo_id
              ex: code, angle = arm.get_servo_angle(servo_id=2)
            3. This interface is only used in the base coordinate system.

        Args:
            servo_id: 1-(Number of axes), None(8), default is None

            is_radian: the returned value is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, list | float]): tuple((code, angle list if servo_id is None or 8 else angle)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.get_servo_angle(servo_id=servo_id, is_radian=is_radian, is_real=is_real)

    def get_position_aa(self, is_radian=None):
        """
        Get the pose represented by the axis angle pose

        Args:
            is_radian: if the returned value (only rx/ry/rz) is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, list]): tuple((code, [x, y, z, rx, ry, rz])), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.get_position_aa(is_radian=is_radian)

    def get_pose_offset(self, pose1, pose2, orient_type_in=0, orient_type_out=0, is_radian=None):
        """
        Calculate the pose offset of two given points

        Note:
            1. x, y, z are all in mm
            2. roll/rx, pitch/ry, yaw/rz are in either degrees or radians, can be selected by changing parameter is_radian

        Args:
            pose1: [x, y, z, roll/rx, pitch/ry, yaw/rz]

            pose2: [x, y, z, roll/rx, pitch/ry, yaw/rz]

            orient_type_in: input attitude notation, 0 is RPY(roll/pitch/yaw) (default), 1 is axis angle(rx/ry/rz)

            orient_type_out: notation of output attitude, 0 is RPY (default), 1 is axis angle

            is_radian: if the roll/rx/pitch/ry/yaw/rz of pose1/pose2/return_pose is in radians or not

        Returns:
            out (tuple[int, list]): tuple((code, pose)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            pose (list[float]): [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]
        """
        return self.arm.get_pose_offset(pose1, pose2, orient_type_in=orient_type_in, orient_type_out=orient_type_out, is_radian=is_radian)

    def set_tcp_offset(self, offset, is_radian=None, wait=True, **kwargs):
        """
        Set the tool coordinate system offset at the end

        Note:
            1. Do not use if not required
            2. If not saved and you want to revert to the last saved value, please reset the offset by set_tcp_offset([0, 0, 0, 0, 0, 0])
            3. If not saved, it will be lost after reboot
            4. The save_conf interface can record the current settings and will not be lost after the restart.
            5. The clean_conf interface can restore system default settings

        Args:
            offset: [x, y, z, roll, pitch, yaw]

            is_radian: the roll/pitch/yaw in radians or not, defaults to self.default_is_radian

            wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_tcp_offset(offset, is_radian=is_radian, wait=wait, **kwargs)

    def set_tcp_jerk(self, jerk):
        """
        Set the translational jerk of Cartesian space

        Note:
            1. Do not use if not required
            2. If not saved, it will be lost after reboot
            3. The save_conf interface can record the current settings and will not be lost after the restart.
            4. The clean_conf interface can restore system default settings

        Args:
            jerk: jerk (mm/s^3)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_tcp_jerk(jerk)

    def set_tcp_maxacc(self, acc):
        """
        Set the max translational acceleration of Cartesian space

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            acc: max acceleration (mm/s^2)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_tcp_maxacc(acc)

    def set_joint_jerk(self, jerk, is_radian=None):
        """
        Set the jerk of Joint space

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            jerk: jerk (°/s^3 or rad/s^3)

            is_radian: if the jerk is in radians or not, defaults to self.default_is_radian

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_joint_jerk(jerk, is_radian=is_radian)

    def set_joint_maxacc(self, acc, is_radian=None):
        """
        Set the max acceleration of Joint space

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            acc: max acceleration (°/s^2 or rad/s^2)

            is_radian: if the jerk is in radians or not, defaults to self.default_is_radian

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_joint_maxacc(acc, is_radian=is_radian)

    def set_tcp_load(self, weight, center_of_gravity, wait=False, **kwargs):
        """
        Set the end load of xArm

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            weight: load weight (unit: kg)

            center_of_gravity: load center of gravity, such as [x(mm), y(mm), z(mm)]

            wait: whether to wait for the command to be executed or for the robotic arm to stop

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_tcp_load(weight, center_of_gravity, wait=wait, **kwargs)

    def set_collision_sensitivity(self, value, wait=True):
        """
        Set the sensitivity to collision

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            value: sensitivity value, 0~5

            wait: reversed

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_collision_sensitivity(value, wait=wait)

    def set_teach_sensitivity(self, value, wait=True):
        """
        Set the sensitivity of drag and teach

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            value: sensitivity value, 1~5

            wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_teach_sensitivity(value, wait=wait)

    def set_gravity_direction(self, direction, wait=True):
        """
        Set the gravity direction for proper torque compensation and collision detection.

        Note:
            1. Use only if necessary. Incorrect settings may affect torque compensation.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            direction: Gravity direction vector [x, y, z], e.g., [0, 0, -1] for a floor-mounted arm.

            wait: Whether to wait for the robotic arm to stop or clear all previous queued commands before applying the setting.

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_gravity_direction(direction=direction, wait=wait)

    def set_mount_direction(self, base_tilt_deg, rotation_deg, is_radian=None):
        """
        Set the mount direction

        Note:
            1. Use only if necessary.
            2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
            3. Use clean_conf() to restore the system default settings.

        Args:
            base_tilt_deg: tilt degree

            rotation_deg: rotation degree

            is_radian: if the base_tilt_deg/rotation_deg is in radians or not, defaults to self.default_is_radian

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_mount_direction(base_tilt_deg, rotation_deg, is_radian=is_radian)

    def get_inverse_kinematics(self, pose, input_is_radian=None, return_is_radian=None, limited=True, ref_angles=None):
        """
        Get inverse kinematics

        Note:
            1. the roll/pitch/yaw unit is radian if input_is_radian is True, else °

        Args:
            pose: [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]

            input_is_radian: if the param pose value(only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

            return_is_radian: if the returned value should be in radians or not, defaults to self.default_is_radian

            limited: if the result is limited to within ±180° or not, default is True(only available if firmware_version >= 2.7.103)

            ref_angles: reference values for joint angles
                Note: unit is radian if input_is_radian is True, else °
                Note: only available if firmware_version >= 2.7.103

        Returns:
            out (tuple[int, list]): tuple((code, angles)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            angles (list[float]): [angle-1(rad or °), angle-2, ..., angle-(Number of axes)] or []

                Note: the returned angle value is radians if return_is_radian is True, else °
        """
        return self.arm.get_inverse_kinematics(pose, input_is_radian=input_is_radian, return_is_radian=return_is_radian, limited=limited, ref_angles=ref_angles)

    def get_forward_kinematics(self, angles, input_is_radian=None, return_is_radian=None):
        """
        Get forward kinematics

        Args:
            angles: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

            input_is_radian: the param angles value is in radians or not, defaults to self.default_is_radian

            return_is_radian: the returned value is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, list]): tuple((code, pose)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            pose (list[float]): [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] or []

                Note: the roll/pitch/yaw value is radians if return_is_radian is True, else °
        """
        return self.arm.get_forward_kinematics(angles, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

    def set_tgpio_digital_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
        """
        Set the digital value of the specified Tool GPIO when the robot has reached the specified xyz position           

        Args:
            ionum: 0 or 1

            value: value

            xyz: position xyz, as [x, y, z]

            fault_tolerance_radius: fault tolerance radius

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details. 
        """
        return self.arm.set_tgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

    def set_cgpio_digital_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
        """
        Set the digital value of the specified Controller GPIO when the robot has reached the specified xyz position           

        Args:
            ionum: 0 ~ 15

            value: value

            xyz: position xyz, as [x, y, z]

            fault_tolerance_radius: fault tolerance radius

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.  
        """
        return self.arm.set_cgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

    def set_cgpio_analog_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
        """
        Set the analog value of the specified Controller GPIO when the robot has reached the specified xyz position           

        Args:
            ionum: 0 ~ 1

            value: value

            xyz: position xyz, as [x, y, z]

            fault_tolerance_radius: fault tolerance radius

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.  
        """
        return self.arm.set_cgpio_analog_with_xyz(ionum, value, xyz, fault_tolerance_radius)

    def config_tgpio_reset_when_stop(self, on_off):
        """
        Configure the Tool GPIO reset the digital output when the robot is in stop state

        Args:
            on_off: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.config_io_reset_when_stop(1, on_off)

    def config_cgpio_reset_when_stop(self, on_off):
        """
        Configure the Controller GPIO reset the digital output when the robot is in stop state

        Args:
            on_off: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.config_io_reset_when_stop(0, on_off)

    def set_report_tau_or_i(self, tau_or_i=0):
        """
        Set if torque or electric current is reported

        Args:
            tau_or_i: 
                - 0: torque
                - 1: electric current

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_report_tau_or_i(tau_or_i=tau_or_i)

    def get_report_tau_or_i(self):
        """
        Get the reported torque or electric current

        Returns:
            out (tuple[int, int]): tuple((code, tau_or_i))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            tau_or_i (int): 
                - 0: torque
                - 1: electric current
        """
        return self.arm.get_report_tau_or_i()

    def set_self_collision_detection(self, on_off):
        """
        Set whether to enable self-collision detection 

        Args:
            on_off: enable or not

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_self_collision_detection(on_off)

    def set_collision_tool_model(self, tool_type, *args, **kwargs):
        """
        Set the geometric model of the end effector for self collision detection

        Args:
            tool_type: the geometric model type

                - 0: No end effector, no additional parameters required

                - 1: xArm Gripper, no additional parameters required

                - 2: xArm Vacuum Gripper, no additional parameters required

                - 3: xArm Bio Gripper, no additional parameters required

                - 4: Robotiq-2F-85 Gripper, no additional parameters required

                - 5: Robotiq-2F-140 Gripper, no additional parameters required

                - 7: Lite Gripper, no additional parameters required

                - 8: Lite Vacuum Gripper, no additional parameters required

                - 9: xArm Gripper G2, no additional parameters required

                - 10: PGC-140-50 of the DH-ROBOTICS, no additional parameters required

                - 11: RH56DFX-2L of the INSPIRE-ROBOTS, no additional parameters required

                - 12: RH56DFX-2R of the INSPIRE-ROBOTS, no additional parameters required

                - 13: xArm Bio Gripper G2, no additional parameters required

                - 21: Cylinder, need additional parameters radius, height 

                    - ex: self.set_collision_tool_model(21, radius=45, height=137)

                    - radius: the radius of cylinder, (mm)

                    - height: the height of cylinder, (mm)

                    - x_offset: offset in the x direction, (mm)

                    - y_offset: offset in the y direction, (mm)

                    - z_offset: offset in the z direction, (mm)

                - 22: Cuboid, need additional parameters x, y, z

                    - ex: self.set_collision_tool_model(22, x=234, y=323, z=23)

                    - x: the length of the cuboid in the x coordinate direction, (mm)

                    - y: the length of the cuboid in the y coordinate direction, (mm)

                    - z: the length of the cuboid in the z coordinate direction, (mm)

                    - x_offset: offset in the x direction, (mm)

                    - y_offset: offset in the y direction, (mm)

                    - z_offset: offset in the z direction, (mm)

            args: additional parameters

            kwargs: additional parameters

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_collision_tool_model(tool_type, *args, **kwargs)

    def get_robot_sn(self):
        """
        Gets the xArm sn

        Returns:
            out (tuple[int, str]): tuple((code, sn)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            sn (str): the xArm sn
        """
        return self.arm.get_robot_sn()

    def get_reduced_mode(self):
        """
        Get reduced mode

        Note:
            1. This interface relies on Firmware 1.2.0 or above

        Returns:
            out (tuple[int, int]): tuple((code, mode))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            mode (int): 0 or 1, 1 means the reduced mode is on. 0 means the reduced mode is not on
        """
        return self.arm.get_reduced_mode()

    def get_reduced_states(self, is_radian=None):
        """
        Get states of the reduced mode

        Note:
            1. This interface relies on Firmware 1.2.0 or above

        Args:
            is_radian: if the max_joint_speed of the states is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, list]): tuple((code, states))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            states (list): [....]

                if version > 1.2.11:

                states: [

                   reduced_mode_is_on,

                   [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

                   reduced_max_tcp_speed,

                   reduced_max_joint_speed,

                   joint_ranges([joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]),

                   safety_boundary_is_on,

                   collision_rebound_is_on,

                ]

                if version <= 1.2.11:

                states: [

                reduced_mode_is_on,

                [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

                reduced_max_tcp_speed,

                reduced_max_joint_speed,

                ]

        """
        return self.arm.get_reduced_states(is_radian=is_radian)

    def set_reduced_max_tcp_speed(self, speed):
        """
        Set the maximum tcp speed of the reduced mode

        Note:
            1. This interface relies on Firmware 1.2.0 or above
            2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

        Args:
            speed: speed (mm/s)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_reduced_max_tcp_speed(speed)

    def set_reduced_max_joint_speed(self, speed, is_radian=None):
        """
        Set the maximum joint speed of the reduced mode

        Note:
            1. This interface relies on Firmware 1.2.0 or above
            2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

        Args:
            speed: speed (°/s or rad/s)

            is_radian: the speed is in radians or not, defaults to self.default_is_radian

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_reduced_max_joint_speed(speed, is_radian=is_radian)

    def set_reduced_tcp_boundary(self, boundary):
        """
        Set the boundary of the safety boundary mode

        Note:
            1. This interface relies on Firmware 1.2.0 or above
            2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

        Args:
            boundary: [x_max, x_min, y_max, y_min, z_max, z_min]

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_reduced_tcp_boundary(boundary)

    def set_reduced_joint_range(self, joint_range, is_radian=None):
        """
        Set the joint range of the reduced mode

        Note:
            1. This interface relies on Firmware 1.2.11 or above
            2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

        Args:
            joint_range: [joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]

            is_radian: the param joint_range are in radians or not, defaults to self.default_is_radian

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_reduced_joint_range(joint_range, is_radian=is_radian)

    def set_fence_mode(self, on):
        """
        Turn on/off fence mode

        Note:
            1. This interface relies on Firmware 1.2.11 or above

        Args:
            on: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_fense_mode(on)

    def set_collision_rebound(self, on):
        """
        Turn on/off collision rebound

        Note:
            1. This interface relies on Firmware 1.2.11 or above

        Args:
            on: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_collision_rebound(on)

    def set_world_offset(self, offset, is_radian=None, wait=True):
        """
        Set the base coordinate offset

        Note:
            1. This interface relies on Firmware 1.2.11 or above

        Args:
            offset: [x, y, z, roll, pitch, yaw]

            is_radian: if the roll/pitch/yaw is in radians or not, defaults to self.default_is_radian

            wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed/cleared before setting

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_world_offset(offset, is_radian=is_radian, wait=wait)

    def is_tcp_limit(self, pose, is_radian=None):
        """
        Check the tcp pose is within limit

        Args:
            pose: [x, y, z, roll, pitch, yaw]

            is_radian: roll/pitch/yaw value is radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, bool]): tuple((code, limit)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            limit (bool): True/False/None, limit or not, or failed
        """
        return self.arm.is_tcp_limit(pose, is_radian=is_radian)

    def is_joint_limit(self, joint, is_radian=None):
        """
        Check the joint angle is within limit

        Args:
            joint: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

            is_radian: angle value is radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, bool]): tuple((code, limit)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            limit (bool): True/False/None, limit or not, or failed
        """
        return self.arm.is_joint_limit(joint, is_radian=is_radian)

    def get_servo_debug_msg(self, show=False, lang='en'):
        """
        Get the servo debug msg, used only for debugging

        Args:
            show: show the detail info if True

            lang: language, en/cn, default is en

        Returns:
            out (tuple[int, list]): tuple((code, servo_info_list)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.get_servo_debug_msg(show=show, lang=lang)

    def get_gripper_version(self):
        """
        Get gripper version, only for debug

        Returns:
            out (tuple[int, str]): tuple((code, version))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            version (str): gripper version
        """
        return self.arm.get_gripper_version()

    def get_servo_version(self, servo_id=1):
        """
        Get servo version, only for debug

        Args:
            servo_id: servo id(1~7)

        Returns:
            out (tuple[int, str]): tuple((code, version))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            version (str): servo version
        """
        return self.arm.get_servo_version(servo_id=servo_id)

    def get_tgpio_version(self):
        """
        Get tool gpio version, only for debug

        Returns:
            out (tuple[int, str]): tuple((code, version))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            version (str): tool gpio version
        """
        return self.arm.get_tgpio_version()

    def get_harmonic_type(self, servo_id=1):
        """
        Get harmonic type, only for debug

        Returns:
            out (tuple[int, int]): (code, type)

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            type (int): harmonic type
        """
        return self.arm.get_harmonic_type(servo_id=servo_id)

    def get_hd_types(self):
        """
        Get harmonic types, only for debug

        Returns:
            out (tuple[int, list]): (code, types)

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            types (list): list of harmonic types
        """
        return self.arm.get_hd_types()

    def set_counter_reset(self):
        """
        Reset counter value

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_counter_reset()

    def set_counter_increase(self, val=1):
        """
        Set counter plus value, only supports increasing by 1

        Args:
            val: reversed

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_counter_increase(val)

    def get_joints_torque(self):
        """
        Get joint torque

        Returns:
            out (tuple[int, list]): tuple((code, joints_torque))

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            joints_torque (list): joint torque
        """
        return self.arm.get_joints_torque()

    def set_timeout(self, timeout):
        """
        Set the timeout of cmd response

        Args:
            timeout: seconds
        """
        return self.arm.set_timeout(timeout)

    def set_baud_checkset_enable(self, enable):
        """
        Enable auto checkset the baudrate of the end IO board or not

        Note:
            only available in the API of gripper/bio/robotiq/linear_motor.

        Args:
            enable: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_baud_checkset_enable(enable)

    def set_checkset_default_baud(self, type_, baud):
        """
        Set the checkset baud value

        Args:
            type_: checkset type
                - 1: xarm gripper
                - 2: bio gripper
                - 3: robotiq gripper
                - 4: linear motor

            baud: checkset baud value, less than or equal to 0 means disable checkset

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_checkset_default_baud(type_, baud)

    def get_checkset_default_baud(self, type_):
        """
        Get the checkset baud value

        Args:
            type_: checkset type
                - 1: xarm gripper
                - 2: bio gripper
                - 3: robotiq gripper
                - 4: linear motor

        Returns:
            out (tuple[int, int]): (code, baud)

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            baud (int): the checkset baud value
        """
        return self.arm.get_checkset_default_baud(type_)

    def calibrate_tcp_coordinate_offset(self, four_points, is_radian=None):
        """
        Four-point method to calibrate tool coordinate system position offset

        Note:
            1. only available if firmware_version >= 1.6.9

        Args:
            four_points: a list of four teaching coordinate positions [x, y, z, roll, pitch, yaw]

            is_radian: if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

        Returns:
            out: tuple((code, xyz_offset)), returned result is only corrent when code is 0.

            code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            xyz_offset: calculated xyz(mm) TCP offset, [x, y, z] 
        """
        return self.arm.calibrate_tcp_coordinate_offset(four_points, is_radian=is_radian)

    def calibrate_tcp_orientation_offset(self, rpy_be, rpy_bt, input_is_radian=None, return_is_radian=None):
        """
        An additional teaching point to calibrate the tool coordinate system attitude offset

        Note:
            1. only available if firmware_version >= 1.6.9

        Args:
            rpy_be: the rpy value of the teaching point without TCP offset [roll, pitch, yaw]

            rpy_bt: the rpy value of the teaching point with TCP offset [roll, pitch, yaw]

            input_is_radian: if the roll/pitch/yaw value of rpy_be and rpy_bt is in radians or not, defaults to self.default_is_radian

            return_is_radian: if the roll/pitch/yaw value of result is in radians or not, defaults to self.default_is_radian

        Returns:
            out: tuple((code, rpy_offset)), returned result is only corrent when code is 0.

            code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            rpy_offset: calculated rpy TCP offset, [roll, pitch, yaw]
        """
        return self.arm.calibrate_tcp_orientation_offset(rpy_be, rpy_bt, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

    def calibrate_user_orientation_offset(self, three_points, mode=0, trust_ind=0, input_is_radian=None, return_is_radian=None):
        """
        Three-point method teaches user coordinate system posture offset

        Note:
            1. only available if firmware_version >= 1.6.9
            2. First determine a point in the working space, move along the desired coordinate system x+ to determine the second point,
            and then move along the desired coordinate system y+ to determine the third point. 
            3. Note that the x+ direction is as accurate as possible. 
            4. If the y+ direction is not completely perpendicular to x+, it will be corrected in the calculation process.

        Args:
            three_points: a list of teaching TCP coordinate positions [x, y, z, roll, pitch, yaw]

            input_is_radian: if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

            return_is_radian: if the roll/pitch/yaw value of the result should be in radians or not, defaults to self.default_is_radian

        Returns:
            out: tuple((code, rpy_offset)), returned result is only corrent when code is 0.

            code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            rpy_offset: calculated rpy user offset, [roll, pitch, yaw]
        """
        return self.arm.calibrate_user_orientation_offset(three_points, mode=mode, trust_ind=trust_ind, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

    def calibrate_user_coordinate_offset(self, rpy_ub, pos_b_uorg, is_radian=None):
        """
        An additional teaching point determines the position offset of the user coordinate system.

        Note:
            1. only available if firmware_version >= 1.6.9

        Args:
            rpy_ub: the confirmed offset of the base coordinate system in the user coordinate system [roll, pitch, yaw], the result of calibrate_user_orientation_offset()

            pos_b_uorg: the position of the teaching point in the base coordinate system [x, y, z], if the arm cannot reach the target position, the user can manually input the position of the target in the base coordinate.

            is_radian: if the roll/pitch/yaw value of rpy_ub is in radians or not, defaults to self.default_is_radian

        Returns:
            out: tuple((code, xyz_offset)), returned result is only corrent when code is 0.

            code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            xyz_offset: calculated xyz(mm) user offset, [x, y, z] 
        """
        return self.arm.calibrate_user_coordinate_offset(rpy_ub, pos_b_uorg, is_radian=is_radian)

    def set_simulation_robot(self, on_off):
        """
        Set the simulation robot

        Args:
            on_off: True/False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_simulation_robot(on_off)

    def get_base_board_version(self, board_id=10):
        """
         Get base board version

        Args:
            board_id: int

        Returns:
            out (tuple[int, str]): (code, version)

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            version (str): base board version
        """
        return self.arm.get_base_board_version(board_id)

    def iden_tcp_load(self, estimated_mass=0):
        """
        Identification the tcp load with current

        Note:
            1. only available if firmware_version >= 1.8.0

        Args:
            estimated_mass: estimated mass

                Note: this parameter is only available on the lite6 model manipulator, and this parameter must be specified for the lite6 model manipulator

        Returns:
            out (tuple[int, list]): tuple((code, load)) returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            load (list): [mass, x_centroid, y_centroid, z_centroid]

        """
        return self.arm.iden_tcp_load(estimated_mass)

    def get_initial_point(self):
        """
        Get the initial point from studio

        Returns:
            out (tuple[int, list]): tuple((code, point)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            point (list): initial point, [J1, J2, ..., J7]
        """
        return self.arm._studio.get_initial_point()

    def set_initial_point(self, point):
        """
        Set the initial point

        Args:
            point: initial point, [J1, J2, ..., J7]

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details. 
        """
        return self.arm._studio.set_initial_point(point)

    def get_mount_direction(self):
        """
        Get the mount degrees from studio

        Returns:
            ou (tuple[int, list]): tuple((code, degrees)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            degrees (list): mount degrees, [tilt angle, rotate angle]
        """
        return self.arm._studio.get_mount_direction()

    def set_cartesian_velo_continuous(self, on_off):
        """
        Set cartesian motion velocity continuous

        Note:
            1. only available if firmware_version >= 1.9.0

        Args:
            on_off: whether motion is continuous or not, True: continuous, defaults to False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_cartesian_velo_continuous(on_off)

    def set_allow_approx_motion(self, on_off):
        """
        Settings to allow avoiding overspeed near some singularities using approximate solutions

        Note:
            1. only available if firmware_version >= 1.9.0

        Args:
            on_off: whether to allow or not, True: allow, default is False

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_allow_approx_motion(on_off)

    def get_allow_approx_motion(self):
        """
        Obtain whether to enable approximate solutions to avoid certain singularities

        Note:
            1. only available if firmware_version >= 1.9.0

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.get_allow_approx_motion()

    def get_joint_states(self, is_radian=None, num=3):
        """
        Get the joint states

        Note:
            1. only available if firmware_version >= 1.9.0

        Args:
            is_radian: if the returned value(position and velocity) is in radians or not, defaults to self.default_is_radian

        Returns:
            out (tuple[int, [list]]): tuple((code, [position, velocity, effort])), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            position (list[float]): the angles of joints, like [angle-1, ..., angle-7]

            velocity (list[float]): the velocities of joints, like [velo-1, ..., velo-7]

            effort (list[float]): the efforts of joints, like [effort-1, ..., effort-7]
        """
        return self.arm.get_joint_states(is_radian=is_radian, num=num)

    def iden_joint_friction(self, sn=None):
        """
        Identification of the friction

        Note:
            1. only available if firmware_version >= 1.9.0

        Args:
            sn: sn value

        Returns:
            out (tuple[int, int]): tuple((code, result)) returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            result (int): 
                - 0: success
                - -1: failure
        """
        return self.arm.iden_joint_friction(sn)

    def set_only_check_type(self, only_check_type=0):
        """
        Set the motion process detection type (valid for all motion interfaces of the current SDK instance)

        Note:
            1. only available if firmware_version >= 1.11.100
            2. This interface is a global configuration item of the current SDK, and affects all motion-related interfaces
            3. Generally, you only need to call when you don't want to move the robotic arm and only check whether some paths will have self-collision/angle-limit/cartesian-limit/overspeed.
            4. Currently only self-collision/angle-limit/cartesian-limit/overspeed are detected
            5. If only_check_type is set to be greater than 0, and the return value of calling the motion interface is not 0, you can view arm.only_check_result to view the specific error code

        Example: (Common scenarios, here is an example of the set_position interface)
            - 1. Check whether the process from point A to point B is normal (no self-collision and overspeed triggered)

                - 1.1 Move to point A

                    - arm.set_only_check_type(0)

                    - code = arm.set_position(A)

                - 1.2 Check if the process from point A to point B is normal (no self-collision and overspeed triggered)

                    - arm.set_only_check_type(1)

                    - code = arm.set_position(B)

                    - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                    - arm.set_only_check_type(0)


            - 2. Check whether the process from point A to point B, C, and D to point E is normal (no self-collision and overspeed are triggered)

                - 2.1 Move to point A

                    - arm.set_only_check_type(0)

                    - code = arm.set_position(A)

                - 2.2 Check whether the process of point A passing through points B, C, D to point E is normal (no self-collision and overspeed are triggered)

                    - arm.set_only_check_type(3)

                    - code = arm.set_position(B)

                    - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                    - code = arm.set_position(C)

                    - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                    - code = arm.set_position(D)

                    - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                    - code = arm.set_position(E)

                    - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                    - arm.set_only_check_type(0)

        Args:
            only_check_type: Motion Detection Type

                - only_check_type == 0: Restore the original function of the motion interface, it will move, the default is 0

                - only_check_type == 1: Only check the self-collision without moving, take the actual state of the manipulator as the initial planned path, and check whether the path has self-collision (the intermediate state will be updated at this time)

                - only_check_type == 2: Only check the self-collision without moving, use the intermediate state as the starting planning path, check whether the path has self-collision (the intermediate state will be updated at this time), and restore the intermediate state to the actual state after the end

                - only_check_type == 3: Only check the self-collision without moving, use the intermediate state as the starting planning path, and check whether the path has self-collision (the intermediate state will be updated at this time)

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_only_check_type(only_check_type)

    def get_dh_params(self):
        """
        Get the DH parameters

        Note:
            1. only available if firmware_version >= 2.0.0

        Returns:
            out (tuple[int, list]): tuple((code, dh_params)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            dh_params (list[float]): DH parameters

                - dh_params[0:4]: DH parameters of Joint-1

                - dh_params[4:8]: DH parameters of Joint-2

                - ...

                - dh_params[24:28]: DH parameters of Joint-7
        """
        return self.arm.get_dh_params()

    def set_dh_params(self, dh_params, flag=0):
        """
        Set the DH parameters

        Note:
            1. only available if firmware_version >= 2.0.0
            2. this interface is only provided for users who need to use external DH parameters, ordinary users should not try to modify DH parameters.

        Args:
            dh_params: DH parameters

            flag: 
                - 0: Use the set DH parameters, but do not write to the configuration file
                - 1: Use the set DH parameters and write to the configuration file
                - 2: Use the set DH parameters and delete the DH parameters of the configuration file
                - 3: Use the default DH parameters, but will not delete the DH parameters of the configuration file
                - 4: Use the default DH parameters and delete the DH parameters of the configuration file

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_dh_params(dh_params, flag) 

    def set_feedback_type(self, feedback_type):
        """
        Set the feedback type

        Note:
            1. only available if firmware_version >= 2.1.0
            2. only works in position mode
            3. the setting will only affect subsequent tasks and will not affect previously cached tasks
            4. only valid for the current connection

        Args:
            feedback_type:
                - 0: disable feedback
                - 1: feedback when the motion task starts executing
                - 2: feedback when the motion task execution ends or motion task is discarded(usually when the distance is too close to be planned)
                - 4: feedback when the non-motion task is triggered

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_feedback_type(feedback_type)

    def set_linear_spd_limit_factor(self, factor):
        """
        Set linear speed limit factor (default is 1.2)

        Note:
            1. only available if firmware_version >= 2.3.0
            2. only available in mode 1

        Args:
            factor: speed limit factor

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_linear_spd_limit_factor(factor)

    def set_cmd_mat_history_num(self, num):
        """
        Set cmd mat history num

        Note:
            Only available if firmware_version >= 2.3.0

        Args:
            num: history num

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_cmd_mat_history_num(num)

    def set_fdb_mat_history_num(self, num):
        """
        Set fdb mat history num

        Note:
            Only available if firmware_version >= 2.3.0

        Args:
            num: history num

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_fdb_mat_history_num(num)

    def get_linear_spd_limit_factor(self):
        """
        Get linear speed limit factor

        Note:
            Only available if firmware_version >= 2.3.0

        Returns:
            out (tuple[int, float]): tuple((code, factor)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            factor (float): linear speed limit factor
        """
        return self.arm.get_linear_spd_limit_factor()

    def get_cmd_mat_history_num(self):
        """
        Get cmd mat history num

        Note:
            Only available if firmware_version >= 2.3.0

        Returns:
            out (tuple[int, int]): tuple((code, num)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            num (int): cmd mat history num
        """
        return self.arm.get_cmd_mat_history_num()

    def get_fdb_mat_history_num(self):
        """
        Get fdb mat history num

        Note:
            Only available if firmware_version >= 2.3.0

        Returns:
            out (tuple[int, int]): tuple((code, num)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            num (int): fdb mat history num
        """
        return self.arm.get_fdb_mat_history_num()

    def get_poe_status(self):
        """
        Get poe status

        Note:
            Only available if firmware_version >= 2.3.0

        Returns:
            out (tuple[int, int]): tuple((code, status)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            status (int): 1 means poe is valid, 0 means poe is invalid
        """
        return self.arm.get_poe_status()

    def get_iden_status(self):
        """
        Get iden status

        Note:
            Only available if firmware_version >= 2.3.0

        Returns:
            out (tuple[int, int]): tuple((code, status)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            status (int): 1 means in identifying, 0 means not in identifying
        """
        return self.arm.get_iden_status()    

    def set_external_device_monitor_params(self, dev_type, frequency):
        """
        Set the monitor params of the external device

        Note:
            1. only available if firmware_version >= 2.7.100
            2. after it is turned on, the position/speed/current information of the external device will be reported through port 30000
            3. once an error occurs, you need to re call to monitor

        Args:
            dev_type: the type of the external device

                - 0: Turn off monitoring

                - 1: xArm Gripper

                - 2: xArm Gripper G2

                - 3: BIO Gripper G2

                - 4: Robotiq 2F-85/Robotiq 2F-140

            frequency: the frequency of communication with the external device

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_external_device_monitor_params(dev_type, frequency)

    def get_external_device_monitor_params(self):
        """
        Get the monitor params of the external device

        Note:
            1. only available if firmware_version >= 2.7.100

        Returns:
            out tuple[int, int]: tuple((code, params)), returned result is only corrent when code is 0.

            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

            params (int): [dev_type, frequency]
        """
        return self.arm.get_external_device_monitor_params()

calibrate_tcp_coordinate_offset(four_points, is_radian=None)

Four-point method to calibrate tool coordinate system position offset

Note
  1. only available if firmware_version >= 1.6.9

Parameters:

Name Type Description Default
four_points

a list of four teaching coordinate positions [x, y, z, roll, pitch, yaw]

required
is_radian

if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out

tuple((code, xyz_offset)), returned result is only corrent when code is 0.

code

See the API Code Documentation for details.

xyz_offset

calculated xyz(mm) TCP offset, [x, y, z]

Source code in actions\settings.py
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
def calibrate_tcp_coordinate_offset(self, four_points, is_radian=None):
    """
    Four-point method to calibrate tool coordinate system position offset

    Note:
        1. only available if firmware_version >= 1.6.9

    Args:
        four_points: a list of four teaching coordinate positions [x, y, z, roll, pitch, yaw]

        is_radian: if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

    Returns:
        out: tuple((code, xyz_offset)), returned result is only corrent when code is 0.

        code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        xyz_offset: calculated xyz(mm) TCP offset, [x, y, z] 
    """
    return self.arm.calibrate_tcp_coordinate_offset(four_points, is_radian=is_radian)

calibrate_tcp_orientation_offset(rpy_be, rpy_bt, input_is_radian=None, return_is_radian=None)

An additional teaching point to calibrate the tool coordinate system attitude offset

Note
  1. only available if firmware_version >= 1.6.9

Parameters:

Name Type Description Default
rpy_be

the rpy value of the teaching point without TCP offset [roll, pitch, yaw]

required
rpy_bt

the rpy value of the teaching point with TCP offset [roll, pitch, yaw]

required
input_is_radian

if the roll/pitch/yaw value of rpy_be and rpy_bt is in radians or not, defaults to self.default_is_radian

None
return_is_radian

if the roll/pitch/yaw value of result is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out

tuple((code, rpy_offset)), returned result is only corrent when code is 0.

code

See the API Code Documentation for details.

rpy_offset

calculated rpy TCP offset, [roll, pitch, yaw]

Source code in actions\settings.py
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
def calibrate_tcp_orientation_offset(self, rpy_be, rpy_bt, input_is_radian=None, return_is_radian=None):
    """
    An additional teaching point to calibrate the tool coordinate system attitude offset

    Note:
        1. only available if firmware_version >= 1.6.9

    Args:
        rpy_be: the rpy value of the teaching point without TCP offset [roll, pitch, yaw]

        rpy_bt: the rpy value of the teaching point with TCP offset [roll, pitch, yaw]

        input_is_radian: if the roll/pitch/yaw value of rpy_be and rpy_bt is in radians or not, defaults to self.default_is_radian

        return_is_radian: if the roll/pitch/yaw value of result is in radians or not, defaults to self.default_is_radian

    Returns:
        out: tuple((code, rpy_offset)), returned result is only corrent when code is 0.

        code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        rpy_offset: calculated rpy TCP offset, [roll, pitch, yaw]
    """
    return self.arm.calibrate_tcp_orientation_offset(rpy_be, rpy_bt, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

calibrate_user_coordinate_offset(rpy_ub, pos_b_uorg, is_radian=None)

An additional teaching point determines the position offset of the user coordinate system.

Note
  1. only available if firmware_version >= 1.6.9

Parameters:

Name Type Description Default
rpy_ub

the confirmed offset of the base coordinate system in the user coordinate system [roll, pitch, yaw], the result of calibrate_user_orientation_offset()

required
pos_b_uorg

the position of the teaching point in the base coordinate system [x, y, z], if the arm cannot reach the target position, the user can manually input the position of the target in the base coordinate.

required
is_radian

if the roll/pitch/yaw value of rpy_ub is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out

tuple((code, xyz_offset)), returned result is only corrent when code is 0.

code

See the API Code Documentation for details.

xyz_offset

calculated xyz(mm) user offset, [x, y, z]

Source code in actions\settings.py
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
def calibrate_user_coordinate_offset(self, rpy_ub, pos_b_uorg, is_radian=None):
    """
    An additional teaching point determines the position offset of the user coordinate system.

    Note:
        1. only available if firmware_version >= 1.6.9

    Args:
        rpy_ub: the confirmed offset of the base coordinate system in the user coordinate system [roll, pitch, yaw], the result of calibrate_user_orientation_offset()

        pos_b_uorg: the position of the teaching point in the base coordinate system [x, y, z], if the arm cannot reach the target position, the user can manually input the position of the target in the base coordinate.

        is_radian: if the roll/pitch/yaw value of rpy_ub is in radians or not, defaults to self.default_is_radian

    Returns:
        out: tuple((code, xyz_offset)), returned result is only corrent when code is 0.

        code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        xyz_offset: calculated xyz(mm) user offset, [x, y, z] 
    """
    return self.arm.calibrate_user_coordinate_offset(rpy_ub, pos_b_uorg, is_radian=is_radian)

calibrate_user_orientation_offset(three_points, mode=0, trust_ind=0, input_is_radian=None, return_is_radian=None)

Three-point method teaches user coordinate system posture offset

Note
  1. only available if firmware_version >= 1.6.9
  2. First determine a point in the working space, move along the desired coordinate system x+ to determine the second point, and then move along the desired coordinate system y+ to determine the third point.
  3. Note that the x+ direction is as accurate as possible.
  4. If the y+ direction is not completely perpendicular to x+, it will be corrected in the calculation process.

Parameters:

Name Type Description Default
three_points

a list of teaching TCP coordinate positions [x, y, z, roll, pitch, yaw]

required
input_is_radian

if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

None
return_is_radian

if the roll/pitch/yaw value of the result should be in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out

tuple((code, rpy_offset)), returned result is only corrent when code is 0.

code

See the API Code Documentation for details.

rpy_offset

calculated rpy user offset, [roll, pitch, yaw]

Source code in actions\settings.py
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
def calibrate_user_orientation_offset(self, three_points, mode=0, trust_ind=0, input_is_radian=None, return_is_radian=None):
    """
    Three-point method teaches user coordinate system posture offset

    Note:
        1. only available if firmware_version >= 1.6.9
        2. First determine a point in the working space, move along the desired coordinate system x+ to determine the second point,
        and then move along the desired coordinate system y+ to determine the third point. 
        3. Note that the x+ direction is as accurate as possible. 
        4. If the y+ direction is not completely perpendicular to x+, it will be corrected in the calculation process.

    Args:
        three_points: a list of teaching TCP coordinate positions [x, y, z, roll, pitch, yaw]

        input_is_radian: if the roll/pitch/yaw value of each point is in radians or not, defaults to self.default_is_radian

        return_is_radian: if the roll/pitch/yaw value of the result should be in radians or not, defaults to self.default_is_radian

    Returns:
        out: tuple((code, rpy_offset)), returned result is only corrent when code is 0.

        code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        rpy_offset: calculated rpy user offset, [roll, pitch, yaw]
    """
    return self.arm.calibrate_user_orientation_offset(three_points, mode=mode, trust_ind=trust_ind, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

config_cgpio_reset_when_stop(on_off)

Configure the Controller GPIO reset the digital output when the robot is in stop state

Parameters:

Name Type Description Default
on_off

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
550
551
552
553
554
555
556
557
558
559
560
def config_cgpio_reset_when_stop(self, on_off):
    """
    Configure the Controller GPIO reset the digital output when the robot is in stop state

    Args:
        on_off: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.config_io_reset_when_stop(0, on_off)

config_tgpio_reset_when_stop(on_off)

Configure the Tool GPIO reset the digital output when the robot is in stop state

Parameters:

Name Type Description Default
on_off

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
538
539
540
541
542
543
544
545
546
547
548
def config_tgpio_reset_when_stop(self, on_off):
    """
    Configure the Tool GPIO reset the digital output when the robot is in stop state

    Args:
        on_off: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.config_io_reset_when_stop(1, on_off)

get_allow_approx_motion()

Obtain whether to enable approximate solutions to avoid certain singularities

Note
  1. only available if firmware_version >= 1.9.0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
def get_allow_approx_motion(self):
    """
    Obtain whether to enable approximate solutions to avoid certain singularities

    Note:
        1. only available if firmware_version >= 1.9.0

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.get_allow_approx_motion()

get_base_board_version(board_id=10)

Get base board version

Parameters:

Name Type Description Default
board_id

int

10

Returns:

Name Type Description
out tuple[int, str]

(code, version)

code int

See the API Code Documentation for details.

version str

base board version

Source code in actions\settings.py
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
def get_base_board_version(self, board_id=10):
    """
     Get base board version

    Args:
        board_id: int

    Returns:
        out (tuple[int, str]): (code, version)

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        version (str): base board version
    """
    return self.arm.get_base_board_version(board_id)

get_checkset_default_baud(type_)

Get the checkset baud value

Parameters:

Name Type Description Default
type_

checkset type - 1: xarm gripper - 2: bio gripper - 3: robotiq gripper - 4: linear motor

required

Returns:

Name Type Description
out tuple[int, int]

(code, baud)

code int

See the API Code Documentation for details.

baud int

the checkset baud value

Source code in actions\settings.py
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
def get_checkset_default_baud(self, type_):
    """
    Get the checkset baud value

    Args:
        type_: checkset type
            - 1: xarm gripper
            - 2: bio gripper
            - 3: robotiq gripper
            - 4: linear motor

    Returns:
        out (tuple[int, int]): (code, baud)

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        baud (int): the checkset baud value
    """
    return self.arm.get_checkset_default_baud(type_)

get_cmd_mat_history_num()

Get cmd mat history num

Note

Only available if firmware_version >= 2.3.0

Returns:

Name Type Description
out tuple[int, int]

tuple((code, num)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

num int

cmd mat history num

Source code in actions\settings.py
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
def get_cmd_mat_history_num(self):
    """
    Get cmd mat history num

    Note:
        Only available if firmware_version >= 2.3.0

    Returns:
        out (tuple[int, int]): tuple((code, num)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        num (int): cmd mat history num
    """
    return self.arm.get_cmd_mat_history_num()

get_cmdnum()

Get the cmd count in cache

Returns:

Name Type Description
out tuple[int, int]

tuple((code, cmd_num)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

cmd_num int

command count in cache

Source code in actions\settings.py
140
141
142
143
144
145
146
147
148
149
150
151
def get_cmdnum(self):
    """
    Get the cmd count in cache

    Returns:
        out (tuple[int, int]): tuple((code, cmd_num)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        cmd_num (int): command count in cache
    """
    return self.arm.get_cmdnum()

get_dh_params()

Get the DH parameters

Note
  1. only available if firmware_version >= 2.0.0

Returns:

Name Type Description
out tuple[int, list]

tuple((code, dh_params)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

dh_params list[float]

DH parameters

  • dh_params[0:4]: DH parameters of Joint-1

  • dh_params[4:8]: DH parameters of Joint-2

  • ...

  • dh_params[24:28]: DH parameters of Joint-7

Source code in actions\settings.py
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
def get_dh_params(self):
    """
    Get the DH parameters

    Note:
        1. only available if firmware_version >= 2.0.0

    Returns:
        out (tuple[int, list]): tuple((code, dh_params)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        dh_params (list[float]): DH parameters

            - dh_params[0:4]: DH parameters of Joint-1

            - dh_params[4:8]: DH parameters of Joint-2

            - ...

            - dh_params[24:28]: DH parameters of Joint-7
    """
    return self.arm.get_dh_params()

get_external_device_monitor_params()

Get the monitor params of the external device

Note
  1. only available if firmware_version >= 2.7.100

Returns:

Name Type Description

out tuple[int, int]: tuple((code, params)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

params int

[dev_type, frequency]

Source code in actions\settings.py
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
def get_external_device_monitor_params(self):
    """
    Get the monitor params of the external device

    Note:
        1. only available if firmware_version >= 2.7.100

    Returns:
        out tuple[int, int]: tuple((code, params)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        params (int): [dev_type, frequency]
    """
    return self.arm.get_external_device_monitor_params()

get_fdb_mat_history_num()

Get fdb mat history num

Note

Only available if firmware_version >= 2.3.0

Returns:

Name Type Description
out tuple[int, int]

tuple((code, num)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

num int

fdb mat history num

Source code in actions\settings.py
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
def get_fdb_mat_history_num(self):
    """
    Get fdb mat history num

    Note:
        Only available if firmware_version >= 2.3.0

    Returns:
        out (tuple[int, int]): tuple((code, num)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        num (int): fdb mat history num
    """
    return self.arm.get_fdb_mat_history_num()

get_forward_kinematics(angles, input_is_radian=None, return_is_radian=None)

Get forward kinematics

Parameters:

Name Type Description Default
angles

[angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

required
input_is_radian

the param angles value is in radians or not, defaults to self.default_is_radian

None
return_is_radian

the returned value is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, pose)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

pose list[float]

[x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] or []

Note: the roll/pitch/yaw value is radians if return_is_radian is True, else °

Source code in actions\settings.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
def get_forward_kinematics(self, angles, input_is_radian=None, return_is_radian=None):
    """
    Get forward kinematics

    Args:
        angles: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

        input_is_radian: the param angles value is in radians or not, defaults to self.default_is_radian

        return_is_radian: the returned value is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, list]): tuple((code, pose)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        pose (list[float]): [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] or []

            Note: the roll/pitch/yaw value is radians if return_is_radian is True, else °
    """
    return self.arm.get_forward_kinematics(angles, input_is_radian=input_is_radian, return_is_radian=return_is_radian)

get_gripper_version()

Get gripper version, only for debug

Returns:

Name Type Description
out tuple[int, str]

tuple((code, version))

code int

See the API Code Documentation for details.

version str

gripper version

Source code in actions\settings.py
927
928
929
930
931
932
933
934
935
936
937
938
def get_gripper_version(self):
    """
    Get gripper version, only for debug

    Returns:
        out (tuple[int, str]): tuple((code, version))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        version (str): gripper version
    """
    return self.arm.get_gripper_version()

get_harmonic_type(servo_id=1)

Get harmonic type, only for debug

Returns:

Name Type Description
out tuple[int, int]

(code, type)

code int

See the API Code Documentation for details.

type int

harmonic type

Source code in actions\settings.py
969
970
971
972
973
974
975
976
977
978
979
980
def get_harmonic_type(self, servo_id=1):
    """
    Get harmonic type, only for debug

    Returns:
        out (tuple[int, int]): (code, type)

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        type (int): harmonic type
    """
    return self.arm.get_harmonic_type(servo_id=servo_id)

get_hd_types()

Get harmonic types, only for debug

Returns:

Name Type Description
out tuple[int, list]

(code, types)

code int

See the API Code Documentation for details.

types list

list of harmonic types

Source code in actions\settings.py
982
983
984
985
986
987
988
989
990
991
992
993
def get_hd_types(self):
    """
    Get harmonic types, only for debug

    Returns:
        out (tuple[int, list]): (code, types)

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        types (list): list of harmonic types
    """
    return self.arm.get_hd_types()

get_iden_status()

Get iden status

Note

Only available if firmware_version >= 2.3.0

Returns:

Name Type Description
out tuple[int, int]

tuple((code, status)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

status int

1 means in identifying, 0 means not in identifying

Source code in actions\settings.py
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
def get_iden_status(self):
    """
    Get iden status

    Note:
        Only available if firmware_version >= 2.3.0

    Returns:
        out (tuple[int, int]): tuple((code, status)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        status (int): 1 means in identifying, 0 means not in identifying
    """
    return self.arm.get_iden_status()    

get_initial_point()

Get the initial point from studio

Returns:

Name Type Description
out tuple[int, list]

tuple((code, point)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

point list

initial point, [J1, J2, ..., J7]

Source code in actions\settings.py
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
def get_initial_point(self):
    """
    Get the initial point from studio

    Returns:
        out (tuple[int, list]): tuple((code, point)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        point (list): initial point, [J1, J2, ..., J7]
    """
    return self.arm._studio.get_initial_point()

get_inverse_kinematics(pose, input_is_radian=None, return_is_radian=None, limited=True, ref_angles=None)

Get inverse kinematics

Note
  1. the roll/pitch/yaw unit is radian if input_is_radian is True, else °

Parameters:

Name Type Description Default
pose

[x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]

required
input_is_radian

if the param pose value(only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

None
return_is_radian

if the returned value should be in radians or not, defaults to self.default_is_radian

None
limited

if the result is limited to within ±180° or not, default is True(only available if firmware_version >= 2.7.103)

True
ref_angles

reference values for joint angles Note: unit is radian if input_is_radian is True, else ° Note: only available if firmware_version >= 2.7.103

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, angles)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

angles list[float]

[angle-1(rad or °), angle-2, ..., angle-(Number of axes)] or []

Note: the returned angle value is radians if return_is_radian is True, else °

Source code in actions\settings.py
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
def get_inverse_kinematics(self, pose, input_is_radian=None, return_is_radian=None, limited=True, ref_angles=None):
    """
    Get inverse kinematics

    Note:
        1. the roll/pitch/yaw unit is radian if input_is_radian is True, else °

    Args:
        pose: [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]

        input_is_radian: if the param pose value(only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

        return_is_radian: if the returned value should be in radians or not, defaults to self.default_is_radian

        limited: if the result is limited to within ±180° or not, default is True(only available if firmware_version >= 2.7.103)

        ref_angles: reference values for joint angles
            Note: unit is radian if input_is_radian is True, else °
            Note: only available if firmware_version >= 2.7.103

    Returns:
        out (tuple[int, list]): tuple((code, angles)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        angles (list[float]): [angle-1(rad or °), angle-2, ..., angle-(Number of axes)] or []

            Note: the returned angle value is radians if return_is_radian is True, else °
    """
    return self.arm.get_inverse_kinematics(pose, input_is_radian=input_is_radian, return_is_radian=return_is_radian, limited=limited, ref_angles=ref_angles)

get_is_moving()

Check if the arm is moving or not

Returns:

Name Type Description
out bool

True/False

Source code in actions\settings.py
131
132
133
134
135
136
137
138
def get_is_moving(self):
    """
    Check if the arm is moving or not

    Returns:
        out (bool): True/False
    """
    return self.arm.get_is_moving()

get_joint_states(is_radian=None, num=3)

Get the joint states

Note
  1. only available if firmware_version >= 1.9.0

Parameters:

Name Type Description Default
is_radian

if the returned value(position and velocity) is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, [list]]

tuple((code, [position, velocity, effort])), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

position list[float]

the angles of joints, like [angle-1, ..., angle-7]

velocity list[float]

the velocities of joints, like [velo-1, ..., velo-7]

effort list[float]

the efforts of joints, like [effort-1, ..., effort-7]

Source code in actions\settings.py
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
def get_joint_states(self, is_radian=None, num=3):
    """
    Get the joint states

    Note:
        1. only available if firmware_version >= 1.9.0

    Args:
        is_radian: if the returned value(position and velocity) is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, [list]]): tuple((code, [position, velocity, effort])), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        position (list[float]): the angles of joints, like [angle-1, ..., angle-7]

        velocity (list[float]): the velocities of joints, like [velo-1, ..., velo-7]

        effort (list[float]): the efforts of joints, like [effort-1, ..., effort-7]
    """
    return self.arm.get_joint_states(is_radian=is_radian, num=num)

get_joints_torque()

Get joint torque

Returns:

Name Type Description
out tuple[int, list]

tuple((code, joints_torque))

code int

See the API Code Documentation for details.

joints_torque list

joint torque

Source code in actions\settings.py
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
def get_joints_torque(self):
    """
    Get joint torque

    Returns:
        out (tuple[int, list]): tuple((code, joints_torque))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        joints_torque (list): joint torque
    """
    return self.arm.get_joints_torque()

get_linear_spd_limit_factor()

Get linear speed limit factor

Note

Only available if firmware_version >= 2.3.0

Returns:

Name Type Description
out tuple[int, float]

tuple((code, factor)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

factor float

linear speed limit factor

Source code in actions\settings.py
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
def get_linear_spd_limit_factor(self):
    """
    Get linear speed limit factor

    Note:
        Only available if firmware_version >= 2.3.0

    Returns:
        out (tuple[int, float]): tuple((code, factor)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        factor (float): linear speed limit factor
    """
    return self.arm.get_linear_spd_limit_factor()

get_mount_direction()

Get the mount degrees from studio

Returns:

Name Type Description
ou tuple[int, list]

tuple((code, degrees)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

degrees list

mount degrees, [tilt angle, rotate angle]

Source code in actions\settings.py
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
def get_mount_direction(self):
    """
    Get the mount degrees from studio

    Returns:
        ou (tuple[int, list]): tuple((code, degrees)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        degrees (list): mount degrees, [tilt angle, rotate angle]
    """
    return self.arm._studio.get_mount_direction()

get_poe_status()

Get poe status

Note

Only available if firmware_version >= 2.3.0

Returns:

Name Type Description
out tuple[int, int]

tuple((code, status)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

status int

1 means poe is valid, 0 means poe is invalid

Source code in actions\settings.py
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
def get_poe_status(self):
    """
    Get poe status

    Note:
        Only available if firmware_version >= 2.3.0

    Returns:
        out (tuple[int, int]): tuple((code, status)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        status (int): 1 means poe is valid, 0 means poe is invalid
    """
    return self.arm.get_poe_status()

get_pose_offset(pose1, pose2, orient_type_in=0, orient_type_out=0, is_radian=None)

Calculate the pose offset of two given points

Note
  1. x, y, z are all in mm
  2. roll/rx, pitch/ry, yaw/rz are in either degrees or radians, can be selected by changing parameter is_radian

Parameters:

Name Type Description Default
pose1

[x, y, z, roll/rx, pitch/ry, yaw/rz]

required
pose2

[x, y, z, roll/rx, pitch/ry, yaw/rz]

required
orient_type_in

input attitude notation, 0 is RPY(roll/pitch/yaw) (default), 1 is axis angle(rx/ry/rz)

0
orient_type_out

notation of output attitude, 0 is RPY (default), 1 is axis angle

0
is_radian

if the roll/rx/pitch/ry/yaw/rz of pose1/pose2/return_pose is in radians or not

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, pose)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

pose list[float]

[x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]

Source code in actions\settings.py
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
def get_pose_offset(self, pose1, pose2, orient_type_in=0, orient_type_out=0, is_radian=None):
    """
    Calculate the pose offset of two given points

    Note:
        1. x, y, z are all in mm
        2. roll/rx, pitch/ry, yaw/rz are in either degrees or radians, can be selected by changing parameter is_radian

    Args:
        pose1: [x, y, z, roll/rx, pitch/ry, yaw/rz]

        pose2: [x, y, z, roll/rx, pitch/ry, yaw/rz]

        orient_type_in: input attitude notation, 0 is RPY(roll/pitch/yaw) (default), 1 is axis angle(rx/ry/rz)

        orient_type_out: notation of output attitude, 0 is RPY (default), 1 is axis angle

        is_radian: if the roll/rx/pitch/ry/yaw/rz of pose1/pose2/return_pose is in radians or not

    Returns:
        out (tuple[int, list]): tuple((code, pose)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        pose (list[float]): [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]
    """
    return self.arm.get_pose_offset(pose1, pose2, orient_type_in=orient_type_in, orient_type_out=orient_type_out, is_radian=is_radian)

get_position(is_radian=None)

Get the cartesian position

Note
  1. If the value(roll/pitch/yaw) you want returned should be in radians, set is_radian to True ex: code, pos = arm.get_position(is_radian=True)

Parameters:

Name Type Description Default
is_radian

if the returned value (only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, [x, y, z, roll, pitch, yaw])), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

Source code in actions\settings.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
def get_position(self, is_radian=None):
    """
    Get the cartesian position

    Note:
        1. If the value(roll/pitch/yaw) you want returned should be in radians, set is_radian to True
          ex: code, pos = arm.get_position(is_radian=True)

    Args:
        is_radian: if the returned value (only roll/pitch/yaw) is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, list]): tuple((code, [x, y, z, roll, pitch, yaw])), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.get_position(is_radian=is_radian)

get_position_aa(is_radian=None)

Get the pose represented by the axis angle pose

Parameters:

Name Type Description Default
is_radian

if the returned value (only rx/ry/rz) is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, [x, y, z, rx, ry, rz])), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

Source code in actions\settings.py
194
195
196
197
198
199
200
201
202
203
204
205
206
def get_position_aa(self, is_radian=None):
    """
    Get the pose represented by the axis angle pose

    Args:
        is_radian: if the returned value (only rx/ry/rz) is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, list]): tuple((code, [x, y, z, rx, ry, rz])), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.get_position_aa(is_radian=is_radian)

get_reduced_mode()

Get reduced mode

Note
  1. This interface relies on Firmware 1.2.0 or above

Returns:

Name Type Description
out tuple[int, int]

tuple((code, mode))

code int

See the API Code Documentation for details.

mode int

0 or 1, 1 means the reduced mode is on. 0 means the reduced mode is not on

Source code in actions\settings.py
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
def get_reduced_mode(self):
    """
    Get reduced mode

    Note:
        1. This interface relies on Firmware 1.2.0 or above

    Returns:
        out (tuple[int, int]): tuple((code, mode))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        mode (int): 0 or 1, 1 means the reduced mode is on. 0 means the reduced mode is not on
    """
    return self.arm.get_reduced_mode()

get_reduced_states(is_radian=None)

Get states of the reduced mode

Note
  1. This interface relies on Firmware 1.2.0 or above

Parameters:

Name Type Description Default
is_radian

if the max_joint_speed of the states is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, list]

tuple((code, states))

code int

See the API Code Documentation for details.

states list

[....]

if version > 1.2.11:

states: [

reduced_mode_is_on,

[reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

reduced_max_tcp_speed,

reduced_max_joint_speed,

joint_ranges([joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]),

safety_boundary_is_on,

collision_rebound_is_on,

]

if version <= 1.2.11:

states: [

reduced_mode_is_on,

[reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

reduced_max_tcp_speed,

reduced_max_joint_speed,

]

Source code in actions\settings.py
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
def get_reduced_states(self, is_radian=None):
    """
    Get states of the reduced mode

    Note:
        1. This interface relies on Firmware 1.2.0 or above

    Args:
        is_radian: if the max_joint_speed of the states is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, list]): tuple((code, states))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        states (list): [....]

            if version > 1.2.11:

            states: [

               reduced_mode_is_on,

               [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

               reduced_max_tcp_speed,

               reduced_max_joint_speed,

               joint_ranges([joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]),

               safety_boundary_is_on,

               collision_rebound_is_on,

            ]

            if version <= 1.2.11:

            states: [

            reduced_mode_is_on,

            [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min],

            reduced_max_tcp_speed,

            reduced_max_joint_speed,

            ]

    """
    return self.arm.get_reduced_states(is_radian=is_radian)

get_report_tau_or_i()

Get the reported torque or electric current

Returns:

Name Type Description
out tuple[int, int]

tuple((code, tau_or_i))

code int

See the API Code Documentation for details.

tau_or_i int
  • 0: torque
  • 1: electric current
Source code in actions\settings.py
576
577
578
579
580
581
582
583
584
585
586
587
588
589
def get_report_tau_or_i(self):
    """
    Get the reported torque or electric current

    Returns:
        out (tuple[int, int]): tuple((code, tau_or_i))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        tau_or_i (int): 
            - 0: torque
            - 1: electric current
    """
    return self.arm.get_report_tau_or_i()

get_robot_sn()

Gets the xArm sn

Returns:

Name Type Description
out tuple[int, str]

tuple((code, sn)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

sn str

the xArm sn

Source code in actions\settings.py
675
676
677
678
679
680
681
682
683
684
685
686
def get_robot_sn(self):
    """
    Gets the xArm sn

    Returns:
        out (tuple[int, str]): tuple((code, sn)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        sn (str): the xArm sn
    """
    return self.arm.get_robot_sn()

get_servo_angle(servo_id=None, is_radian=None, is_real=False)

Get the servo angle

Note
  1. If the value you want returned should be in radians, set is_radian to True ex: code, angles = arm.get_servo_angle(is_radian=True)
  2. If you want to return only the angle of a single joint, please set the parameter servo_id ex: code, angle = arm.get_servo_angle(servo_id=2)
  3. This interface is only used in the base coordinate system.

Parameters:

Name Type Description Default
servo_id

1-(Number of axes), None(8), default is None

None
is_radian

the returned value is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, list | float]

tuple((code, angle list if servo_id is None or 8 else angle)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

Source code in actions\settings.py
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
def get_servo_angle(self, servo_id=None, is_radian=None, is_real=False):
    """
    Get the servo angle

    Note:
        1. If the value you want returned should be in radians, set is_radian to True
          ex: code, angles = arm.get_servo_angle(is_radian=True)
        2. If you want to return only the angle of a single joint, please set the parameter servo_id
          ex: code, angle = arm.get_servo_angle(servo_id=2)
        3. This interface is only used in the base coordinate system.

    Args:
        servo_id: 1-(Number of axes), None(8), default is None

        is_radian: the returned value is in radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, list | float]): tuple((code, angle list if servo_id is None or 8 else angle)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.get_servo_angle(servo_id=servo_id, is_radian=is_radian, is_real=is_real)

get_servo_debug_msg(show=False, lang='en')

Get the servo debug msg, used only for debugging

Parameters:

Name Type Description Default
show

show the detail info if True

False
lang

language, en/cn, default is en

'en'

Returns:

Name Type Description
out tuple[int, list]

tuple((code, servo_info_list)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

Source code in actions\settings.py
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
def get_servo_debug_msg(self, show=False, lang='en'):
    """
    Get the servo debug msg, used only for debugging

    Args:
        show: show the detail info if True

        lang: language, en/cn, default is en

    Returns:
        out (tuple[int, list]): tuple((code, servo_info_list)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.get_servo_debug_msg(show=show, lang=lang)

get_servo_version(servo_id=1)

Get servo version, only for debug

Parameters:

Name Type Description Default
servo_id

servo id(1~7)

1

Returns:

Name Type Description
out tuple[int, str]

tuple((code, version))

code int

See the API Code Documentation for details.

version str

servo version

Source code in actions\settings.py
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
def get_servo_version(self, servo_id=1):
    """
    Get servo version, only for debug

    Args:
        servo_id: servo id(1~7)

    Returns:
        out (tuple[int, str]): tuple((code, version))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        version (str): servo version
    """
    return self.arm.get_servo_version(servo_id=servo_id)

get_state()

Get state

Returns:

Name Type Description
out tuple[int, int]

tuple((code, state)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

state int

state - 1: in motion - 2: sleeping - 3: suspended - 4: stopping

Source code in actions\settings.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
def get_state(self):
    """
    Get state

    Returns:
        out (tuple[int, int]): tuple((code, state)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        state (int): state
            - 1: in motion
            - 2: sleeping
            - 3: suspended
            - 4: stopping
    """
    return self.arm.get_state()

get_tgpio_version()

Get tool gpio version, only for debug

Returns:

Name Type Description
out tuple[int, str]

tuple((code, version))

code int

See the API Code Documentation for details.

version str

tool gpio version

Source code in actions\settings.py
956
957
958
959
960
961
962
963
964
965
966
967
def get_tgpio_version(self):
    """
    Get tool gpio version, only for debug

    Returns:
        out (tuple[int, str]): tuple((code, version))

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        version (str): tool gpio version
    """
    return self.arm.get_tgpio_version()

get_version()

Get the xArm firmware version

Returns:

Name Type Description
out tuple[int, str]

tuple((code, version)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

version str

firmware version, such as '6,9, ,XX0000,v2.4.0'

Source code in actions\settings.py
101
102
103
104
105
106
107
108
109
110
111
112
def get_version(self):
    """
    Get the xArm firmware version

    Returns:
        out (tuple[int, str]): tuple((code, version)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        version (str): firmware version, such as '6,9, ,XX0000,v2.4.0'
    """
    return self.arm.get_version()

iden_joint_friction(sn=None)

Identification of the friction

Note
  1. only available if firmware_version >= 1.9.0

Parameters:

Name Type Description Default
sn

sn value

None

Returns:

Name Type Description
out tuple[int, int]

tuple((code, result)) returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

result int
  • 0: success
  • -1: failure
Source code in actions\settings.py
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
def iden_joint_friction(self, sn=None):
    """
    Identification of the friction

    Note:
        1. only available if firmware_version >= 1.9.0

    Args:
        sn: sn value

    Returns:
        out (tuple[int, int]): tuple((code, result)) returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        result (int): 
            - 0: success
            - -1: failure
    """
    return self.arm.iden_joint_friction(sn)

iden_tcp_load(estimated_mass=0)

Identification the tcp load with current

Note
  1. only available if firmware_version >= 1.8.0

Parameters:

Name Type Description Default
estimated_mass

estimated mass

Note: this parameter is only available on the lite6 model manipulator, and this parameter must be specified for the lite6 model manipulator

0

Returns:

Name Type Description
out tuple[int, list]

tuple((code, load)) returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

load list

[mass, x_centroid, y_centroid, z_centroid]

Source code in actions\settings.py
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
def iden_tcp_load(self, estimated_mass=0):
    """
    Identification the tcp load with current

    Note:
        1. only available if firmware_version >= 1.8.0

    Args:
        estimated_mass: estimated mass

            Note: this parameter is only available on the lite6 model manipulator, and this parameter must be specified for the lite6 model manipulator

    Returns:
        out (tuple[int, list]): tuple((code, load)) returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        load (list): [mass, x_centroid, y_centroid, z_centroid]

    """
    return self.arm.iden_tcp_load(estimated_mass)

is_joint_limit(joint, is_radian=None)

Check the joint angle is within limit

Parameters:

Name Type Description Default
joint

[angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

required
is_radian

angle value is radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, bool]

tuple((code, limit)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

limit bool

True/False/None, limit or not, or failed

Source code in actions\settings.py
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
def is_joint_limit(self, joint, is_radian=None):
    """
    Check the joint angle is within limit

    Args:
        joint: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm

        is_radian: angle value is radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, bool]): tuple((code, limit)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        limit (bool): True/False/None, limit or not, or failed
    """
    return self.arm.is_joint_limit(joint, is_radian=is_radian)

is_tcp_limit(pose, is_radian=None)

Check the tcp pose is within limit

Parameters:

Name Type Description Default
pose

[x, y, z, roll, pitch, yaw]

required
is_radian

roll/pitch/yaw value is radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
out tuple[int, bool]

tuple((code, limit)), returned result is only corrent when code is 0.

code int

See the API Code Documentation for details.

limit bool

True/False/None, limit or not, or failed

Source code in actions\settings.py
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
def is_tcp_limit(self, pose, is_radian=None):
    """
    Check the tcp pose is within limit

    Args:
        pose: [x, y, z, roll, pitch, yaw]

        is_radian: roll/pitch/yaw value is radians or not, defaults to self.default_is_radian

    Returns:
        out (tuple[int, bool]): tuple((code, limit)), returned result is only corrent when code is 0.

        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.

        limit (bool): True/False/None, limit or not, or failed
    """
    return self.arm.is_tcp_limit(pose, is_radian=is_radian)

motion_enable(enable=True, servo_id=None)

Enable motion

Parameters:

Name Type Description Default
enable

True/False

True
servo_id

1-(Number of axes), None(8)

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
73
74
75
76
77
78
79
80
81
82
83
84
85
def motion_enable(self, enable=True, servo_id=None):
    """
    Enable motion

    Args:
        enable: True/False

        servo_id: 1-(Number of axes), None(8)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.motion_enable(servo_id=servo_id, enable=enable)

set_allow_approx_motion(on_off)

Settings to allow avoiding overspeed near some singularities using approximate solutions

Note
  1. only available if firmware_version >= 1.9.0

Parameters:

Name Type Description Default
on_off

whether to allow or not, True: allow, default is False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
def set_allow_approx_motion(self, on_off):
    """
    Settings to allow avoiding overspeed near some singularities using approximate solutions

    Note:
        1. only available if firmware_version >= 1.9.0

    Args:
        on_off: whether to allow or not, True: allow, default is False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_allow_approx_motion(on_off)

set_baud_checkset_enable(enable)

Enable auto checkset the baudrate of the end IO board or not

Note

only available in the API of gripper/bio/robotiq/linear_motor.

Parameters:

Name Type Description Default
enable

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
def set_baud_checkset_enable(self, enable):
    """
    Enable auto checkset the baudrate of the end IO board or not

    Note:
        only available in the API of gripper/bio/robotiq/linear_motor.

    Args:
        enable: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_baud_checkset_enable(enable)

set_cartesian_velo_continuous(on_off)

Set cartesian motion velocity continuous

Note
  1. only available if firmware_version >= 1.9.0

Parameters:

Name Type Description Default
on_off

whether motion is continuous or not, True: continuous, defaults to False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
def set_cartesian_velo_continuous(self, on_off):
    """
    Set cartesian motion velocity continuous

    Note:
        1. only available if firmware_version >= 1.9.0

    Args:
        on_off: whether motion is continuous or not, True: continuous, defaults to False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_cartesian_velo_continuous(on_off)

set_cgpio_analog_with_xyz(ionum, value, xyz, fault_tolerance_radius)

Set the analog value of the specified Controller GPIO when the robot has reached the specified xyz position

Parameters:

Name Type Description Default
ionum

0 ~ 1

required
value

value

required
xyz

position xyz, as [x, y, z]

required
fault_tolerance_radius

fault tolerance radius

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
def set_cgpio_analog_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
    """
    Set the analog value of the specified Controller GPIO when the robot has reached the specified xyz position           

    Args:
        ionum: 0 ~ 1

        value: value

        xyz: position xyz, as [x, y, z]

        fault_tolerance_radius: fault tolerance radius

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.  
    """
    return self.arm.set_cgpio_analog_with_xyz(ionum, value, xyz, fault_tolerance_radius)

set_cgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

Set the digital value of the specified Controller GPIO when the robot has reached the specified xyz position

Parameters:

Name Type Description Default
ionum

0 ~ 15

required
value

value

required
xyz

position xyz, as [x, y, z]

required
fault_tolerance_radius

fault tolerance radius

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
def set_cgpio_digital_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
    """
    Set the digital value of the specified Controller GPIO when the robot has reached the specified xyz position           

    Args:
        ionum: 0 ~ 15

        value: value

        xyz: position xyz, as [x, y, z]

        fault_tolerance_radius: fault tolerance radius

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.  
    """
    return self.arm.set_cgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

set_checkset_default_baud(type_, baud)

Set the checkset baud value

Parameters:

Name Type Description Default
type_

checkset type - 1: xarm gripper - 2: bio gripper - 3: robotiq gripper - 4: linear motor

required
baud

checkset baud value, less than or equal to 0 means disable checkset

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
def set_checkset_default_baud(self, type_, baud):
    """
    Set the checkset baud value

    Args:
        type_: checkset type
            - 1: xarm gripper
            - 2: bio gripper
            - 3: robotiq gripper
            - 4: linear motor

        baud: checkset baud value, less than or equal to 0 means disable checkset

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_checkset_default_baud(type_, baud)

set_cmd_mat_history_num(num)

Set cmd mat history num

Note

Only available if firmware_version >= 2.3.0

Parameters:

Name Type Description Default
num

history num

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
def set_cmd_mat_history_num(self, num):
    """
    Set cmd mat history num

    Note:
        Only available if firmware_version >= 2.3.0

    Args:
        num: history num

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_cmd_mat_history_num(num)

set_collision_rebound(on)

Turn on/off collision rebound

Note
  1. This interface relies on Firmware 1.2.11 or above

Parameters:

Name Type Description Default
on

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
841
842
843
844
845
846
847
848
849
850
851
852
853
854
def set_collision_rebound(self, on):
    """
    Turn on/off collision rebound

    Note:
        1. This interface relies on Firmware 1.2.11 or above

    Args:
        on: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_collision_rebound(on)

set_collision_sensitivity(value, wait=True)

Set the sensitivity to collision

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
value

sensitivity value, 0~5

required
wait

reversed

True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
def set_collision_sensitivity(self, value, wait=True):
    """
    Set the sensitivity to collision

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        value: sensitivity value, 0~5

        wait: reversed

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_collision_sensitivity(value, wait=wait)

set_collision_tool_model(tool_type, *args, **kwargs)

Set the geometric model of the end effector for self collision detection

Parameters:

Name Type Description Default
tool_type

the geometric model type

  • 0: No end effector, no additional parameters required

  • 1: xArm Gripper, no additional parameters required

  • 2: xArm Vacuum Gripper, no additional parameters required

  • 3: xArm Bio Gripper, no additional parameters required

  • 4: Robotiq-2F-85 Gripper, no additional parameters required

  • 5: Robotiq-2F-140 Gripper, no additional parameters required

  • 7: Lite Gripper, no additional parameters required

  • 8: Lite Vacuum Gripper, no additional parameters required

  • 9: xArm Gripper G2, no additional parameters required

  • 10: PGC-140-50 of the DH-ROBOTICS, no additional parameters required

  • 11: RH56DFX-2L of the INSPIRE-ROBOTS, no additional parameters required

  • 12: RH56DFX-2R of the INSPIRE-ROBOTS, no additional parameters required

  • 13: xArm Bio Gripper G2, no additional parameters required

  • 21: Cylinder, need additional parameters radius, height

    • ex: self.set_collision_tool_model(21, radius=45, height=137)

    • radius: the radius of cylinder, (mm)

    • height: the height of cylinder, (mm)

    • x_offset: offset in the x direction, (mm)

    • y_offset: offset in the y direction, (mm)

    • z_offset: offset in the z direction, (mm)

  • 22: Cuboid, need additional parameters x, y, z

    • ex: self.set_collision_tool_model(22, x=234, y=323, z=23)

    • x: the length of the cuboid in the x coordinate direction, (mm)

    • y: the length of the cuboid in the y coordinate direction, (mm)

    • z: the length of the cuboid in the z coordinate direction, (mm)

    • x_offset: offset in the x direction, (mm)

    • y_offset: offset in the y direction, (mm)

    • z_offset: offset in the z direction, (mm)

required
args

additional parameters

()
kwargs

additional parameters

{}

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
def set_collision_tool_model(self, tool_type, *args, **kwargs):
    """
    Set the geometric model of the end effector for self collision detection

    Args:
        tool_type: the geometric model type

            - 0: No end effector, no additional parameters required

            - 1: xArm Gripper, no additional parameters required

            - 2: xArm Vacuum Gripper, no additional parameters required

            - 3: xArm Bio Gripper, no additional parameters required

            - 4: Robotiq-2F-85 Gripper, no additional parameters required

            - 5: Robotiq-2F-140 Gripper, no additional parameters required

            - 7: Lite Gripper, no additional parameters required

            - 8: Lite Vacuum Gripper, no additional parameters required

            - 9: xArm Gripper G2, no additional parameters required

            - 10: PGC-140-50 of the DH-ROBOTICS, no additional parameters required

            - 11: RH56DFX-2L of the INSPIRE-ROBOTS, no additional parameters required

            - 12: RH56DFX-2R of the INSPIRE-ROBOTS, no additional parameters required

            - 13: xArm Bio Gripper G2, no additional parameters required

            - 21: Cylinder, need additional parameters radius, height 

                - ex: self.set_collision_tool_model(21, radius=45, height=137)

                - radius: the radius of cylinder, (mm)

                - height: the height of cylinder, (mm)

                - x_offset: offset in the x direction, (mm)

                - y_offset: offset in the y direction, (mm)

                - z_offset: offset in the z direction, (mm)

            - 22: Cuboid, need additional parameters x, y, z

                - ex: self.set_collision_tool_model(22, x=234, y=323, z=23)

                - x: the length of the cuboid in the x coordinate direction, (mm)

                - y: the length of the cuboid in the y coordinate direction, (mm)

                - z: the length of the cuboid in the z coordinate direction, (mm)

                - x_offset: offset in the x direction, (mm)

                - y_offset: offset in the y direction, (mm)

                - z_offset: offset in the z direction, (mm)

        args: additional parameters

        kwargs: additional parameters

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_collision_tool_model(tool_type, *args, **kwargs)

set_counter_increase(val=1)

Set counter plus value, only supports increasing by 1

Parameters:

Name Type Description Default
val

reversed

1

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
def set_counter_increase(self, val=1):
    """
    Set counter plus value, only supports increasing by 1

    Args:
        val: reversed

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_counter_increase(val)

set_counter_reset()

Reset counter value

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
 995
 996
 997
 998
 999
1000
1001
1002
def set_counter_reset(self):
    """
    Reset counter value

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_counter_reset()

set_dh_params(dh_params, flag=0)

Set the DH parameters

Note
  1. only available if firmware_version >= 2.0.0
  2. this interface is only provided for users who need to use external DH parameters, ordinary users should not try to modify DH parameters.

Parameters:

Name Type Description Default
dh_params

DH parameters

required
flag
  • 0: Use the set DH parameters, but do not write to the configuration file
  • 1: Use the set DH parameters and write to the configuration file
  • 2: Use the set DH parameters and delete the DH parameters of the configuration file
  • 3: Use the default DH parameters, but will not delete the DH parameters of the configuration file
  • 4: Use the default DH parameters and delete the DH parameters of the configuration file
0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
def set_dh_params(self, dh_params, flag=0):
    """
    Set the DH parameters

    Note:
        1. only available if firmware_version >= 2.0.0
        2. this interface is only provided for users who need to use external DH parameters, ordinary users should not try to modify DH parameters.

    Args:
        dh_params: DH parameters

        flag: 
            - 0: Use the set DH parameters, but do not write to the configuration file
            - 1: Use the set DH parameters and write to the configuration file
            - 2: Use the set DH parameters and delete the DH parameters of the configuration file
            - 3: Use the default DH parameters, but will not delete the DH parameters of the configuration file
            - 4: Use the default DH parameters and delete the DH parameters of the configuration file

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_dh_params(dh_params, flag) 

set_external_device_monitor_params(dev_type, frequency)

Set the monitor params of the external device

Note
  1. only available if firmware_version >= 2.7.100
  2. after it is turned on, the position/speed/current information of the external device will be reported through port 30000
  3. once an error occurs, you need to re call to monitor

Parameters:

Name Type Description Default
dev_type

the type of the external device

  • 0: Turn off monitoring

  • 1: xArm Gripper

  • 2: xArm Gripper G2

  • 3: BIO Gripper G2

  • 4: Robotiq 2F-85/Robotiq 2F-140

required
frequency

the frequency of communication with the external device

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
def set_external_device_monitor_params(self, dev_type, frequency):
    """
    Set the monitor params of the external device

    Note:
        1. only available if firmware_version >= 2.7.100
        2. after it is turned on, the position/speed/current information of the external device will be reported through port 30000
        3. once an error occurs, you need to re call to monitor

    Args:
        dev_type: the type of the external device

            - 0: Turn off monitoring

            - 1: xArm Gripper

            - 2: xArm Gripper G2

            - 3: BIO Gripper G2

            - 4: Robotiq 2F-85/Robotiq 2F-140

        frequency: the frequency of communication with the external device

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_external_device_monitor_params(dev_type, frequency)

set_fdb_mat_history_num(num)

Set fdb mat history num

Note

Only available if firmware_version >= 2.3.0

Parameters:

Name Type Description Default
num

history num

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
def set_fdb_mat_history_num(self, num):
    """
    Set fdb mat history num

    Note:
        Only available if firmware_version >= 2.3.0

    Args:
        num: history num

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_fdb_mat_history_num(num)

set_feedback_type(feedback_type)

Set the feedback type

Note
  1. only available if firmware_version >= 2.1.0
  2. only works in position mode
  3. the setting will only affect subsequent tasks and will not affect previously cached tasks
  4. only valid for the current connection

Parameters:

Name Type Description Default
feedback_type
  • 0: disable feedback
  • 1: feedback when the motion task starts executing
  • 2: feedback when the motion task execution ends or motion task is discarded(usually when the distance is too close to be planned)
  • 4: feedback when the non-motion task is triggered
required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
def set_feedback_type(self, feedback_type):
    """
    Set the feedback type

    Note:
        1. only available if firmware_version >= 2.1.0
        2. only works in position mode
        3. the setting will only affect subsequent tasks and will not affect previously cached tasks
        4. only valid for the current connection

    Args:
        feedback_type:
            - 0: disable feedback
            - 1: feedback when the motion task starts executing
            - 2: feedback when the motion task execution ends or motion task is discarded(usually when the distance is too close to be planned)
            - 4: feedback when the non-motion task is triggered

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_feedback_type(feedback_type)

set_fence_mode(on)

Turn on/off fence mode

Note
  1. This interface relies on Firmware 1.2.11 or above

Parameters:

Name Type Description Default
on

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
826
827
828
829
830
831
832
833
834
835
836
837
838
839
def set_fence_mode(self, on):
    """
    Turn on/off fence mode

    Note:
        1. This interface relies on Firmware 1.2.11 or above

    Args:
        on: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_fense_mode(on)

set_gravity_direction(direction, wait=True)

Set the gravity direction for proper torque compensation and collision detection.

Note
  1. Use only if necessary. Incorrect settings may affect torque compensation.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
direction

Gravity direction vector [x, y, z], e.g., [0, 0, -1] for a floor-mounted arm.

required
wait

Whether to wait for the robotic arm to stop or clear all previous queued commands before applying the setting.

True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
def set_gravity_direction(self, direction, wait=True):
    """
    Set the gravity direction for proper torque compensation and collision detection.

    Note:
        1. Use only if necessary. Incorrect settings may affect torque compensation.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        direction: Gravity direction vector [x, y, z], e.g., [0, 0, -1] for a floor-mounted arm.

        wait: Whether to wait for the robotic arm to stop or clear all previous queued commands before applying the setting.

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_gravity_direction(direction=direction, wait=wait)

set_initial_point(point)

Set the initial point

Parameters:

Name Type Description Default
point

initial point, [J1, J2, ..., J7]

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
def set_initial_point(self, point):
    """
    Set the initial point

    Args:
        point: initial point, [J1, J2, ..., J7]

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details. 
    """
    return self.arm._studio.set_initial_point(point)

set_joint_jerk(jerk, is_radian=None)

Set the jerk of Joint space

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
jerk

jerk (°/s^3 or rad/s^3)

required
is_radian

if the jerk is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
def set_joint_jerk(self, jerk, is_radian=None):
    """
    Set the jerk of Joint space

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        jerk: jerk (°/s^3 or rad/s^3)

        is_radian: if the jerk is in radians or not, defaults to self.default_is_radian

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_joint_jerk(jerk, is_radian=is_radian)

set_joint_maxacc(acc, is_radian=None)

Set the max acceleration of Joint space

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
acc

max acceleration (°/s^2 or rad/s^2)

required
is_radian

if the jerk is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
def set_joint_maxacc(self, acc, is_radian=None):
    """
    Set the max acceleration of Joint space

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        acc: max acceleration (°/s^2 or rad/s^2)

        is_radian: if the jerk is in radians or not, defaults to self.default_is_radian

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_joint_maxacc(acc, is_radian=is_radian)

set_linear_spd_limit_factor(factor)

Set linear speed limit factor (default is 1.2)

Note
  1. only available if firmware_version >= 2.3.0
  2. only available in mode 1

Parameters:

Name Type Description Default
factor

speed limit factor

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
def set_linear_spd_limit_factor(self, factor):
    """
    Set linear speed limit factor (default is 1.2)

    Note:
        1. only available if firmware_version >= 2.3.0
        2. only available in mode 1

    Args:
        factor: speed limit factor

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_linear_spd_limit_factor(factor)

set_mode(mode=0, detection_param=0)

Set the xArm mode

Parameters:

Name Type Description Default
mode

default 0

0: position control

1: servo motion

Note: the use of the set_servo_angle_j interface must first be set to this

Note: the use of the set_servo_cartesian interface must first be set to this

2: joint teaching

Note: use this mode to ensure that the arm has been identified and the control box and arm used for identification are one-to-one.

3: cartesian teaching (invalid)

4: joint velocity control

5: cartesian velocity control

6: joint online trajectory planning

7: cartesian online trajectory planning

0
detection_param

Teaching detection parameters, default is 0

0: motion detection on

1: motion detection off

Note:

  1. only available if firmware_version >= 1.10.1

  2. only available if set_mode(2)

0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def set_mode(self, mode=0, detection_param=0):
    """
    Set the xArm mode

    Args:
        mode: default 0

            0: position control

            1: servo motion

            Note: the use of the set_servo_angle_j interface must first be set to this

            Note: the use of the set_servo_cartesian interface must first be set to this

            2: joint teaching

            Note: use this mode to ensure that the arm has been identified and the control box and arm used for identification are one-to-one.

            3: cartesian teaching (invalid)

            4: joint velocity control

            5: cartesian velocity control

            6: joint online trajectory planning

            7: cartesian online trajectory planning

        detection_param: Teaching detection parameters, default is 0

            0: motion detection on

            1: motion detection off

            Note:

            1. only available if firmware_version >= 1.10.1

            2. only available if set_mode(2)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_mode(mode=mode, detection_param=detection_param)

set_mount_direction(base_tilt_deg, rotation_deg, is_radian=None)

Set the mount direction

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
base_tilt_deg

tilt degree

required
rotation_deg

rotation degree

required
is_radian

if the base_tilt_deg/rotation_deg is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
def set_mount_direction(self, base_tilt_deg, rotation_deg, is_radian=None):
    """
    Set the mount direction

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        base_tilt_deg: tilt degree

        rotation_deg: rotation degree

        is_radian: if the base_tilt_deg/rotation_deg is in radians or not, defaults to self.default_is_radian

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_mount_direction(base_tilt_deg, rotation_deg, is_radian=is_radian)

set_only_check_type(only_check_type=0)

Set the motion process detection type (valid for all motion interfaces of the current SDK instance)

Note
  1. only available if firmware_version >= 1.11.100
  2. This interface is a global configuration item of the current SDK, and affects all motion-related interfaces
  3. Generally, you only need to call when you don't want to move the robotic arm and only check whether some paths will have self-collision/angle-limit/cartesian-limit/overspeed.
  4. Currently only self-collision/angle-limit/cartesian-limit/overspeed are detected
  5. If only_check_type is set to be greater than 0, and the return value of calling the motion interface is not 0, you can view arm.only_check_result to view the specific error code
(Common scenarios, here is an example of the set_position interface)
    1. Check whether the process from point A to point B is normal (no self-collision and overspeed triggered)

    2. 1.1 Move to point A

      • arm.set_only_check_type(0)

      • code = arm.set_position(A)

    3. 1.2 Check if the process from point A to point B is normal (no self-collision and overspeed triggered)

      • arm.set_only_check_type(1)

      • code = arm.set_position(B)

      • If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

      • arm.set_only_check_type(0)

    1. Check whether the process from point A to point B, C, and D to point E is normal (no self-collision and overspeed are triggered)

    2. 2.1 Move to point A

      • arm.set_only_check_type(0)

      • code = arm.set_position(A)

    3. 2.2 Check whether the process of point A passing through points B, C, D to point E is normal (no self-collision and overspeed are triggered)

      • arm.set_only_check_type(3)

      • code = arm.set_position(B)

      • If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

      • code = arm.set_position(C)

      • If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

      • code = arm.set_position(D)

      • If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

      • code = arm.set_position(E)

      • If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

      • arm.set_only_check_type(0)

Parameters:

Name Type Description Default
only_check_type

Motion Detection Type

  • only_check_type == 0: Restore the original function of the motion interface, it will move, the default is 0

  • only_check_type == 1: Only check the self-collision without moving, take the actual state of the manipulator as the initial planned path, and check whether the path has self-collision (the intermediate state will be updated at this time)

  • only_check_type == 2: Only check the self-collision without moving, use the intermediate state as the starting planning path, check whether the path has self-collision (the intermediate state will be updated at this time), and restore the intermediate state to the actual state after the end

  • only_check_type == 3: Only check the self-collision without moving, use the intermediate state as the starting planning path, and check whether the path has self-collision (the intermediate state will be updated at this time)

0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
def set_only_check_type(self, only_check_type=0):
    """
    Set the motion process detection type (valid for all motion interfaces of the current SDK instance)

    Note:
        1. only available if firmware_version >= 1.11.100
        2. This interface is a global configuration item of the current SDK, and affects all motion-related interfaces
        3. Generally, you only need to call when you don't want to move the robotic arm and only check whether some paths will have self-collision/angle-limit/cartesian-limit/overspeed.
        4. Currently only self-collision/angle-limit/cartesian-limit/overspeed are detected
        5. If only_check_type is set to be greater than 0, and the return value of calling the motion interface is not 0, you can view arm.only_check_result to view the specific error code

    Example: (Common scenarios, here is an example of the set_position interface)
        - 1. Check whether the process from point A to point B is normal (no self-collision and overspeed triggered)

            - 1.1 Move to point A

                - arm.set_only_check_type(0)

                - code = arm.set_position(A)

            - 1.2 Check if the process from point A to point B is normal (no self-collision and overspeed triggered)

                - arm.set_only_check_type(1)

                - code = arm.set_position(B)

                - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                - arm.set_only_check_type(0)


        - 2. Check whether the process from point A to point B, C, and D to point E is normal (no self-collision and overspeed are triggered)

            - 2.1 Move to point A

                - arm.set_only_check_type(0)

                - code = arm.set_position(A)

            - 2.2 Check whether the process of point A passing through points B, C, D to point E is normal (no self-collision and overspeed are triggered)

                - arm.set_only_check_type(3)

                - code = arm.set_position(B)

                - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                - code = arm.set_position(C)

                - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                - code = arm.set_position(D)

                - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                - code = arm.set_position(E)

                - If code is not equal to 0, it means that the path does not pass. You can check the specific error code through arm.only_check_result

                - arm.set_only_check_type(0)

    Args:
        only_check_type: Motion Detection Type

            - only_check_type == 0: Restore the original function of the motion interface, it will move, the default is 0

            - only_check_type == 1: Only check the self-collision without moving, take the actual state of the manipulator as the initial planned path, and check whether the path has self-collision (the intermediate state will be updated at this time)

            - only_check_type == 2: Only check the self-collision without moving, use the intermediate state as the starting planning path, check whether the path has self-collision (the intermediate state will be updated at this time), and restore the intermediate state to the actual state after the end

            - only_check_type == 3: Only check the self-collision without moving, use the intermediate state as the starting planning path, and check whether the path has self-collision (the intermediate state will be updated at this time)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_only_check_type(only_check_type)

set_pause_time(sltime, wait=False)

Set the arm pause time, xArm will pause sltime second

Parameters:

Name Type Description Default
sltime

sleep time,unit:(s)second

required
wait

wait or not, default is False

False

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
87
88
89
90
91
92
93
94
95
96
97
98
99
def set_pause_time(self, sltime, wait=False):
    """
    Set the arm pause time, xArm will pause sltime second

    Args:
        sltime: sleep time,unit:(s)second

        wait: wait or not, default is False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_pause_time(sltime=sltime, wait=wait)

set_reduced_joint_range(joint_range, is_radian=None)

Set the joint range of the reduced mode

Note
  1. This interface relies on Firmware 1.2.11 or above
  2. Only reset the reduced mode to take effect (set_reduced_mode(True))

Parameters:

Name Type Description Default
joint_range

[joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]

required
is_radian

the param joint_range are in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
def set_reduced_joint_range(self, joint_range, is_radian=None):
    """
    Set the joint range of the reduced mode

    Note:
        1. This interface relies on Firmware 1.2.11 or above
        2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

    Args:
        joint_range: [joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]

        is_radian: the param joint_range are in radians or not, defaults to self.default_is_radian

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_reduced_joint_range(joint_range, is_radian=is_radian)

set_reduced_max_joint_speed(speed, is_radian=None)

Set the maximum joint speed of the reduced mode

Note
  1. This interface relies on Firmware 1.2.0 or above
  2. Only reset the reduced mode to take effect (set_reduced_mode(True))

Parameters:

Name Type Description Default
speed

speed (°/s or rad/s)

required
is_radian

the speed is in radians or not, defaults to self.default_is_radian

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
def set_reduced_max_joint_speed(self, speed, is_radian=None):
    """
    Set the maximum joint speed of the reduced mode

    Note:
        1. This interface relies on Firmware 1.2.0 or above
        2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

    Args:
        speed: speed (°/s or rad/s)

        is_radian: the speed is in radians or not, defaults to self.default_is_radian

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_reduced_max_joint_speed(speed, is_radian=is_radian)

set_reduced_max_tcp_speed(speed)

Set the maximum tcp speed of the reduced mode

Note
  1. This interface relies on Firmware 1.2.0 or above
  2. Only reset the reduced mode to take effect (set_reduced_mode(True))

Parameters:

Name Type Description Default
speed

speed (mm/s)

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
def set_reduced_max_tcp_speed(self, speed):
    """
    Set the maximum tcp speed of the reduced mode

    Note:
        1. This interface relies on Firmware 1.2.0 or above
        2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

    Args:
        speed: speed (mm/s)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_reduced_max_tcp_speed(speed)

set_reduced_tcp_boundary(boundary)

Set the boundary of the safety boundary mode

Note
  1. This interface relies on Firmware 1.2.0 or above
  2. Only reset the reduced mode to take effect (set_reduced_mode(True))

Parameters:

Name Type Description Default
boundary

[x_max, x_min, y_max, y_min, z_max, z_min]

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
def set_reduced_tcp_boundary(self, boundary):
    """
    Set the boundary of the safety boundary mode

    Note:
        1. This interface relies on Firmware 1.2.0 or above
        2. Only reset the reduced mode to take effect (`set_reduced_mode(True)`)

    Args:
        boundary: [x_max, x_min, y_max, y_min, z_max, z_min]

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_reduced_tcp_boundary(boundary)

set_report_tau_or_i(tau_or_i=0)

Set if torque or electric current is reported

Parameters:

Name Type Description Default
tau_or_i
  • 0: torque
  • 1: electric current
0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
562
563
564
565
566
567
568
569
570
571
572
573
574
def set_report_tau_or_i(self, tau_or_i=0):
    """
    Set if torque or electric current is reported

    Args:
        tau_or_i: 
            - 0: torque
            - 1: electric current

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_report_tau_or_i(tau_or_i=tau_or_i)

set_self_collision_detection(on_off)

Set whether to enable self-collision detection

Parameters:

Name Type Description Default
on_off

enable or not

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
591
592
593
594
595
596
597
598
599
600
601
def set_self_collision_detection(self, on_off):
    """
    Set whether to enable self-collision detection 

    Args:
        on_off: enable or not

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_self_collision_detection(on_off)

set_simulation_robot(on_off)

Set the simulation robot

Parameters:

Name Type Description Default
on_off

True/False

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
def set_simulation_robot(self, on_off):
    """
    Set the simulation robot

    Args:
        on_off: True/False

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_simulation_robot(on_off)

set_state(state=0)

Set the xArm state

Parameters:

Name Type Description Default
state

default 0

  • 0: motion state

  • 3: pause state

  • 4: stop state

  • 6: deceleration stop state

0

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def set_state(self, state=0):
    """
    Set the xArm state

    Args:
        state: default 0

            - 0: motion state

            - 3: pause state

            - 4: stop state

            - 6: deceleration stop state

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_state(state=state)

set_tcp_jerk(jerk)

Set the translational jerk of Cartesian space

Note
  1. Do not use if not required
  2. If not saved, it will be lost after reboot
  3. The save_conf interface can record the current settings and will not be lost after the restart.
  4. The clean_conf interface can restore system default settings

Parameters:

Name Type Description Default
jerk

jerk (mm/s^3)

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
def set_tcp_jerk(self, jerk):
    """
    Set the translational jerk of Cartesian space

    Note:
        1. Do not use if not required
        2. If not saved, it will be lost after reboot
        3. The save_conf interface can record the current settings and will not be lost after the restart.
        4. The clean_conf interface can restore system default settings

    Args:
        jerk: jerk (mm/s^3)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_tcp_jerk(jerk)

set_tcp_load(weight, center_of_gravity, wait=False, **kwargs)

Set the end load of xArm

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
weight

load weight (unit: kg)

required
center_of_gravity

load center of gravity, such as [x(mm), y(mm), z(mm)]

required
wait

whether to wait for the command to be executed or for the robotic arm to stop

False

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
def set_tcp_load(self, weight, center_of_gravity, wait=False, **kwargs):
    """
    Set the end load of xArm

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        weight: load weight (unit: kg)

        center_of_gravity: load center of gravity, such as [x(mm), y(mm), z(mm)]

        wait: whether to wait for the command to be executed or for the robotic arm to stop

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_tcp_load(weight, center_of_gravity, wait=wait, **kwargs)

set_tcp_maxacc(acc)

Set the max translational acceleration of Cartesian space

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
acc

max acceleration (mm/s^2)

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
def set_tcp_maxacc(self, acc):
    """
    Set the max translational acceleration of Cartesian space

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        acc: max acceleration (mm/s^2)

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_tcp_maxacc(acc)

set_tcp_offset(offset, is_radian=None, wait=True, **kwargs)

Set the tool coordinate system offset at the end

Note
  1. Do not use if not required
  2. If not saved and you want to revert to the last saved value, please reset the offset by set_tcp_offset([0, 0, 0, 0, 0, 0])
  3. If not saved, it will be lost after reboot
  4. The save_conf interface can record the current settings and will not be lost after the restart.
  5. The clean_conf interface can restore system default settings

Parameters:

Name Type Description Default
offset

[x, y, z, roll, pitch, yaw]

required
is_radian

the roll/pitch/yaw in radians or not, defaults to self.default_is_radian

None
wait

whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
def set_tcp_offset(self, offset, is_radian=None, wait=True, **kwargs):
    """
    Set the tool coordinate system offset at the end

    Note:
        1. Do not use if not required
        2. If not saved and you want to revert to the last saved value, please reset the offset by set_tcp_offset([0, 0, 0, 0, 0, 0])
        3. If not saved, it will be lost after reboot
        4. The save_conf interface can record the current settings and will not be lost after the restart.
        5. The clean_conf interface can restore system default settings

    Args:
        offset: [x, y, z, roll, pitch, yaw]

        is_radian: the roll/pitch/yaw in radians or not, defaults to self.default_is_radian

        wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_tcp_offset(offset, is_radian=is_radian, wait=wait, **kwargs)

set_teach_sensitivity(value, wait=True)

Set the sensitivity of drag and teach

Note
  1. Use only if necessary.
  2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
  3. Use clean_conf() to restore the system default settings.

Parameters:

Name Type Description Default
value

sensitivity value, 1~5

required
wait

whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
def set_teach_sensitivity(self, value, wait=True):
    """
    Set the sensitivity of drag and teach

    Note:
        1. Use only if necessary.
        2. Changes are not saved automatically. Call save_conf() to save the settings, otherwise they will be lost after a reboot.
        3. Use clean_conf() to restore the system default settings.

    Args:
        value: sensitivity value, 1~5

        wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_teach_sensitivity(value, wait=wait)

set_tgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

Set the digital value of the specified Tool GPIO when the robot has reached the specified xyz position

Parameters:

Name Type Description Default
ionum

0 or 1

required
value

value

required
xyz

position xyz, as [x, y, z]

required
fault_tolerance_radius

fault tolerance radius

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
def set_tgpio_digital_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
    """
    Set the digital value of the specified Tool GPIO when the robot has reached the specified xyz position           

    Args:
        ionum: 0 or 1

        value: value

        xyz: position xyz, as [x, y, z]

        fault_tolerance_radius: fault tolerance radius

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details. 
    """
    return self.arm.set_tgpio_digital_with_xyz(ionum, value, xyz, fault_tolerance_radius)

set_timeout(timeout)

Set the timeout of cmd response

Parameters:

Name Type Description Default
timeout

seconds

required
Source code in actions\settings.py
1029
1030
1031
1032
1033
1034
1035
1036
def set_timeout(self, timeout):
    """
    Set the timeout of cmd response

    Args:
        timeout: seconds
    """
    return self.arm.set_timeout(timeout)

set_world_offset(offset, is_radian=None, wait=True)

Set the base coordinate offset

Note
  1. This interface relies on Firmware 1.2.11 or above

Parameters:

Name Type Description Default
offset

[x, y, z, roll, pitch, yaw]

required
is_radian

if the roll/pitch/yaw is in radians or not, defaults to self.default_is_radian

None
wait

whether to wait for the robotic arm to stop or all previous queue commands to be executed/cleared before setting

True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\settings.py
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
def set_world_offset(self, offset, is_radian=None, wait=True):
    """
    Set the base coordinate offset

    Note:
        1. This interface relies on Firmware 1.2.11 or above

    Args:
        offset: [x, y, z, roll, pitch, yaw]

        is_radian: if the roll/pitch/yaw is in radians or not, defaults to self.default_is_radian

        wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed/cleared before setting

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_world_offset(offset, is_radian=is_radian, wait=wait)