system_base
BaseSystem
Bases: Serializable
Base class for all systems. These are instanced objects that should be used globally for a given environment/scene. This is useful for items in a scene that are non-discrete / cannot be distinguished into individual instances, e.g.: water, particles, etc.
Source code in omnigibson/systems/system_base.py
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 |
|
material
property
Returns:
Type | Description |
---|---|
None or MaterialPrim
|
Material belonging to this system, if there is any |
n_particles
property
Returns:
Type | Description |
---|---|
int
|
Number of particles belonging to this system |
prim_path
property
Returns:
Type | Description |
---|---|
str
|
Path to this system's prim in the scene stage |
relative_prim_path
property
Returns:
Type | Description |
---|---|
str
|
Path to this system's prim in the scene stage relative to the world |
scene
property
Returns:
Type | Description |
---|---|
Scene or None
|
Scene object that this prim is loaded into |
clear()
Clears this system, so that it may possibly be re-initialized. Useful for, e.g., when loading from a new scene during the same sim instance
generate_particles(positions, orientations=None, scales=None, **kwargs)
Generates new particles
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions
|
tensor
|
(n_particles, 3) shaped array specifying per-particle (x,y,z) positions |
required |
orientations
|
None or tensor
|
(n_particles, 4) shaped array specifying per-particle (x,y,z,w) quaternion orientations. If not specified, all will be set to canonical orientation (0, 0, 0, 1) |
None
|
scales
|
None or tensor
|
(n_particles, 3) shaped array specifying per-particle (x,y,z) scales. If not specified, will be uniformly randomly sampled from (self.min_scale, self.max_scale) |
None
|
**kwargs
|
dict
|
Any additional keyword-specific arguments required by subclass implementation |
{}
|
Source code in omnigibson/systems/system_base.py
get_particle_local_pose(idx)
Compute particle's position and orientation in the particle's parent frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the particle to compute position and orientation for. Note: this is equivalent to grabbing the corresponding idx'th entry from @get_particles_local_pose() |
required |
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
get_particle_position_orientation(idx)
Compute particle's position and orientation. This automatically takes into account the relative pose w.r.t. its parent link and the global pose of that parent link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the particle to compute position and orientation for. Note: this is equivalent to grabbing the corresponding idx'th entry from @get_particles_position_orientation() |
required |
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
get_particles_local_pose()
Computes all particles' positions and orientations that belong to this system in the particles' parent frames
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
get_particles_position_orientation()
Computes all particles' positions and orientations that belong to this system in the world frame
Note: This is more optimized than doing a for loop with self.get_particle_position_orientation()
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
initialize(scene)
Initializes this system
Source code in omnigibson/systems/system_base.py
remove_all_particles()
remove_particles(idxs, **kwargs)
Removes pre-existing particles
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idxs
|
tensor
|
(n_particles,) shaped array specifying IDs of particles to delete |
required |
**kwargs
|
dict
|
Any additional keyword-specific arguments required by subclass implementation |
{}
|
Source code in omnigibson/systems/system_base.py
reset()
sample_scales(n)
Samples scales uniformly based on @self.min_scale and @self.max_scale
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
Number of scales to sample |
required |
Returns:
Type | Description |
---|---|
n, 3) array
|
Array of sampled scales |
Source code in omnigibson/systems/system_base.py
set_particle_local_pose(idx, position=None, orientation=None)
Sets particle's position and orientation in the particle's parent frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the particle to set position and orientation for. Note: this is equivalent to setting the corresponding idx'th entry from @set_particles_local_pose() |
required |
position
|
3 - array
|
particle (x,y,z) position |
None
|
orientation
|
4 - array
|
particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
set_particle_position_orientation(idx, position=None, orientation=None)
Sets particle's position and orientation. This automatically takes into account the relative pose w.r.t. its parent link and the global pose of that parent link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the particle to set position and orientation for. Note: this is equivalent to setting the corresponding idx'th entry from @set_particles_position_orientation() |
required |
position
|
3 - array
|
particle (x,y,z) position |
None
|
orientation
|
4 - array
|
particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
set_particles_local_pose(positions=None, orientations=None)
Sets all particles' positions and orientations that belong to this system in the particles' parent frames
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions
|
n - array
|
(n, 3) per-particle (x,y,z) position |
None
|
orientations
|
n - array
|
(n, 4) per-particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
set_particles_position_orientation(positions=None, orientations=None)
Sets all particles' positions and orientations that belong to this system in the world frame
Note: This is more optimized than doing a for loop with self.set_particle_position_orientation()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions
|
n - array
|
(n, 3) per-particle (x,y,z) position |
None
|
orientations
|
n - array
|
(n, 4) per-particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
PhysicalParticleSystem
Bases: BaseSystem
System whose generated particles are subject to physics
Source code in omnigibson/systems/system_base.py
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 |
|
particle_contact_radius
property
Returns:
Type | Description |
---|---|
float
|
Contact radius for the particles to be generated, for the purpose of estimating contacts |
particle_density
property
Returns:
Type | Description |
---|---|
float
|
The per-particle density, in kg / m^3 |
particle_particle_rest_distance
property
Returns:
Type | Description |
---|---|
The minimum distance between individual particles at rest |
particle_radius
property
Returns:
Type | Description |
---|---|
float
|
Radius for the particles to be generated, for the purpose of sampling |
check_in_contact(positions)
Checks whether each particle specified by @particle_positions are in contact with any rigid body.
NOTE: This is a rough proxy for contact, given @positions. Should not be taken as ground truth. This is because for efficiency and underlying physics reasons, it's easier to treat particles as spheres for fast checking. For particles directly spawned from Omniverse's underlying ParticleSystem API, it is a rough proxy semantically, though it is accurate in sim-physics since all spawned particles interact as spheres. For particles spawned manually as rigid bodies, it is a rough proxy both semantically and physically, as the object physically interacts with its non-uniform geometry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions
|
tensor
|
(n_particles, 3) shaped array specifying per-particle (x,y,z) positions |
required |
Returns:
Type | Description |
---|---|
n - array
|
(n_particles,) boolean array, True if in contact, otherwise False |
Source code in omnigibson/systems/system_base.py
generate_particles_from_link(obj, link, use_visual_meshes=True, mesh_name_prefixes=None, check_contact=True, sampling_distance=None, max_samples=None, **kwargs)
Generates a new particle instancer with unique identification number @idn, with particles sampled from the mesh located at @mesh_prim_path, and registers it internally. This will also check for collision with other rigid objects before spawning in individual particles
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
EntityPrim
|
Object whose @link's visual meshes will be converted into sampled particles |
required |
link
|
RigidPrim
|
@obj's link whose visual meshes will be converted into sampled particles |
required |
use_visual_meshes
|
bool
|
Whether to use visual meshes of the link to generate particles |
True
|
mesh_name_prefixes
|
None or str
|
If specified, specifies the substring that must exist in @link's mesh names in order for that mesh to be included in the particle generator function. If None, no filtering will be used. |
None
|
check_contact
|
bool
|
If True, will only spawn in particles that do not collide with other rigid bodies |
True
|
sampling_distance
|
None or float
|
If specified, sets the distance between sampled particles. If None, a simulator autocomputed value will be used |
None
|
max_samples
|
None or int
|
If specified, maximum number of particles to sample |
None
|
**kwargs
|
dict
|
Any additional keyword-mapped arguments required by subclass implementation |
{}
|
Source code in omnigibson/systems/system_base.py
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 |
|
generate_particles_on_object(obj, sampling_distance=None, max_samples=None, min_samples_for_success=1, **kwargs)
Generates @n_particles new particle objects and samples their locations on the top surface of object @obj
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
BaseObject
|
Object on which to generate a particle instancer with sampled particles on the object's top surface |
required |
sampling_distance
|
None or float
|
If specified, sets the distance between sampled particles. If None, a simulator autocomputed value will be used |
None
|
max_samples
|
None or int
|
If specified, maximum number of particles to sample |
None
|
min_samples_for_success
|
int
|
Minimum number of particles required to be sampled successfully in order for this generation process to be considered successful |
1
|
**kwargs
|
dict
|
Any additional keyword-mapped arguments required by subclass implementation |
{}
|
Returns:
Type | Description |
---|---|
bool
|
True if enough particles were generated successfully (number of successfully sampled points >= min_samples_for_success), otherwise False |
Source code in omnigibson/systems/system_base.py
VisualParticleSystem
Bases: BaseSystem
Particle system class for generating particles not subject to physics, and are attached to individual objects
Source code in omnigibson/systems/system_base.py
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 |
|
groups
property
Returns:
Type | Description |
---|---|
set of str
|
Current attachment particle group names |
particle_object
property
Returns:
Type | Description |
---|---|
XFormPrim
|
Particle object to be used as a template for duplication |
scale_relative_to_parent
property
Returns:
Type | Description |
---|---|
bool
|
Whether or not particles should be scaled relative to the group's parent object. NOTE: If True, this will OVERRIDE self.min_scale and self.max_scale when sampling particles! |
create_attachment_group(obj)
Creates an attachment group internally for object @obj. Note that this does NOT automatically generate particles for this object (should call generate_group_particles(...) ).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
BaseObject
|
Object for which a new particle attachment group will be created for |
required |
Returns:
Type | Description |
---|---|
str
|
Name of the attachment group to use when executing commands from this class on that specific attachment group |
Source code in omnigibson/systems/system_base.py
generate_group_particles(group, positions, orientations=None, scales=None, link_prim_paths=None)
Generates new particle objects within group @group at the specified pose (@positions, @orientations) with corresponding scales @scales.
Assumes positions are the exact contact point on @group object's surface. If self._CLIP_INTO_OBJECTS
is not True, then the positions will be offset away from the object by half of its bbox
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Object on which to sample particle locations |
required |
positions
|
tensor
|
(n_particles, 3) shaped array specifying per-particle (x,y,z) positions |
required |
orientations
|
None or tensor
|
(n_particles, 4) shaped array specifying per-particle (x,y,z,w) quaternion orientations. If not specified, all will be set to canonical orientation (0, 0, 0, 1) |
None
|
scales
|
None or tensor
|
(n_particles, 3) shaped array specifying per-particle (x,y,z) scaling in its local frame. If not specified, all we randomly sampled based on @self.min_scale and @self.max_scale |
None
|
link_prim_paths
|
None or list of str
|
Determines which link each generated particle will be attached to. If not specified, all will be attached to the group object's prim, NOT a link |
None
|
Source code in omnigibson/systems/system_base.py
generate_group_particles_on_object(group, max_samples=None, min_samples_for_success=1)
Generates @max_samples new particle objects and samples their locations on the surface of object @obj. Note that if any particles are in the group already, they will be removed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Object on which to sample particle locations |
required |
max_samples
|
None or int
|
If specified, maximum number of particles to sample |
None
|
min_samples_for_success
|
int
|
Minimum number of particles required to be sampled successfully in order for this generation process to be considered successful |
1
|
Returns:
Type | Description |
---|---|
bool
|
True if enough particles were generated successfully (number of successfully sampled points >= min_samples_for_success), otherwise False |
Source code in omnigibson/systems/system_base.py
get_group_name(obj)
classmethod
Grabs the corresponding group name for object @obj
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
BaseObject
|
Object for which its procedurally generated particle attachment name should be grabbed |
required |
Returns:
Type | Description |
---|---|
str
|
Name of the attachment group to use when executing commands from this class on that specific attachment group |
Source code in omnigibson/systems/system_base.py
get_group_particles_local_pose(group)
Computes all particles' positions and orientations that belong to @group in the particles' parent frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Group name whose particle positions and orientations should be computed |
required |
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
get_group_particles_position_orientation(group)
Computes all particles' positions and orientations that belong to @group
Note: This is more optimized than doing a for loop with self.get_particle_position_orientation()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Group name whose particle positions and orientations should be computed |
required |
Returns:
Type | Description |
---|---|
2 - tuple
|
|
Source code in omnigibson/systems/system_base.py
num_group_particles(group)
Gets the number of particles for the given group in the simulator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Name of the attachment group to remove all particles from. |
required |
Returns:
Type | Description |
---|---|
int
|
Number of particles allocated to this group in the scene. Note that if @group does not exist, this will return 0 |
Source code in omnigibson/systems/system_base.py
remove_all_group_particles(group)
Remove particle with name @name from both the simulator as well as internally
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Name of the attachment group to remove all particles from |
required |
Source code in omnigibson/systems/system_base.py
remove_attachment_group(group)
Removes an attachment group internally for object @obj. Note that this will automatically remove any particles currently assigned to that group
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Name of the attachment group to remove |
required |
Returns:
Type | Description |
---|---|
str
|
Name of the attachment group to use when executing commands from this class on that specific attachment group |
Source code in omnigibson/systems/system_base.py
sample_scales_by_group(group, n)
Samples @n particle scales for group @group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Specific group for which to sample scales |
required |
n
|
int
|
Number of scales to sample |
required |
Returns:
Type | Description |
---|---|
n, 3) array
|
Array of sampled scales |
Source code in omnigibson/systems/system_base.py
set_group_particles_local_pose(group, positions=None, orientations=None)
Sets all particles' positions and orientations that belong to @group in the particles' parent frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Group name whose particle positions and orientations should be computed |
required |
positions
|
n - array
|
(n, 3) per-particle (x,y,z) position |
None
|
orientations
|
n - array
|
(n, 4) per-particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
set_group_particles_position_orientation(group, positions=None, orientations=None)
Sets all particles' positions and orientations that belong to @group
Note: This is more optimized than doing a for loop with self.set_particle_position_orientation()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group
|
str
|
Group name whose particle positions and orientations should be computed |
required |
positions
|
n - array
|
(n, 3) per-particle (x,y,z) position |
None
|
orientations
|
n - array
|
(n, 4) per-particle (x,y,z,w) quaternion orientation |
None
|
Source code in omnigibson/systems/system_base.py
create_system_from_metadata(system_name)
Internal helper function to programmatically create a system from dataset metadata. Args: system_name (str): Name of the system to create, e.g.: "water", "stain", etc.
Returns:
Type | Description |
---|---|
BaseSystem
|
Created system class |
Source code in omnigibson/systems/system_base.py
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
|
get_all_system_names()
cached
Gets all available systems from the OmniGibson dataset
Returns:
Type | Description |
---|---|
set
|
Set of all available system names that can be created in OmniGibson |