Skip to content

Gripper Controls

This page contains information on all functions present within gripper.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 allow for control of at least the majority of different grippers offered by ufactory with their arms.

Functions

gripper_control

Source code in actions\gripper.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
class gripper_control():

    def __init__(self, arm:XArmAPI):
        self.arm = arm


    def set_gripper_enable(self, enable, **kwargs):
        """
        Enable the gripper

        Args:
            enable: enable or not

                Note: such as code = arm.set_gripper_enable(True) to turn on the Gripper

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

    def set_gripper_mode(self, mode, **kwargs):
        """
        Set the gripper mode

        Args:
            mode: 0: location mode

                Note: such as code = arm.set_gripper_mode(0)

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

    def set_gripper_speed(self, speed, **kwargs):
        """
        Set the gripper speed

        Args:
            speed: speed

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

    def set_gripper_position(self, pos, wait=False, speed=None, auto_enable=False, timeout=None, **kwargs):
        """
        Set the gripper position

        Args:
            pos: position

            wait: wait or not, default is False

            speed: speed, unit: r/min

            auto_enable: auto enable or not, default is False

            timeout: wait time, unit: second, default is 10s

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_gripper_position(pos, wait=wait, speed=speed, auto_enable=auto_enable, timeout=timeout, **kwargs)

    def get_gripper_position(self, **kwargs):
        """
        Get the gripper position (pulse)

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

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

            pos (int): gripper position
        """
        return self.arm.get_gripper_position(**kwargs)

    def get_gripper_err_code(self, **kwargs):
        """
        Get the gripper error code

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

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

            err_code (int): See the [Gripper Error Code Documentation](./xarm_api_code.md#gripper-error-code) for details.
        """
        return self.arm.get_gripper_err_code(**kwargs)

    def clean_gripper_error(self, **kwargs):
        """
        Clean the gripper error

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

    def get_gripper_status(self):
        """
        Get the status of the xArm Gripper

        Note:
            1. Only available if gripper_version >= 3.4.3

        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):
                status & 0x03 == 0: stop state

                status & 0x03 == 1: move state 

                status & 0x03 == 2: grasp state
        """
        return self.arm.get_gripper_status()

    def get_gripper_g2_position(self, **kwargs):
        """
        Get the position (mm) of the xArm Gripper G2

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

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

            pos (int): gripper position (mm)
        """
        return self.arm.get_gripper_g2_position(**kwargs)

    def set_gripper_g2_position(self, pos, speed=100, force=50, wait=False, timeout=None, **kwargs):
        """
        Set the position of the xArm Gripper G2

        Args:
            pos: gripper pos between 0 and 84, (unit: mm)

            speed: gripper speed between 15 and 225, default is 100, (unit: mm/s)

            force: gripper force between 1 and 100, default is 50

            wait: whether to wait for the xArm Gripper G2 motion to complete, default is False

            timeout: maximum waiting time(unit: second), default is 10s, only valid if wait is True

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_gripper_g2_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def set_bio_gripper_enable(self, enable=True, wait=True, timeout=3):
        """
        Enable the bio gripper

        Args:
            enable: enable or not

            wait: whether to wait for the bio gripper enable to complete, default is True

            timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

    def set_bio_gripper_speed(self, speed):
        """
        Set the speed of the bio gripper

        Args:
            speed: speed

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

    def set_bio_gripper_control_mode(self, mode):
        """
        Set the bio gripper control mode

        Note:
            1. Only available in the new version of BIO Gripper

        Args:
            mode: mode

                0: bio gripper opening and closing mode

                1: position loop mode

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

        return self.arm.set_bio_gripper_control_mode(mode)

    def set_bio_gripper_force(self, force):
        """
        Set the bio gripper force

        Note:
            1. Only available in the new version of BIO Gripper

        Args:
            force: gripper force between 10 and 100

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

        return self.arm.set_bio_gripper_force(force)

    def get_bio_gripper_g2_position(self, **kwargs):
        """
        Get the position (mm) of the BIO Gripper G2

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

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

            pos (int): bio gripper g2 position (mm)
        """
        return self.arm.get_bio_gripper_g2_position(**kwargs)

    def set_bio_gripper_g2_position(self, pos, speed=2000, force=100, wait=True, timeout=5, **kwargs):
        """
        Set the position of BIO Gripper G2

        Args:
            pos: gripper pos between 71 and 150, (unit: mm)

            speed: gripper speed between 500 and 4500, default is 2000, (unit: pulse/s)

            force: gripper force between 1 and 100, default is 100

            wait: whether to wait for the BIO Gripper G2 motion to complete, default is False

            timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

        Returns:
            out: tuple((code, robotiq_response))

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

            robotiq_response: See the robotiq documentation
        """
        return self.arm.set_bio_gripper_g2_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def open_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
        """
        Open the bio gripper

        Args:
            speed: speed value, default is 0 (speed not set)

            wait: whether to wait for the bio gripper motion to complete, default is True

            timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

    def close_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
        """
        Close the bio gripper

        Args:
            speed: speed value, default is 0 (speed not set)

            wait: whether to wait for the bio gripper motion complete, default is True

            timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

    def get_bio_gripper_status(self):
        """
        Get the status of the bio gripper

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

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

            status (int): status
                status & 0x03 == 0: stop

                status & 0x03 == 1: motion

                status & 0x03 == 2: catch

                status & 0x03 == 3: error

                (status >> 2) & 0x03 == 0: not enabled

                (status >> 2) & 0x03 == 1: enabling

                (status >> 2) & 0x03 == 2: enabled
        """
        return self.arm.get_bio_gripper_status()

    def get_bio_gripper_error(self):
        """
        Get the error code of the bio gripper

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

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

            error_code (int): See the [Bio Gripper Error Code Documentation](./xarm_api_code.md#bio-gripper-error-code) for details. 
        """
        return self.arm.get_bio_gripper_error()

    def clean_bio_gripper_error(self):
        """
        Clean the error code of the bio gripper

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

    def robotiq_reset(self):
        """
        Reset the robotiq gripper (clear previous activation if any)

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

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

            robotiq_response (int): See the robotiq documentation
        """
        return self.arm.robotiq_reset()

    def robotiq_set_activate(self, wait=True, timeout=3):
        """
        Activate the robotiq gripper if it is not already active

        Args:
            wait: whether to wait for the robotiq activate to complete, default is True

            timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

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

            robotiq_response (int): See the robotiq documentation 
        """
        return self.arm.robotiq_set_activate(wait=wait, timeout=timeout)

    def robotiq_set_position(self, pos, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
        """
        Go to the position with determined speed and force.

        Args:
            pos: position of the gripper. Integer between 0 and 255. 0 being the open position and 255 being the close position.

            speed: gripper speed between 0 and 255

            force: gripper force between 0 and 255

            wait: whether to wait for the robotiq motion complete, default is True

            timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

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

            robotiq_response (int): See the robotiq documentation 
        """
        return self.arm.robotiq_set_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def robotiq_open(self, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
        """
        Open the robotiq gripper

        Args:
            speed: gripper speed between 0 and 255

            force: gripper force between 0 and 255

            wait: whether to wait for the robotiq motion to complete, default is True

            timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

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

            robotiq_response (int): See the robotiq documentation 
        """
        return self.arm.robotiq_open(speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def robotiq_close(self, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
        """
        Close the robotiq gripper

        Args:
            speed: gripper speed between 0 and 255

            force: gripper force between 0 and 255

            wait: whether to wait for the robotiq motion to complete, default is True

            timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

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

            robotiq_response (int): See the robotiq documentation
        """
        return self.arm.robotiq_close(speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def robotiq_get_status(self, number_of_registers=3):
        """
        Reading the status of robotiq gripper

        Args:
            number_of_registers: number of registers, 1/2/3, default is 3

                number_of_registers=1: reading the content of register 0x07D0

                number_of_registers=2: reading the content of register 0x07D0/0x07D1

                number_of_registers=3: reading the content of register 0x07D0/0x07D1/0x07D2

        Note: 
            register 0x07D0: Register GRIPPER STATUS

            register 0x07D1: Register FAULT STATUS and register POSITION REQUEST ECHO

            register 0x07D2: Register POSITION and register CURRENT

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

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

            robotiq_response (int): See the robotiq documentation
        """
        return self.arm.robotiq_get_status(number_of_registers=number_of_registers)

    def get_vacuum_gripper(self, hardware_version=1):
        """
        Get the state of the Vacuum Gripper

        Args:
            hardware_version: hardware version

                1: Plug-in Connection, default

                2: Contact Connection

        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 of the Vacuum Gripper

                -1: Vacuum Gripper is off  

                0: Object not picked by vacuum gripper 

                1: Object picked by vacuum gripper
        """
        return self.arm.get_vacuum_gripper(hardware_version=hardware_version)

    def set_vacuum_gripper(self, on, wait=False, timeout=3, delay_sec=None, sync=True, hardware_version=1):
        """
        Set the Vacuum Gripper ON/OFF

        Args:
            on: open or not

                on=True: equivalent to calling `set_tgpio_digital(0, 1)` and `set_tgpio_digital(1, 0)`

                on=False: equivalent to calling `set_tgpio_digital(0, 0)` and `set_tgpio_digital(1, 1)`

            wait: wait the object picked by the vacuum gripper or not, default is False

            timeout: wait time, unit:second, default is 3s

            delay_sec: delay effective time from the current start, in seconds, default is None(effective immediately)

            sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

                1. only available if firmware_version >= 2.4.101

                2. only available if delay_sec <= 0

            hardware_version: hardware version

                1: Plug-in Connection, default

                2: Contact Connection

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_vacuum_gripper(on, wait=wait, timeout=timeout, delay_sec=delay_sec, sync=sync, hardware_version=hardware_version)

    def set_dhpgc_gripper_activate(self, wait=True, timeout=3):
        """
        Activate the DH-PGC-140-50 gripper if it is not already active

        Args:
            wait: whether to wait for the DH-PGC-140-50  gripper activate complete, default is True

            timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

    def set_dhpgc_gripper_position(self, pos, speed=50, force=50, wait=True, timeout=5, **kwargs):
        """
        Set the position of the DH-PGC-140-50 gripper

        Args:
            pos: gripper pos between 0 and 1000

            speed: gripper speed between 1 and 100

            force: gripper force between 20 and 100

            wait: whether to wait for the DH-PGC-140-50 gripper motion to complete, default is True

            timeout: maximum waiting time(unit: second), default is 5s, only available if wait=True

        Returns:
            code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
        """
        return self.arm.set_dhpgc_gripper_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

    def open_lite6_gripper(self, sync=True):
        """
        Open the gripper of Lite6 series robotic arms

        Note:
            1. only available if firmware_version >= 1.10.0
            2. this API can only be used on Lite6 series robotic arms

        Args:
            sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

                1. only available if firmware_version >= 2.4.101

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

    def close_lite6_gripper(self, sync=True):
        """
        Close the gripper of Lite6 series robotic arms

        Note:
            1. only available if firmware_version >= 1.10.0
            2. this API can only be used on Lite6 series robotic arms

        Args:
            sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

                1. only available if firmware_version >= 2.4.101

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

    def stop_lite6_gripper(self, sync=True):
        """
        Stop the gripper of Lite6 series robotic arms

        Note:
            1. only available if firmware_version >= 1.10.0
            2. this API can only be used on Lite6 series robotic arms

        Args:
            sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

                1. only available if firmware_version >= 2.4.101

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

