> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PointCloud

> A class to represent a point cloud

```python theme={null}
from grid_types import PointCloud
```

A class to represent a point cloud.

## Fields

<ResponseField name="points" type="np.ndarray">
  Array of points with shape (N, D) where N is the number of points and D is the dimensionality of each point (e.g., D=3 for x,y,z). Each row is a point, and each column is a dimension/feature.
</ResponseField>

<ResponseField name="fields" type="List[str]">
  List of field names for the point cloud data. The order of field names must correspond to the columns in the points array. If not provided, defaults to \['x', 'y'] for 2D points (N,2) or \['x', 'y', 'z'] for 3D points (N,3). For other dimensions, fields must be explicitly provided.
</ResponseField>

<ResponseField name="source_timestamp_ns">
  Timestamp from the sensor or transport message, in nanoseconds in `source_clock`. This is provenance, not necessarily comparable to the local system clock.
</ResponseField>

<ResponseField name="received_timestamp_ns">
  Unix timestamp in nanoseconds recorded when this process received the complete transport message.
</ResponseField>

<ResponseField name="received_monotonic_ns">
  Monotonic timestamp in nanoseconds recorded at the same receipt event. It is comparable only when `monotonic_clock_id` matches the consumer's clock domain.
</ResponseField>

<ResponseField name="monotonic_clock_id">
  Stable identifier for the monotonic clock domain, normally the Linux boot ID. A proxy crossing machines must restamp the receipt or leave this metadata absent.
</ResponseField>

<ResponseField name="sequence_id">
  Receiver-local message identity. Drivers that provide this increment it once for every newly received message, so repeated reads of the same cloud retain the same value.
</ResponseField>

<ResponseField name="frame_id">
  Coordinate frame containing `points`.
</ResponseField>

<ResponseField name="acquisition_duration_s">
  Non-negative upper bound, in seconds, on the time spanned by the points in this cloud.
</ResponseField>

<ResponseField name="source_clock">
  Name of the `source_timestamp_ns` clock domain, such as `"ros"` or `"device"`.
</ResponseField>

## Constructor

```python Signature theme={null}
PointCloud(
    points: np.ndarray,
    fields: Optional[List[str]] = None,
    source_timestamp_ns: Optional[int] = None,
    received_timestamp_ns: Optional[int] = None,
    received_monotonic_ns: Optional[int] = None,
    monotonic_clock_id: Optional[str] = None,
    sequence_id: Optional[int] = None,
    frame_id: Optional[str] = None,
    acquisition_duration_s: Optional[float] = None,
    source_clock: Optional[str] = None,
)
```

## Methods

### `from_dict()`

```python Signature theme={null}
from_dict(data: dict) -> PointCloud
```

Deserialize from dictionary

### `to_dict()`

```python Signature theme={null}
to_dict() -> dict
```

Serialize to dictionary for JSON transfer

## Example

```python theme={null}
import numpy as np
# 3D points with x, y, z
points_data_3d = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
pc1 = PointCloud(points=points_data_3d)
print(pc1.points)
print(pc1.fields)
# 2D points with x, y
points_data_2d = np.array([[1, 2], [3, 4]], dtype=np.float32)
pc2 = PointCloud(points=points_data_2d)
print(pc2.fields)
# 3D points with custom fields (e.g., x, y, intensity)
points_data_custom = np.array([[10, 20, 100], [30, 40, 150]], dtype=np.float32)
pc3 = PointCloud(points=points_data_custom, fields=['x', 'y', 'intensity'])
print(pc3.fields)
# Points with x, y, z, r, g, b
points_rgb = np.array([[1,2,3, 255,0,0], [4,5,6, 0,255,0]], dtype=np.float32)
fields_rgb = ['x', 'y', 'z', 'r', 'g', 'b']
pc4 = PointCloud(points=points_rgb, fields=fields_rgb)
print(pc4.points.shape)
print(pc4.fields)
```


## Related topics

- [AirGenCar](/v2.4/python-api/airgen-robots/airgencar.md)
- [AirGenDrone](/v2.4/python-api/airgen-robots/airgendrone.md)
- [AirGenQuad](/v2.4/python-api/airgen-robots/airgenquad.md)
- [IsaacArm](/v2.4/python-api/isaac-robots/isaacarm.md)
- [IsaacBimanual](/v2.4/python-api/isaac-robots/isaacbimanual.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.