robot_msgs

BoundingBox2D

center is the box centre in pixels with rotation center.theta; sizes are in pixels.

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

Preview

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

Plot of an example BoundingBox2D

Fields

NameTypeDefault
centerPose2Drequired
size_xfloatrequired
size_yfloatrequired

Example

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

BoundingBox2D(center=Pose2D(x=60.0, y=120.0, theta=0.0), size_x=100.0, size_y=200.0)
to_dict() as JSON
{
  "_type": "vision/BoundingBox2D",
  "center": {
    "_type": "geometry/Pose2D",
    "x": 60.0,
    "y": 120.0,
    "theta": 0.0
  },
  "size_x": 100.0,
  "size_y": 200.0
}

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

Functions

Constructors

Classmethods and staticmethods: ways to build one.

from_xyxy(x0: float, y0: float, x1: float, y1: float) -> BoundingBox2D

Axis-aligned box from its top-left (x0, y0) and bottom-right (x1, y1) corners.

from_dict

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

No docstring.

Properties

Read-only views computed from the fields.

area: float

No docstring.

Methods

Return new values; messages are never mutated.

contains(x: float, y: float) -> bool

Whether pixel (x, y) is inside the box (edges included), honouring center.theta.

iou(other: BoundingBox2D) -> float

Intersection over union of two axis-aligned boxes (0.0 when both are empty).

to_xyxy() -> tuple[float, float, float, float]

No docstring.

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.

Pose2D

Used by

Types whose fields refer to it.

Detection2D

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