clean_bio_gripper_error()

Clean the error code of the bio gripper

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
330
331
332
333
334
335
336
337
def clean_bio_gripper_error(self):
    """
    Clean the error code of the bio gripper

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

clean_gripper_error(**kwargs)

Clean the gripper error

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
 95
 96
 97
 98
 99
100
101
102
def clean_gripper_error(self, **kwargs):
    """
    Clean the gripper error

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

close_bio_gripper(speed=0, wait=True, timeout=5, **kwargs)

Close the bio gripper

Parameters:

Name Type Description Default
speed

speed value, default is 0 (speed not set)

0
wait

whether to wait for the bio gripper motion complete, default is True

True
timeout

maximum waiting time(unit: second), default is 5, only available if wait=True

5

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
def close_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
    """
    Close the bio gripper

    Args:
        speed: speed value, default is 0 (speed not set)

        wait: whether to wait for the bio gripper motion complete, default is True

        timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

close_lite6_gripper(sync=True)

Close the gripper of Lite6 series robotic arms

Note
  1. only available if firmware_version >= 1.10.0
  2. this API can only be used on Lite6 series robotic arms

Parameters:

Name Type Description Default
sync

whether to execute in the motion queue, set to False to execute immediately(default is True)

  1. only available if firmware_version >= 2.4.101
True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
def close_lite6_gripper(self, sync=True):
    """
    Close the gripper of Lite6 series robotic arms

    Note:
        1. only available if firmware_version >= 1.10.0
        2. this API can only be used on Lite6 series robotic arms

    Args:
        sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

            1. only available if firmware_version >= 2.4.101

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

