adjacency
HorizontalAdjacency
Bases: AbsoluteObjectState
State representing the object's horizontal adjacencies in a preset number of directions.
The HorizontalAdjacency state returns adjacency lists for equally spaced coordinate planes. Each plane consists of 2 orthogonal axes, and adjacencies are checked for both the positive and negative directions of each axis.
The value of the state is List[List[AxisAdjacencyList]], where the list dimensions are m.HORIZONTAL_AXIS_COUNT and 2. The first index is used to choose between the different planes, the second index to choose between the orthogonal axes of that plane. Given a plane/axis combo, the item in the list is a AxisAdjacencyList containing adjacencies in both directions of the axis.
If the idea of orthogonal bases is not relevant (and your use case simply requires checking adjacencies in each direction), the flatten_planes() function can be used on the state value to reduce the output to List[AxisAdjacencyList], a list of adjacency lists for all 2 * m.HORIZONTAL_AXIS_COUNT directions.
Source code in omnigibson/object_states/adjacency.py
VerticalAdjacency
Bases: AbsoluteObjectState
State representing the object's vertical adjacencies. Value is a AxisAdjacencyList object.
Source code in omnigibson/object_states/adjacency.py
compute_adjacencies(obj, axes, max_distance, use_aabb_center=True)
Given an object and a list of axes, find the adjacent objects in the axes' positive and negative directions.
If @obj is of PrimType.CLOTH, then adjacent objects are found with respect to the @obj's centroid particle position
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
StatefulObject
|
The object to check adjacencies of. |
required |
axes
|
2D-array
|
(n_axes, 3) array defining the axes to check in. Note that each axis will be checked in both its positive and negative direction. |
required |
use_aabb_center
|
bool
|
If True and @obj is not of PrimType.CLOTH, will shoot rays from @obj's aabb center. Otherwise, will dynamically compute starting points based on the requested @axes |
True
|
Returns:
Type | Description |
---|---|
list of AxisAdjacencyList
|
List of length len(axes) containing the adjacencies. |
Source code in omnigibson/object_states/adjacency.py
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 |
|
get_equidistant_coordinate_planes(n_planes)
Given a number, sample that many equally spaced coordinate planes.
The samples will cover all 360 degrees (although rotational symmetry is assumed, e.g. if you take into account the axis index and the positive/negative directions, only 1/4 of the possible coordinate (1 quadrant, math.pi / 2.0) planes will be sampled: the ones where the first axis' positive direction is in the first quadrant).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_planes
|
int
|
number of planes to sample |
required |
Returns:
Type | Description |
---|---|
3D-array
|
(n_planes, 2, 3) array where the first dimension is the sampled plane index, the second dimension is the axis index (0/1), and the third dimension is the 3-D world-coordinate vector corresponding to the axis. |