curobo
CuRoboMotionGenerator
Class for motion generator using CuRobo backend
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
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 | |
tensor_args
property
Returns:
| Type | Description |
|---|---|
TensorDeviceType
|
tensor arguments used by this CuRobo instance |
__init__(robot, robot_cfg_path=None, robot_usd_path=None, device='cuda:0', motion_cfg_kwargs=None, batch_size=2, use_cuda_graph=True, debug=False, use_default_embodiment_only=False, collision_activation_distance=m.DEFAULT_COLLISION_ACTIVATION_DISTANCE)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot
|
BaseRobot
|
Robot for which to generate motion plans |
required |
robot_cfg_path
|
None or str
|
If specified, the path to the robot configuration to use. If None, will try to use a pre-configured one directly from curobo based on the robot class of @robot |
None
|
robot_usd_path
|
None or str
|
If specified, the path to the robot USD file to use. If None, will try to use a pre-configured one directly from curobo based on the robot class of @robot |
None
|
device
|
str
|
Which device to use for curobo |
'cuda:0'
|
motion_cfg_kwargs
|
None or dict
|
If specified, keyward arguments to pass to MotionGenConfig.load_from_robot_config(...) |
None
|
batch_size
|
int
|
Size of batches for computing trajectories. This must be FIXED |
2
|
use_cuda_graph
|
bool
|
Whether to use CUDA graph for motion generation or not |
True
|
debug
|
bool
|
Whether to debug generation or not, setting this True will set use_cuda_graph to False implicitly |
False
|
use_default_embodiment_only
|
bool
|
Whether to use only the default embodiment for the robot or not |
False
|
collision_activation_distance
|
float
|
Distance threshold at which a collision with the world is detected. Increasing this value will make the motion planner more conservative in its planning with respect to the underlying sphere representation of the robot. Note that this does not affect self-collisions detection. |
DEFAULT_COLLISION_ACTIVATION_DISTANCE
|
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
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 | |
add_linearly_interpolated_waypoints(traj, max_inter_dist=0.01)
Adds waypoints to the joint trajectory so that the joint position distance between each pairs of neighboring waypoints is less than @max_inter_dist
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traj
|
(T, D) tensor representing the joint trajectory |
required | |
max_inter_dist
|
float
|
Maximum joint position distance between two neighboring waypoints |
0.01
|
Returns:
| Type | Description |
|---|---|
tensor
|
(T', D) tensor representing the interpolated joint trajectory |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
check_collisions(q, initial_joint_pos=None, self_collision_check=True, skip_obstacle_update=False, attached_obj=None, attached_obj_scale=None)
Checks collisions between the sphere representation of the robot and the rest of the current scene
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
tensor
|
(N, D)-shaped tensor, representing N-total different joint configurations to check collisions against the world |
required |
initial_joint_pos
|
None or tensor
|
If specified, the initial joint positions to set the locked joints. Default is the current joint positions of the robot |
None
|
self_collision_check
|
bool
|
Whether to check self-collisions or not |
True
|
skip_obstacle_update
|
bool
|
Whether to skip updating the obstacles in the world collision checker |
False
|
attached_obj
|
None or Dict[str, BaseObject]
|
If specified, a dictionary where the keys are the end-effector link names and the values are the corresponding BaseObject instances to attach to that link |
None
|
attached_obj_scale
|
None or Dict[str, float]
|
If specified, a dictionary where the keys are the end-effector link names and the values are the corresponding scale to apply to the attached object |
None
|
Returns:
| Type | Description |
|---|---|
tensor
|
(N,)-shaped tensor, where each value is True if in collision, else False |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
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 | |
compute_trajectories(target_pos, target_quat, initial_joint_pos=None, is_local=False, max_attempts=5, timeout=2.0, ik_fail_return=5, enable_finetune_trajopt=True, finetune_attempts=1, return_full_result=False, success_ratio=None, attached_obj=None, attached_obj_scale=None, motion_constraint=None, skip_obstacle_update=False, ik_only=False, ik_world_collision_check=True, emb_sel=CuRoboEmbodimentSelection.DEFAULT)
Computes the robot joint trajectory to reach the desired @target_pos and @target_quat
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_pos
|
Dict[str, Tensor] or Tensor
|
The torch tensor shape is either (3,) or (N, 3) where each entry is an individual (x,y,z) position to reach with the default end-effector link specified @self.ee_link[emb_sel]. If a dictionary is given, the keys should be the end-effector links and the values should be the corresponding (N, 3) tensors |
required |
target_quat
|
Dict[str, Tensor] or Tensor
|
The torch tensor shape is either (4,) or (N, 4) where each entry is an individual (x,y,z,w) quaternion to reach with the default end-effector link specified @self.ee_link[emb_sel]. If a dictionary is given, the keys should be the end-effector links and the values should be the corresponding (N, 4) tensors |
required |
initial_joint_pos
|
None or Tensor
|
If specified, the initial joint positions to start the trajectory. Default is the current joint positions of the robot |
None
|
is_local
|
bool
|
Whether @target_pos and @target_quat are specified in the robot's local frame or the world global frame |
False
|
max_attempts
|
int
|
Maximum number of attempts for trying to compute a valid trajectory |
5
|
timeout
|
float
|
Maximum time in seconds allowed to solve the motion generation problem |
2.0
|
ik_fail_return
|
None or int
|
Number of IK attempts allowed before returning a failure. Set this to a low value (5) to save compute time when an unreachable goal is given |
5
|
enable_finetune_trajopt
|
bool
|
Whether to enable timing reparameterization for a smoother trajectory |
True
|
finetune_attempts
|
int
|
Number of attempts to run finetuning trajectory optimization. Every attempt will
increase the |
1
|
return_full_result
|
bool
|
Whether to return a list of raw MotionGenResult object(s) or a 2-tuple of (success, results); the default is the latter |
False
|
success_ratio
|
None or float
|
If set, specifies the fraction of successes necessary given self.batch_size. If None, will automatically be the smallest ratio (1 / self.batch_size), i.e: any nonzero number of successes |
None
|
attached_obj
|
None or Dict[str, BaseObject]
|
If specified, a dictionary where the keys are the end-effector link names and the values are the corresponding BaseObject instances to attach to that link |
None
|
attached_obj_scale
|
None or Dict[str, float]
|
If specified, a dictionary where the keys are the end-effector link names and the values are the corresponding scale to apply to the attached object |
None
|
motion_constraint
|
None or List[float]
|
If specified, the motion constraint vector is a 6D vector controlling end-effector movement (angular first, linear next): [qx, qy, qz, x, y, z]. Setting any component to 1.0 locks that axis, forcing the planner to reach the target using only the remaining unlocked axes. Details can be found here: https://curobo.org/advanced_examples/3_constrained_planning.html |
None
|
skip_obstacle_update
|
bool
|
Whether to skip updating the obstacles in the world collision checker |
False
|
ik_only
|
bool
|
Whether to only run the IK solver and not the trajectory optimization |
False
|
ik_world_collision_check
|
bool
|
Whether to check for collisions in the world when running the IK solver for ik_only mode |
True
|
emb_sel
|
CuRoboEmbodimentSelection
|
Which embodiment selection to use for computing trajectories |
DEFAULT
|
Returns: 2-tuple or list of MotionGenResult: If @return_full_result is True, will return a list of raw MotionGenResult object(s) computed from internal batch trajectory computations. If it is False, will return 2-tuple (success, results), where success is a (N,)-shaped boolean tensor representing whether each requested target pos / quat successfully generated a motion plan, and results is a (N,)-shaped array of corresponding JointState objects.
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
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 | |
path_to_eef_trajectory(path, return_axisangle=False, emb_sel=CuRoboEmbodimentSelection.DEFAULT)
Converts raw path from motion generator into end-effector trajectory sequence in the robot frame. This trajectory sequence can be executed by an IKController, although there is no guaranteee that the controller will output the same joint trajectory as the one computed by cuRobo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
JointState
|
Joint state path to convert into joint trajectory |
required |
return_axisangle
|
bool
|
Whether to return the interpolated orientations in quaternion or axis-angle representation |
False
|
emb_sel
|
CuRoboEmbodimentSelection
|
Which embodiment to use for the robot |
DEFAULT
|
Returns:
| Type | Description |
|---|---|
Dict[str, Tensor]
|
Mapping eef link names to (T, [6, 7])-shaped array where each entry is is the (x,y,z) position |
|
and (x,y,z,w) quaternion (if @return_axisangle is False) or (ax, ay, az) axis-angle orientation, specified in the robot frame. |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
path_to_joint_trajectory(path, get_full_js=True, emb_sel=CuRoboEmbodimentSelection.DEFAULT)
Converts raw path from motion generator into joint trajectory sequence
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
JointState
|
Joint state path to convert into joint trajectory |
required |
get_full_js
|
bool
|
Whether to get the full joint state |
True
|
emb_sel
|
CuRoboEmbodimentSelection
|
Which embodiment to use for the robot |
DEFAULT
|
Returns:
| Type | Description |
|---|---|
tensor
|
(T, D) tensor representing the interpolated joint trajectory to reach the desired @target_pos, @target_quat configuration, where T is the number of interpolated steps and D is the number of robot joints. |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
plan_batch(start_state, goal_pose, plan_config, link_poses=None, emb_sel=CuRoboEmbodimentSelection.DEFAULT)
Plan a batch of trajectories from a batch of start joint states to a batch of goal poses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_state
|
Start joint states of the robot. When planning from a non-static state,
i.e, when velocity or acceleration is non-zero, set :attr: |
required | |
goal_pose
|
Goal poses for the end-effector. |
required | |
plan_config
|
Planning parameters for motion generation. |
required | |
link_poses
|
Goal poses for each link in the robot when planning for multiple links. |
None
|
Returns:
| Type | Description |
|---|---|
MotionGenResult
|
Result of IK solution. Check :attr: |
bool
|
Whether the IK solution was successful for the batch. |
JointState
|
Joint state of the robot at the goal pose. |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
solve_ik_batch(start_state, goal_pose, plan_config, link_poses=None, emb_sel=CuRoboEmbodimentSelection.DEFAULT)
Find IK solutions to reach a batch of goal poses from a batch of start joint states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_state
|
Start joint states of the robot. When planning from a non-static state,
i.e, when velocity or acceleration is non-zero, set :attr: |
required | |
goal_pose
|
Goal poses for the end-effector.ik_ |
required | |
plan_config
|
Planning parameters for motion generation. |
required | |
link_poses
|
Goal poses for each link in the robot when planning for multiple links. |
None
|
Returns:
| Type | Description |
|---|---|
IKResult
|
Result of IK solution. Check :attr: |
bool
|
Whether the IK solution was successful for the batch. |
JointState
|
Joint state of the robot at the goal pose. |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
update_locked_joints(cu_joint_state, emb_sel)
Updates the locked joints and fixed transforms for the given embodiment selection This is needed to update curobo robot model about the current joint positions from Isaac.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cu_joint_state
|
JointState
|
JointState object representing the current joint positions |
required |
emb_sel
|
CuRoboEmbodimentSelection
|
Which embodiment selection to use for updating locked joints |
required |
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
update_obstacles(ignore_objects=None)
Updates internal world collision cache representation based on sim state
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ignore_objects
|
None or list of DatasetObject
|
If specified, objects that should be ignored when updating obstacles |
None
|
Source code in OmniGibson/omnigibson/action_primitives/curobo.py
create_world_mesh_collision(tensor_args, obb_cache_size=10, mesh_cache_size=2048, max_distance=0.05)
Creates a CuRobo WorldMeshCollision to use for collision checking
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor_args
|
TensorDeviceType
|
Tensor device information |
required |
obb_cache_size
|
int
|
Cache size for number of oriented bounding boxes supported in the collision world |
10
|
mesh_cache_size
|
int
|
Cache size for number of meshes supported in the collision world |
2048
|
max_distance
|
float
|
maximum distance when checking collisions (see curobo source code) |
0.05
|
Returns:
| Type | Description |
|---|---|
MeshCollisionWorld
|
collision world used to check against for collisions |