get_bio_gripper_error()

Get the error code of the bio gripper

Returns:

Name Type Description
out tuple[int, int]

tuple((code, error_code))

code int

See the API Code Documentation for details.

error_code int
Source code in actions\gripper.py
317
318
319
320
321
322
323
324
325
326
327
328
def get_bio_gripper_error(self):
    """
    Get the error code of the bio gripper

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

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

        error_code (int): See the [Bio Gripper Error Code Documentation](./xarm_api_code.md#bio-gripper-error-code) for details. 
    """
    return self.arm.get_bio_gripper_error()

get_bio_gripper_g2_position(**kwargs)

Get the position (mm) of the BIO Gripper G2

Returns:

Name Type Description
out tuple[int, int]

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

code int

See the API Code Documentation for details.

pos int

bio gripper g2 position (mm)

Source code in actions\gripper.py
222
223
224
225
226
227
228
229
230
231
232
233
def get_bio_gripper_g2_position(self, **kwargs):
    """
    Get the position (mm) of the BIO Gripper G2

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

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

        pos (int): bio gripper g2 position (mm)
    """
    return self.arm.get_bio_gripper_g2_position(**kwargs)

get_bio_gripper_status()

Get the status of the bio gripper

Returns:

Name Type Description
out tuple[int, int]

