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 | |
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 | |
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 | |
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 | |
close_lite6_gripper(sync=True)
Close the gripper of Lite6 series robotic arms
Note
- only available if firmware_version >= 1.10.0
- 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)
|
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 | |
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
|
See the Bio Gripper Error Code Documentation for details. |
Source code in actions\gripper.py
317 318 319 320 321 322 323 324 325 326 327 328 | |
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 | |
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 | |
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 | |
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 | |
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 | |
get_gripper_status()
Get the status of the xArm Gripper
Note
- 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 | |
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 | |
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 | |
open_lite6_gripper(sync=True)
Open the gripper of Lite6 series robotic arms
Note
- only available if firmware_version >= 1.10.0
- 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)
|
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
set_bio_gripper_control_mode(mode)
Set the bio gripper control mode
Note
- 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 | |
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 | |
set_bio_gripper_force(force)
Set the bio gripper force
Note
- 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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 on=False: equivalent to calling |
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)
|
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 | |
stop_lite6_gripper(sync=True)
Stop the gripper of Lite6 series robotic arms
Note
- only available if firmware_version >= 1.10.0
- 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)
|
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 | |