robot_msgs

Detection2D

results are the class hypotheses for the box; id tracks the object across frames.

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

Preview

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

Plot of an example Detection2D

Fields

NameTypeDefault
headerHeaderHeader()
resultstuple[ObjectHypothesisWithPose, ...]()
bboxBoundingBox2Drequired
idstr''

Example

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

Detection2D(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=BoundingBox2D(center=Pose2D(x=60.0, y=120.0, theta=0.0), size_x=100.0, size_y=200.0), id='7')
to_dict() as JSON
{
  "_type": "vision/Detection2D",
  "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/BoundingBox2D",
    "center": {
      "_type": "geometry/Pose2D",
      "x": 60.0,
      "y": 120.0,
      "theta": 0.0
    },
    "size_x": 100.0,
    "size_y": 200.0
  },
  "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.

Properties

Read-only views computed from the fields.

best: ObjectHypothesisWithPose | None

The highest-scoring hypothesis (first one wins a tie), or None without results.

class_id: str

Class of the best hypothesis, "" without results.

score: float

Score of the best hypothesis, 0.0 without results.

Methods

Return new values; messages are never mutated.

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.

Uses

Types its fields refer to.

Header BoundingBox2D ObjectHypothesisWithPose

Used by

Types whose fields refer to it.

Detection2DArray

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