tuple((code, status))

code int

See the API Code Documentation for details.

status int

status status & 0x03 == 0: stop

status & 0x03 == 1: motion

status & 0x03 == 2: catch

status & 0x03 == 3: error

(status >> 2) & 0x03 == 0: not enabled

(status >> 2) & 0x03 == 1: enabling

(status >> 2) & 0x03 == 2: enabled

Source code in actions\gripper.py
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
def get_bio_gripper_status(self):
    """
    Get the status of the bio gripper

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

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

        status (int): status
            status & 0x03 == 0: stop

            status & 0x03 == 1: motion

            status & 0x03 == 2: catch

            status & 0x03 == 3: error

            (status >> 2) & 0x03 == 0: not enabled

            (status >> 2) & 0x03 == 1: enabling

            (status >> 2) & 0x03 == 2: enabled
    """
    return self.arm.get_bio_gripper_status()

get_gripper_err_code(**kwargs)

Get the gripper error code

Returns:

Name Type Description
out tuple[int, int]

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

code int

See the API Code Documentation for details.

err_code int

See the Gripper Error Code Documentation for details.

Source code in actions\gripper.py
82
83
84
85
86
87
88
89
90
91
92
93
def get_gripper_err_code(self, **kwargs):
    """
    Get the gripper error code

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

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

        err_code (int): See the [Gripper Error Code Documentation](./xarm_api_code.md#gripper-error-code) for details.
    """
    return self.arm.get_gripper_err_code(**kwargs)

get_gripper_g2_position(**kwargs)

Get the position (mm) of the xArm Gripper G2

Returns:

Name Type Description
out tuple[int, int]

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

code int

See the API Code Documentation for details.

pos int

gripper position (mm)

Source code in actions\gripper.py
125
126
127
128
129
130
131
132
133
134
135
136
def get_gripper_g2_position(self, **kwargs):
    """
    Get the position (mm) of the xArm Gripper G2

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

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

        pos (int): gripper position (mm)
    """
    return self.arm.get_gripper_g2_position(**kwargs)

get_gripper_position(**kwargs)

Get the gripper position (pulse)

Returns:

Name Type Description
out tuple[int, int]

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

code int

See the API Code Documentation for details.

pos int

gripper position

Source code in actions\gripper.py
69
70
71
72
73
74
75
76
77
78
79
80
def get_gripper_position(self, **kwargs):
    """
    Get the gripper position (pulse)

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

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

        pos (int): gripper position
    """
    return self.arm.get_gripper_position(**kwargs)

get_gripper_status()

Get the status of the xArm Gripper

Note
  1. Only available if gripper_version >= 3.4.3

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

status & 0x03 == 0: stop state

status & 0x03 == 1: move state

status & 0x03 == 2: grasp state

Source code in actions\gripper.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
def get_gripper_status(self):
    """
    Get the status of the xArm Gripper

    Note:
        1. Only available if gripper_version >= 3.4.3

    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):
            status & 0x03 == 0: stop state

            status & 0x03 == 1: move state 

            status & 0x03 == 2: grasp state
    """
    return self.arm.get_gripper_status()

get_vacuum_gripper(hardware_version=1)

Get the state of the Vacuum Gripper

Parameters:

