data_utils
merge_scene_files(scene_a, scene_b, keep_robot_from='b')
Merge two scene files, keeping the robot from the specified scene and merging all other objects.
Design decisions: - Scene B is considered the most up-to-date version and its data is preferred when there are conflicts - For objects that exist in both scenes, we perform sanity checks on objects_info but always use Scene B's version - For states of objects that exist in both scenes, we always use Scene B's version without sanity checking - For system registry, we always use Scene B's version (no merging)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene_a
|
dict
|
First scene file |
required |
scene_b
|
dict
|
Second scene file (considered the most up-to-date version for conflicts) |
required |
keep_robot_from
|
str or None
|
Which scene to keep the robot from ('a', 'b', or None) If None, no robot will be included |
'b'
|
Returns:
| Type | Description |
|---|---|
dict
|
Merged scene file |
Source code in OmniGibson/omnigibson/utils/data_utils.py
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 | |
sanity_check_object_compatibility(obj_name, obj_a, obj_b)
Sanity check if two object definitions are compatible. This is only applied to objects_info, not to states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj_name
|
str
|
Name of the object |
required |
obj_a
|
dict
|
Object definition from scene_a |
required |
obj_b
|
dict
|
Object definition from scene_b |
required |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If objects are incompatible |
Source code in OmniGibson/omnigibson/utils/data_utils.py
validate_merged_scene(scene, require_robot=True)
Validate that the merged scene is coherent and complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene
|
dict
|
Scene to validate |
required |
require_robot
|
bool
|
Whether to require exactly one robot |
True
|