# MessageGroup

The MessageGroup message type is a versatile container used in DepthAI pipelines to group together a map of arbitrary DepthAI
messages. It serves as the primary output of the [Sync](https://docs.luxonis.com/software/depthai-components/nodes/sync.md) node,
effectively synchronizing various input streams, and acts as the input to the
[MessageDemux](https://docs.luxonis.com/software/depthai-components/nodes/message_demux.md) node for subsequent disaggregation and
processing.

## Creating MessageGroup

MessageGroup can be created automatically by the Sync node as it aligns and groups messages from different sources based on their
timestamps. Alternatively, it can be manually constructed in a host application or within a
[Script](https://docs.luxonis.com/software/depthai-components/nodes/script.md) node to create custom groupings of DepthAI
messages.

## Reference

### 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()

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