Name Type Description Default
hardware_version

hardware version

1: Plug-in Connection, default

2: Contact Connection

1

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 of the Vacuum Gripper

-1: Vacuum Gripper is off

0: Object not picked by vacuum gripper

1: Object picked by vacuum gripper

Source code in actions\gripper.py
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
def get_vacuum_gripper(self, hardware_version=1):
    """
    Get the state of the Vacuum Gripper

    Args:
        hardware_version: hardware version

            1: Plug-in Connection, default

            2: Contact Connection

    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 of the Vacuum Gripper

            -1: Vacuum Gripper is off  

            0: Object not picked by vacuum gripper 

            1: Object picked by vacuum gripper
    """
    return self.arm.get_vacuum_gripper(hardware_version=hardware_version)

open_bio_gripper(speed=0, wait=True, timeout=5, **kwargs)

Open the bio gripper

Parameters:

Name Type Description Default
speed

speed value, default is 0 (speed not set)

0
wait

whether to wait for the bio gripper motion to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 5, only available if wait=True

5

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
def open_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
    """
    Open the bio gripper

    Args:
        speed: speed value, default is 0 (speed not set)

        wait: whether to wait for the bio gripper motion to complete, default is True

        timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

open_lite6_gripper(sync=True)

Open the gripper of Lite6 series robotic arms

Note
  1. only available if firmware_version >= 1.10.0
  2. this API can only be used on Lite6 series robotic arms

Parameters:

Name Type Description Default
sync

whether to execute in the motion queue, set to False to execute immediately(default is True)

  1. only available if firmware_version >= 2.4.101
True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
def open_lite6_gripper(self, sync=True):
    """
    Open the gripper of Lite6 series robotic arms

    Note:
        1. only available if firmware_version >= 1.10.0
        2. this API can only be used on Lite6 series robotic arms

    Args:
        sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

            1. only available if firmware_version >= 2.4.101

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

robotiq_close(speed=255, force=255, wait=True, timeout=5, **kwargs)

Close the robotiq gripper

Parameters:

Name Type Description Default
speed

gripper speed between 0 and 255

255
force

gripper force between 0 and 255

255
wait

whether to wait for the robotiq motion to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 3, only available if wait=True

