# MessageGroup

MessageGroup 消息类型是一种通用容器，用于在 DepthAI 流水线中将一组任意的 DepthAI 消息组合在一起。它作为
[Sync](https://docs.luxonis.com/software/depthai-components/nodes/sync.md) 节点的主要输出，有效地同步各种输入流，并作为
[MessageDemux](https://docs.luxonis.com/software/depthai-components/nodes/message_demux.md) 节点的输入，用于后续的解聚合和处理。

## 创建 MessageGroup

MessageGroup 可以由 Sync 节点自动创建，因为它根据时间戳对齐并组合来自不同源的消息。或者，也可以在主机应用程序或
[Script](https://docs.luxonis.com/software/depthai-components/nodes/script.md) 节点中手动构建，以创建自定义的 DepthAI 消息分组。

## 参考

### depthai.MessageGroup(depthai.Buffer)

Kind: Class

MessageGroup message. Carries multiple messages in one.

#### __getitem__(self, arg0: str) -> ADatatype: ADatatype

Kind: Method

#### __init__(self)

Kind: Method

#### __iter__(self) -> collections.abc.Iterator[tuple[str, ADatatype]]: collections.abc.Iterator[tuple[str, ADatatype]]

Kind: Method

#### __setitem__(self, arg0: str, arg1: ADatatype)

Kind: Method

#### getIntervalNs(self) -> int: int

Kind: Method

Retrieves interval between the first and the last message in the group.

#### getMessageNames(self) -> list[str]: list[str]

Kind: Method

Gets the names of messages in the group

#### getNumMessages(self) -> int: int

Kind: Method

#### getSequenceNum(self) -> int: int

Kind: Method

Retrieves sequence number

#### getTimestamp(self) -> datetime.timedelta: datetime.timedelta

Kind: Method

Retrieves timestamp related to dai::Clock::now()

#### getTimestampDevice(self) -> datetime.timedelta: datetime.timedelta

Kind: Method

Retrieves timestamp directly captured from device's monotonic clock, not
synchronized to host time. Used mostly for debugging

#### isSynced(self, arg0: typing.SupportsInt) -> bool: bool

Kind: Method

True if all messages in the group are in the interval

Parameter ``thresholdNs``:
Maximal interval between messages

#### setSequenceNum(self, arg0: typing.SupportsInt) -> MessageGroup: MessageGroup

Kind: Method

Retrieves image sequence number

#### setTimestamp(self, arg0: datetime.timedelta) -> MessageGroup: MessageGroup

Kind: Method

Sets image timestamp related to dai::Clock::now()

#### setTimestampDevice(self, arg0: datetime.timedelta) -> MessageGroup: MessageGroup

Kind: Method

Sets image timestamp related to dai::Clock::now()

### 需要帮助？

请前往 [OAKChina 官网](https://www.oakchina.cn/) 获取技术支持或解答您的任何疑问。
