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)
Given an object and a list of axes, find the adjacent objects in the axes' positive and negative directions.
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 |
Returns:
Type | Description |
---|---|
list of AxisAdjacencyList: List of length len(axes) containing the adjacencies. |
Source code in omnigibson/object_states/adjacency.py
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, np.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. |