5

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
def robotiq_close(self, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
    """
    Close the robotiq gripper

    Args:
        speed: gripper speed between 0 and 255

        force: gripper force between 0 and 255

        wait: whether to wait for the robotiq motion to complete, default is True

        timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

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

        robotiq_response (int): See the robotiq documentation
    """
    return self.arm.robotiq_close(speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

robotiq_get_status(number_of_registers=3)

Reading the status of robotiq gripper

Parameters:

Name Type Description Default
number_of_registers

number of registers, 1/2/3, default is 3

number_of_registers=1: reading the content of register 0x07D0

number_of_registers=2: reading the content of register 0x07D0/0x07D1

number_of_registers=3: reading the content of register 0x07D0/0x07D1/0x07D2

3
Note

register 0x07D0: Register GRIPPER STATUS

register 0x07D1: Register FAULT STATUS and register POSITION REQUEST ECHO

register 0x07D2: Register POSITION and register CURRENT

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
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
def robotiq_get_status(self, number_of_registers=3):
    """
    Reading the status of robotiq gripper

    Args:
        number_of_registers: number of registers, 1/2/3, default is 3

            number_of_registers=1: reading the content of register 0x07D0

            number_of_registers=2: reading the content of register 0x07D0/0x07D1

            number_of_registers=3: reading the content of register 0x07D0/0x07D1/0x07D2

    Note: 
        register 0x07D0: Register GRIPPER STATUS

        register 0x07D1: Register FAULT STATUS and register POSITION REQUEST ECHO

        register 0x07D2: Register POSITION and register CURRENT

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

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

        robotiq_response (int): See the robotiq documentation
    """
    return self.arm.robotiq_get_status(number_of_registers=number_of_registers)

robotiq_open(speed=255, force=255, wait=True, timeout=5, **kwargs)

Open the robotiq gripper

Parameters:

Name Type Description Default
speed

gripper speed between 0 and 255

255
force

gripper force between 0 and 255

255
wait

whether to wait for the robotiq motion to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 5, only available if wait=True

5

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
def robotiq_open(self, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
    """
    Open the robotiq gripper

    Args:
        speed: gripper speed between 0 and 255

        force: gripper force between 0 and 255

        wait: whether to wait for the robotiq motion to complete, default is True

        timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

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

        robotiq_response (int): See the robotiq documentation 
    """
    return self.arm.robotiq_open(speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

robotiq_reset()

Reset the robotiq gripper (clear previous activation if any)

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
339
340
341
342
343
344
345
346
347
348
349
350
def robotiq_reset(self):
    """
    Reset the robotiq gripper (clear previous activation if any)

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

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

        robotiq_response (int): See the robotiq documentation
    """
    return self.arm.robotiq_reset()

robotiq_set_activate(wait=True, timeout=3)

Activate the robotiq gripper if it is not already active

Parameters:

Name Type Description Default
wait

whether to wait for the robotiq activate to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 3, only available if wait=True

3

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
def robotiq_set_activate(self, wait=True, timeout=3):
    """
    Activate the robotiq gripper if it is not already active

    Args:
        wait: whether to wait for the robotiq activate to complete, default is True

        timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

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

        robotiq_response (int): See the robotiq documentation 
    """
    return self.arm.robotiq_set_activate(wait=wait, timeout=timeout)

robotiq_set_position(pos, speed=255, force=255, wait=True, timeout=5, **kwargs)

Go to the position with determined speed and force.

Parameters:

Name Type Description Default
pos

position of the gripper. Integer between 0 and 255. 0 being the open position and 255 being the close position.

required
speed

gripper speed between 0 and 255

255
force

gripper force between 0 and 255

255
wait

whether to wait for the robotiq motion complete, default is True

True
timeout

maximum waiting time(unit: second), default is 5, only available if wait=True

5

Returns:

Name Type Description
out tuple[int, int]

tuple((code, robotiq_response))

code int

See the API Code Documentation for details.

robotiq_response int

See the robotiq documentation

Source code in actions\gripper.py
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
def robotiq_set_position(self, pos, speed=0xFF, force=0xFF, wait=True, timeout=5, **kwargs):
    """
    Go to the position with determined speed and force.

    Args:
        pos: position of the gripper. Integer between 0 and 255. 0 being the open position and 255 being the close position.

        speed: gripper speed between 0 and 255

        force: gripper force between 0 and 255

        wait: whether to wait for the robotiq motion complete, default is True

        timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

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

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

        robotiq_response (int): See the robotiq documentation 
    """
    return self.arm.robotiq_set_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

set_bio_gripper_control_mode(mode)

Set the bio gripper control mode

Note
  1. Only available in the new version of BIO Gripper

Parameters:

Name Type Description Default
mode

mode

0: bio gripper opening and closing mode

1: position loop mode

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
def set_bio_gripper_control_mode(self, mode):
    """
    Set the bio gripper control mode

    Note:
        1. Only available in the new version of BIO Gripper

    Args:
        mode: mode

            0: bio gripper opening and closing mode

            1: position loop mode

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

    return self.arm.set_bio_gripper_control_mode(mode)

set_bio_gripper_enable(enable=True, wait=True, timeout=3)

Enable the bio gripper

Parameters:

Name Type Description Default
enable

enable or not

True
wait

whether to wait for the bio gripper enable to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 3, only available if wait=True

3

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
def set_bio_gripper_enable(self, enable=True, wait=True, timeout=3):
    """
    Enable the bio gripper

    Args:
        enable: enable or not

        wait: whether to wait for the bio gripper enable to complete, default is True

        timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

set_bio_gripper_force(force)

Set the bio gripper force

Note
  1. Only available in the new version of BIO Gripper

Parameters:

Name Type Description Default
force

gripper force between 10 and 100

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
def set_bio_gripper_force(self, force):
    """
    Set the bio gripper force

    Note:
        1. Only available in the new version of BIO Gripper

    Args:
        force: gripper force between 10 and 100

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

    return self.arm.set_bio_gripper_force(force)

set_bio_gripper_g2_position(pos, speed=2000, force=100, wait=True, timeout=5, **kwargs)

Set the position of BIO Gripper G2

Parameters:

Name Type Description Default
pos

gripper pos between 71 and 150, (unit: mm)

required
speed

gripper speed between 500 and 4500, default is 2000, (unit: pulse/s)

2000
force

gripper force between 1 and 100, default is 100

100
wait

whether to wait for the BIO Gripper G2 motion to complete, default is False

True
timeout

maximum waiting time(unit: second), default is 5, only available if wait=True

5

Returns:

Name Type Description
out

tuple((code, robotiq_response))

code

See the API Code Documentation for details.

robotiq_response

See the robotiq documentation

Source code in actions\gripper.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
def set_bio_gripper_g2_position(self, pos, speed=2000, force=100, wait=True, timeout=5, **kwargs):
    """
    Set the position of BIO Gripper G2

    Args:
        pos: gripper pos between 71 and 150, (unit: mm)

        speed: gripper speed between 500 and 4500, default is 2000, (unit: pulse/s)

        force: gripper force between 1 and 100, default is 100

        wait: whether to wait for the BIO Gripper G2 motion to complete, default is False

        timeout: maximum waiting time(unit: second), default is 5, only available if wait=True

    Returns:
        out: tuple((code, robotiq_response))

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

        robotiq_response: See the robotiq documentation
    """
    return self.arm.set_bio_gripper_g2_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

set_bio_gripper_speed(speed)

Set the speed of the bio gripper

Parameters:

Name Type Description Default
speed

speed

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
174
175
176
177
178
179
180
181
182
183
184
def set_bio_gripper_speed(self, speed):
    """
    Set the speed of the bio gripper

    Args:
        speed: speed

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

set_dhpgc_gripper_activate(wait=True, timeout=3)

Activate the DH-PGC-140-50 gripper if it is not already active

Parameters:

Name Type Description Default
wait

whether to wait for the DH-PGC-140-50 gripper activate complete, default is True

True
timeout

maximum waiting time(unit: second), default is 3, only available if wait=True

3

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
527
528
529
530
531
532
533
534
535
536
537
538
539
def set_dhpgc_gripper_activate(self, wait=True, timeout=3):
    """
    Activate the DH-PGC-140-50 gripper if it is not already active

    Args:
        wait: whether to wait for the DH-PGC-140-50  gripper activate complete, default is True

        timeout: maximum waiting time(unit: second), default is 3, only available if wait=True

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

set_dhpgc_gripper_position(pos, speed=50, force=50, wait=True, timeout=5, **kwargs)

Set the position of the DH-PGC-140-50 gripper

Parameters:

Name Type Description Default
pos

gripper pos between 0 and 1000

required
speed

gripper speed between 1 and 100

50
force

gripper force between 20 and 100

50
wait

whether to wait for the DH-PGC-140-50 gripper motion to complete, default is True

True
timeout

maximum waiting time(unit: second), default is 5s, only available if wait=True

5

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
def set_dhpgc_gripper_position(self, pos, speed=50, force=50, wait=True, timeout=5, **kwargs):
    """
    Set the position of the DH-PGC-140-50 gripper

    Args:
        pos: gripper pos between 0 and 1000

        speed: gripper speed between 1 and 100

        force: gripper force between 20 and 100

        wait: whether to wait for the DH-PGC-140-50 gripper motion to complete, default is True

        timeout: maximum waiting time(unit: second), default is 5s, only available if wait=True

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_dhpgc_gripper_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

set_gripper_enable(enable, **kwargs)

Enable the gripper

Parameters:

Name Type Description Default
enable

enable or not

Note: such as code = arm.set_gripper_enable(True) to turn on the Gripper

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
def set_gripper_enable(self, enable, **kwargs):
    """
    Enable the gripper

    Args:
        enable: enable or not

            Note: such as code = arm.set_gripper_enable(True) to turn on the Gripper

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

set_gripper_g2_position(pos, speed=100, force=50, wait=False, timeout=None, **kwargs)

Set the position of the xArm Gripper G2

Parameters:

Name Type Description Default
pos

gripper pos between 0 and 84, (unit: mm)

required
speed

gripper speed between 15 and 225, default is 100, (unit: mm/s)

100
force

gripper force between 1 and 100, default is 50

50
wait

whether to wait for the xArm Gripper G2 motion to complete, default is False

False
timeout

maximum waiting time(unit: second), default is 10s, only valid if wait is True

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
def set_gripper_g2_position(self, pos, speed=100, force=50, wait=False, timeout=None, **kwargs):
    """
    Set the position of the xArm Gripper G2

    Args:
        pos: gripper pos between 0 and 84, (unit: mm)

        speed: gripper speed between 15 and 225, default is 100, (unit: mm/s)

        force: gripper force between 1 and 100, default is 50

        wait: whether to wait for the xArm Gripper G2 motion to complete, default is False

        timeout: maximum waiting time(unit: second), default is 10s, only valid if wait is True

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_gripper_g2_position(pos, speed=speed, force=force, wait=wait, timeout=timeout, **kwargs)

set_gripper_mode(mode, **kwargs)

Set the gripper mode

Parameters:

Name Type Description Default
mode

0: location mode

Note: such as code = arm.set_gripper_mode(0)

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
23
24
25
26
27
28
29
30
31
32
33
34
35
def set_gripper_mode(self, mode, **kwargs):
    """
    Set the gripper mode

    Args:
        mode: 0: location mode

            Note: such as code = arm.set_gripper_mode(0)

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

set_gripper_position(pos, wait=False, speed=None, auto_enable=False, timeout=None, **kwargs)

Set the gripper position

Parameters:

Name Type Description Default
pos

position

required
wait

wait or not, default is False

False
speed

speed, unit: r/min

None
auto_enable

auto enable or not, default is False

False
timeout

wait time, unit: second, default is 10s

None

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def set_gripper_position(self, pos, wait=False, speed=None, auto_enable=False, timeout=None, **kwargs):
    """
    Set the gripper position

    Args:
        pos: position

        wait: wait or not, default is False

        speed: speed, unit: r/min

        auto_enable: auto enable or not, default is False

        timeout: wait time, unit: second, default is 10s

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_gripper_position(pos, wait=wait, speed=speed, auto_enable=auto_enable, timeout=timeout, **kwargs)

set_gripper_speed(speed, **kwargs)

Set the gripper speed

Parameters:

Name Type Description Default
speed

speed

required

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
37
38
39
40
41
42
43
44
45
46
47
def set_gripper_speed(self, speed, **kwargs):
    """
    Set the gripper speed

    Args:
        speed: speed

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

set_vacuum_gripper(on, wait=False, timeout=3, delay_sec=None, sync=True, hardware_version=1)

Set the Vacuum Gripper ON/OFF

Parameters:

Name Type Description Default
on

open or not

on=True: equivalent to calling set_tgpio_digital(0, 1) and set_tgpio_digital(1, 0)

on=False: equivalent to calling set_tgpio_digital(0, 0) and set_tgpio_digital(1, 1)

required
wait

wait the object picked by the vacuum gripper or not, default is False

False
timeout

wait time, unit:second, default is 3s

3
delay_sec

delay effective time from the current start, in seconds, default is None(effective immediately)

None
sync

whether to execute in the motion queue, set to False to execute immediately(default is True)

  1. only available if firmware_version >= 2.4.101

  2. only available if delay_sec <= 0

True
hardware_version

hardware version

1: Plug-in Connection, default

2: Contact Connection

1

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
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
def set_vacuum_gripper(self, on, wait=False, timeout=3, delay_sec=None, sync=True, hardware_version=1):
    """
    Set the Vacuum Gripper ON/OFF

    Args:
        on: open or not

            on=True: equivalent to calling `set_tgpio_digital(0, 1)` and `set_tgpio_digital(1, 0)`

            on=False: equivalent to calling `set_tgpio_digital(0, 0)` and `set_tgpio_digital(1, 1)`

        wait: wait the object picked by the vacuum gripper or not, default is False

        timeout: wait time, unit:second, default is 3s

        delay_sec: delay effective time from the current start, in seconds, default is None(effective immediately)

        sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

            1. only available if firmware_version >= 2.4.101

            2. only available if delay_sec <= 0

        hardware_version: hardware version

            1: Plug-in Connection, default

            2: Contact Connection

    Returns:
        code (int): See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
    """
    return self.arm.set_vacuum_gripper(on, wait=wait, timeout=timeout, delay_sec=delay_sec, sync=sync, hardware_version=hardware_version)

stop_lite6_gripper(sync=True)

Stop the gripper of Lite6 series robotic arms

Note
  1. only available if firmware_version >= 1.10.0
  2. this API can only be used on Lite6 series robotic arms

Parameters:

Name Type Description Default
sync

whether to execute in the motion queue, set to False to execute immediately(default is True)

  1. only available if firmware_version >= 2.4.101
True

Returns:

Name Type Description
code int

See the API Code Documentation for details.

Source code in actions\gripper.py
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
def stop_lite6_gripper(self, sync=True):
    """
    Stop the gripper of Lite6 series robotic arms

    Note:
        1. only available if firmware_version >= 1.10.0
        2. this API can only be used on Lite6 series robotic arms

    Args:
        sync: whether to execute in the motion queue, set to False to execute immediately(default is True)

            1. only available if firmware_version >= 2.4.101

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