robot_msgs

Detection3DArray

The detections of one frame; header is the sensor frame's header.

Import
from robot_msgs.vision import Detection3DArray
ROS 2vision_msgs/msg/Detection3DArray

Preview

The figure robot_msgs.viz.plot(example) draws for the example below.

Plot of an example Detection3DArray

Fields

NameTypeDefault
headerHeaderHeader()
detectionstuple[Detection3D, ...]()

Example

One instance from the package's own test catalog; the output is its real repr().

Detection3DArray(header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'), detections=(Detection3D(header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'), results=(ObjectHypothesisWithPose(hypothesis=ObjectHypothesis(class_id='bottle', score=0.91), pose=Pose(position=Point(x=0.4, y=-0.1, z=0.25), orientation=Quaternion(x=-0.10566871683993562, y=0.6991667342497077, z=0.10566871683993563, w=0.6991667342497078))),), bbox=BoundingBox3D(center=Pose(position=Point(x=0.4, y=-0.1, z=0.25), orientation=Quaternion(x=-0.10566871683993562, y=0.6991667342497077, z=0.10566871683993563, w=0.6991667342497078)), size=Vector3(x=0.07, y=0.07, z=0.25)), id='7'),))
to_dict() as JSON
{
  "_type": "vision/Detection3DArray",
  "header": {
    "_type": "std/Header",
    "stamp": 1761600000.25,
    "frame_id": "camera_color_optical_frame",
    "meta": {}
  },
  "detections": [
    {
      "_type": "vision/Detection3D",
      "header": {
        "_type": "std/Header",
        "stamp": 1761600000.25,
        "frame_id": "camera_color_optical_frame",
        "meta": {}
      },
      "results": [
        {
          "_type": "vision/ObjectHypothesisWithPose",
          "hypothesis": {
            "_type": "vision/ObjectHypothesis",
            "class_id": "bottle",
            "score": 0.91
          },
          "pose": {
            "_type": "geometry/Pose",
            "position": {
              "_type": "geometry/Point",
              "x": 0.4,
              "y": -0.1,
              "z": 0.25
            },
            "orientation": {
              "_type": "geometry/Quaternion",
              "x": -0.10566871683993562,
              "y": 0.6991667342497077,
              "z": 0.10566871683993563,
              "w": 0.6991667342497078
            }
          },
          "covariance": null
        }
      ],
      "bbox": {
        "_type": "vision/BoundingBox3D",
        "center": {
          "_type": "geometry/Pose",
          "position": {
            "_type": "geometry/Point",
            "x": 0.4,
            "y": -0.1,
            "z": 0.25
          },
          "orientation": {
            "_type": "geometry/Quaternion",
            "x": -0.10566871683993562,
            "y": 0.6991667342497077,
            "z": 0.10566871683993563,
            "w": 0.6991667342497078
          }
        },
        "size": {
          "_type": "geometry/Vector3",
          "x": 0.07,
          "y": 0.07,
          "z": 0.25
        }
      },
      "id": "7"
    }
  ]
}

Long arrays are cut after 16 values and say so with “…”.

Functions

Constructors

Classmethods and staticmethods: ways to build one.

from_dict

from Msg
from_dict(data: Mapping[str, Any]) -> M

No docstring.

Methods

Return new values; messages are never mutated.

as_arrays() -> dict[str, Array]

The batch view: centers (N, 3), sizes (N, 3), scores (N,), class_ids (N,).

filtered(
    min_score: float | None = None,
    class_ids: Iterable[str] | None = None,
) -> Detection3DArray

Detections whose best score is at least min_score and whose class is in class_ids.

nms(iou_threshold: float) -> Detection3DArray

Non-maximum suppression, class-agnostic: highest scores win, overlaps above

replace

from Msg
replace(**changes: Any) -> M

A copy with some fields changed. Validation runs again.

to_dict

from Msg
to_dict() -> dict[str, Any]

JSON-safe dict with a "_type" key; arrays keep their dtype and shape.

Operators

Python operators and protocols the type supports.

__getitem__(index: int | slice) -> Detection3D | Detection3DArray

No docstring.

__iter__() -> Iterator[Detection3D]

No docstring.

__len__() -> int

No docstring.

Uses

Types its fields refer to.

Header Detection3D

robot_msgs 0.1.0 @ 2dc6666GitHub · MIT license · generated from the package, not written per type