deprecated_utils
A set of utility functions slated to be deprecated once Omniverse bugs are fixed
ArticulationView
Bases: ArticulationView
ArticulationView with some additional functionality implemented.
Source code in omnigibson/utils/deprecated_utils.py
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 |
|
get_joint_limits(indices=None, joint_indices=None, clone=True)
Gets joint limits for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone
|
Optional[bool]
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
joint limits for articulations in the view. shape (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
get_joint_position_targets(indices=None, joint_indices=None, clone=True)
Get the joint position targets of articulations in the view
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone
|
bool
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
joint positions of articulations in the view. |
Union[ndarray, Tensor, indexedarray]
|
Shape is (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
get_joint_velocity_targets(indices=None, joint_indices=None, clone=True)
Get the joint velocity targets of articulations in the view
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone
|
bool
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
joint velocities of articulations in the view. |
Union[ndarray, Tensor, indexedarray]
|
Shape is (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
get_max_velocities(indices=None, joint_indices=None, clone=True)
Gets maximum velocities for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone
|
Optional[bool]
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
maximum velocities for articulations in the view. shape (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
set_joint_efforts(efforts, indices=None, joint_indices=None)
Set the joint efforts of articulations in the view
.. note::
This method can be used for effort control. For this purpose, there must be no joint drive
or the stiffness and damping must be set to zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
efforts
|
Optional[Union[ndarray, Tensor, array]]
|
efforts of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set the efforts for all the articulation joints to the indicated values.
>>> # Since there are 5 envs, the joint efforts are repeated 5 times
>>> efforts = np.tile(np.array([10, 20, 30, 40, 50, 60, 70, 80, 90]), (num_envs, 1))
>>> prims.set_joint_efforts(efforts)
>>>
>>> # set the fingers efforts: panda_finger_joint1 (7) and panda_finger_joint2 (8) to 10
>>> # for the first, middle and last of the 5 envs
>>> efforts = np.tile(np.array([10, 10]), (3, 1))
>>> prims.set_joint_efforts(efforts, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_joint_limits(values, indices=None, joint_indices=None)
Sets joint limits for articulation joints in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values
|
Union[ndarray, Tensor, array]
|
joint limits for articulations in the view. shape (M, K, 2). |
required |
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
set_joint_positions(positions, indices=None, joint_indices=None)
Set the joint positions of articulations in the view
.. warning::
This method will immediately set (teleport) the affected joints to the indicated value.
Use the ``set_joint_position_targets`` or the ``apply_action`` methods to control the articulation joints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions
|
Optional[Union[ndarray, Tensor, array]]
|
joint positions of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set all the articulation joints.
>>> # Since there are 5 envs, the joint positions are repeated 5 times
>>> positions = np.tile(np.array([0.0, -1.0, 0.0, -2.2, 0.0, 2.4, 0.8, 0.04, 0.04]), (num_envs, 1))
>>> prims.set_joint_positions(positions)
>>>
>>> # set only the fingers in closed position: panda_finger_joint1 (7) and panda_finger_joint2 (8) to 0.0
>>> # for the first, middle and last of the 5 envs
>>> positions = np.tile(np.array([0.0, 0.0]), (3, 1))
>>> prims.set_joint_positions(positions, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_joint_velocities(velocities, indices=None, joint_indices=None)
Set the joint velocities of articulations in the view
.. warning::
This method will immediately set the affected joints to the indicated value.
Use the ``set_joint_velocity_targets`` or the ``apply_action`` methods to control the articulation joints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
velocities
|
Optional[Union[ndarray, Tensor, array]]
|
joint velocities of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set the velocities for all the articulation joints to the indicated values.
>>> # Since there are 5 envs, the joint velocities are repeated 5 times
>>> velocities = np.tile(np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]), (num_envs, 1))
>>> prims.set_joint_velocities(velocities)
>>>
>>> # set the fingers velocities: panda_finger_joint1 (7) and panda_finger_joint2 (8) to -0.1
>>> # for the first, middle and last of the 5 envs
>>> velocities = np.tile(np.array([-0.1, -0.1]), (3, 1))
>>> prims.set_joint_velocities(velocities, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_max_velocities(values, indices=None, joint_indices=None)
Sets maximum velocities for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values
|
Union[ndarray, Tensor, array]
|
maximum velocities for articulations in the view. shape (M, K). |
required |
indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices
|
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
Core
Bases: Core
Subclass that overrides a specific function within Omni's Core class to fix a bug
Source code in omnigibson/utils/deprecated_utils.py
get_compute_graph(selected_paths, create_new_graph=True, created_paths=None)
Returns the first ComputeGraph found in selected_paths. If no graph is found and create_new_graph is true, a new graph will be created and its path appended to created_paths (if provided).
Source code in omnigibson/utils/deprecated_utils.py
CreateMeshPrimWithDefaultXformCommand
Bases: CreateMeshPrimWithDefaultXformCommand
Source code in omnigibson/utils/deprecated_utils.py
__init__(prim_type, **kwargs)
Creates primitive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prim_type
|
str
|
It supports Plane/Sphere/Cone/Cylinder/Disk/Torus/Cube. |
required |
kwargs
object_origin (Gf.Vec3f): Position of mesh center in stage units.
u_patches (int): The number of patches to tessellate U direction.
v_patches (int): The number of patches to tessellate V direction.
w_patches (int): The number of patches to tessellate W direction. It only works for Cone/Cylinder/Cube.
half_scale (float): Half size of mesh in centimeters. Default is None, which means it's controlled by settings.
u_verts_scale (int): Tessellation Level of U. It's a multiplier of u_patches.
v_verts_scale (int): Tessellation Level of V. It's a multiplier of v_patches.
w_verts_scale (int): Tessellation Level of W. It's a multiplier of w_patches. It only works for Cone/Cylinder/Cube. For Cone/Cylinder, it's to tessellate the caps. For Cube, it's to tessellate along z-axis.
above_ground (bool): It will offset the center of mesh above the ground plane if it's True, False otherwise. It's False by default. This param only works when param object_origin is not given. Otherwise, it will be ignored.
stage (Usd.Stage): If specified, stage to create prim on
Source code in omnigibson/utils/deprecated_utils.py
RigidPrimView
Bases: RigidPrimView
Source code in omnigibson/utils/deprecated_utils.py
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 |
|
disable_gravities(indices=None)
Disable gravity on rigid bodies (enabled by default).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, list, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
enable_gravities(indices=None)
Enable gravity on rigid bodies (enabled by default).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, list, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
get_angular_velocities(indices=None, clone=True)
Get the angular velocities of prims in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, list, Tensor, array]]
|
indices to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view) |
None
|
clone
|
bool
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
angular velocities of the prims in the view. shape is (M, 3). |
Example:
.. code-block:: python
>>> # get all rigid prim angular velocities. Returned shape is (5, 3) for the example: 5 envs, angular (3)
>>> prims.get_angular_velocities()
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
>>>
>>> # get only the rigid prim angular velocities for the first, middle and last of the 5 envs
>>> # Returned shape is (5, 3) for the example: 3 envs selected, angular (3)
>>> prims.get_angular_velocities(indices=np.array([0, 2, 4]))
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
Source code in omnigibson/utils/deprecated_utils.py
get_linear_velocities(indices=None, clone=True)
Get the linear velocities of prims in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, list, Tensor, array]]
|
indices to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view) |
None
|
clone
|
bool
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
linear velocities of the prims in the view. shape is (M, 3). |
Example:
.. code-block:: python
>>> # get all rigid prim linear velocities. Returned shape is (5, 3) for the example: 5 envs, linear (3)
>>> prims.get_linear_velocities()
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
>>>
>>> # get only the rigid prim linear velocities for the first, middle and last of the 5 envs.
>>> # Returned shape is (3, 3) for the example: 3 envs selected, linear (3)
>>> prims.get_linear_velocities(indices=np.array([0, 2, 4]))
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
Source code in omnigibson/utils/deprecated_utils.py
get_world_poses(indices=None, clone=True, usd=True)
Get the poses of the prims in the view with respect to the world's frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices
|
Optional[Union[ndarray, list, Tensor, array]]
|
indices to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
clone
|
bool
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
usd
|
bool
|
True to query from usd. Otherwise False to query from Fabric data. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[Tuple[ndarray, ndarray], Tuple[Tensor, Tensor], Tuple[indexedarray, indexedarray]]
|
|
Union[Tuple[ndarray, ndarray], Tuple[Tensor, Tensor], Tuple[indexedarray, indexedarray]]
|
first index is positions in the world frame of the prims. shape is (M, 3). |
Union[Tuple[ndarray, ndarray], Tuple[Tensor, Tensor], Tuple[indexedarray, indexedarray]]
|
second index is quaternion orientations in the world frame of the prims. |
Union[Tuple[ndarray, ndarray], Tuple[Tensor, Tensor], Tuple[indexedarray, indexedarray]]
|
quaternion is scalar-first (w, x, y, z). shape is (M, 4). |
Example:
.. code-block:: python
>>> # get all rigid prim poses with respect to the world's frame.
>>> # Returned shape is position (5, 3) and orientation (5, 4) for the example: 5 envs
>>> positions, orientations = prims.get_world_poses()
>>> positions
[[ 1.4999989e+00 -7.4999851e-01 -1.5118626e-07]
[ 1.4999989e+00 7.5000149e-01 -2.5988294e-07]
[-1.0017333e-06 -7.4999845e-01 7.6070329e-08]
[-9.5906785e-07 7.5000149e-01 1.0593490e-07]
[-1.5000011e+00 -7.4999851e-01 1.9655154e-07]]
>>> orientations
[[ 9.9999994e-01 -8.8168377e-07 -4.1946004e-07 -1.5067183e-08]
[ 9.9999994e-01 -8.8691013e-07 -4.2665880e-07 -2.7188951e-09]
[ 1.0000000e+00 -9.5171310e-07 -2.2615541e-07 5.5922797e-08]
[ 1.0000000e+00 -8.9923367e-07 -1.4408238e-07 1.3476099e-08]
[ 1.0000000e+00 -7.9806580e-07 -1.3064776e-07 5.3154917e-08]]
>>>
>>> # get only the rigid prim poses with respect to the world's frame for the first, middle and last of the 5 envs.
>>> # Returned shape is position (3, 3) and orientation (3, 4) for the example: 3 envs selected
>>> positions, orientations = prims.get_world_poses(indices=np.array([0, 2, 4]))
>>> positions
[[ 1.4999989e+00 -7.4999851e-01 -1.5118626e-07]
[-1.0017333e-06 -7.4999845e-01 7.6070329e-08]
[-1.5000011e+00 -7.4999851e-01 1.9655154e-07]]
>>> orientations
[[ 9.9999994e-01 -8.8168377e-07 -4.1946004e-07 -1.5067183e-08]
[ 1.0000000e+00 -9.5171310e-07 -2.2615541e-07 5.5922797e-08]
[ 1.0000000e+00 -7.9806580e-07 -1.3064776e-07 5.3154917e-08]]
Source code in omnigibson/utils/deprecated_utils.py
colorize_bboxes(bboxes_2d_data, bboxes_2d_rgb, num_channels=3)
Colorizes 2D bounding box data for visualization.
We are overriding the replicator native version of this function to fix a bug. In their version of this function, the ordering of the rectangle corners is incorrect and we fix it here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bboxes_2d_data
|
ndarray
|
2D bounding box data from the sensor. |
required |
bboxes_2d_rgb
|
ndarray
|
RGB data from the sensor to embed bounding box. |
required |
num_channels
|
int
|
Specify number of channels i.e. 3 or 4. |
3
|