Message types¶
Every data port of a node carries one ROS 2 message type, named in the schema's rosType field. This page tells you how to spell that name, which message packages the SDK base image ships, how each family of types is read with get_data() and built for publish(), and which types the UI can visualize. Use it as the reference when you fill in the inputs and outputs of a schema file (see Schema file reference).
How rosType is spelled¶
The SDK turns the rosType string into a Python class at configure time. It strips a leading slash, splits on /, and imports <pkg>.msg.<Type>. Three spellings are accepted:
| Spelling | Example | Accepted | Use it? |
|---|---|---|---|
pkg/msg/Type |
std_msgs/msg/Float32 |
yes | Yes. This is the canonical three-part name. Every table on this page uses it. |
pkg/Type |
std_msgs/Float32 |
yes | Legacy. Works for the dataflow, but the visualization picker's exclusion list only matches the three-part form (see below). |
/pkg/msg/Type |
/std_msgs/msg/Float32 |
yes | Legacy. The leading slash is tolerated and removed. |
| anything else | std_msgs::Float32, Float32 |
no | Configure fails with DataFlowException: Invalid message type format. |
Write data ports in the convention (lowercase snake_case keys, edgeType 1):
"inputs": {
"camera_feed": { "rosType": "sensor_msgs/msg/CompressedImage", "edgeType": 1 }
},
"outputs": {
"mask": { "rosType": "sensor_msgs/msg/CompressedImage", "edgeType": 1 }
}
The port key is what your code passes to get_data("camera_feed") and publish("mask", ...). The rosType decides which class those calls exchange. The full key convention (including trigger ports) is in The port-key convention.
Prefer pkg/msg/Type
The dataflow accepts sensor_msgs/PointCloud2, but the list of output types that are excluded from the visualization picker is compared against the three-part form, so a two-part spelling puts a point cloud into the picker anyway. Spell every data port pkg/msg/Type.
The Python import that matches a rosType is always from <pkg>.msg import <Type>:
from sensor_msgs.msg import CompressedImage # rosType sensor_msgs/msg/CompressedImage
from neura_grasp_planning_msgs.msg import PickPose # rosType neura_grasp_planning_msgs/msg/PickPose
Reading and publishing¶
The rules below hold for every type on this page. The mechanics of the dataflow are explained in Dataflow; this is the summary you need while looking up a type.
| Call | Behaviour |
|---|---|
msg = self.get_data("port") |
Returns the last message received on that input as a deserialized ROS 2 object, or None when the port is not connected or nothing has arrived yet (on a connected port the call waits up to one second first). There is no timeout parameter. The value is latched: a second call returns the same message until a new one arrives. |
self.publish("port", msg) |
msg must be a ROS 2 message object of the port's rosType. A bare str, float, dict or NumPy array is not a message: the ROS transport raises and the MQTT transport logs an error and drops it, so nothing reaches the next node. |
self.publish("unknown", msg) |
A key that is not an output in the schema raises DataFlowException: Unknown output target. |
self.wait_for_message(...) |
Not implemented by any production transport (raises NotImplementedError). Do not use it; read with get_data() inside on_execute() instead. |
Always check for None before touching fields, and always build a message object before publishing:
def on_execute(self, trigger_context: Optional[TriggerContext] = None) -> None:
"""Runs every time the node is triggered."""
msg = self.get_data("text_input")
if msg is None:
self.log_warning("No message on text_input yet, nothing to publish")
return
result = String(data=msg.data.upper())
self.publish("text_output", result)
self.log_info(f"Published: {result.data}")
Mock Runner
The Mock Runner can inject values by hand into only 11 input types (the std_msgs scalars and arrays plus sensor_msgs/msg/Image). Every other type on this page has to be produced by an upstream node on the canvas. See the list at Injectable input types.
Which message packages the base image ships¶
Your node image is built FROM the SDK base image, which starts from ros:humble and adds the packages below. A rosType only works if its package is installed in both the publishing and the subscribing node image, because each side imports the class from its own rosType.
| Package | Where it comes from | Types on this page |
|---|---|---|
std_msgs, geometry_msgs, sensor_msgs |
installed by the SDK base image | scalars, arrays, poses, images, point clouds, joint states |
vision_msgs (4.1.1) |
installed by the SDK base image | BoundingBox2D, Pose2D, Point2D |
audio_common_msgs |
installed by the SDK base image | AudioData |
nav_msgs, trajectory_msgs, tf2_msgs, visualization_msgs, shape_msgs, diagnostic_msgs, stereo_msgs |
part of the ros:humble base |
OccupancyGrid, JointTrajectory, TFMessage |
pose_estimation_ros_msgs 2.2.0 |
vendored Neura package | ObjectPoseWithCovariance, ObjectPoseWithCovarianceArray |
neura_grasp_planning_msgs 1.2.0 |
vendored Neura package | PickPose, PickPoses, ObjectPickPosesArray |
instance_segmentation_ros_msgs 2.5.0 |
vendored Neura package | SegmentationResult, MaskWithObjectName, SegmentedInstanceArray |
neura_common_msgs 0.2.3, neura_ai_database_msgs 0.3.0 |
vendored Neura packages | BoundingBox (used inside SegmentedInstance) |
neura_ai_stack_msg 1.0.0-dev.27 |
vendored Neura package | Detection, DetectionArray, Grasp, GraspArray, GraspPose, GraspPoses, ObjectGraspPosesArray, ObjectPickPosesArray, Pick, PickArray, PickPose, PickPoses, RgbdFrame, Workspace, action GenerateGrasps |
The image also ships cv_bridge and OpenCV for converting between sensor_msgs images and NumPy arrays.
Since SDK 2.52.0
The base image ships neura_ai_stack_msg for amd64 and arm64. PickPose, PickPoses, GraspPose, GraspPoses, ObjectPickPosesArray and the GenerateGrasps action also exist in neura_grasp_planning_msgs, and Workspace in neura_ai_database_msgs. They are different types, even where the fields match, and an edge only connects two ports with the same rosType. Always write the full rosType, for example neura_ai_stack_msg/msg/PickPose, and import from the package you mean.
pose_estimation_ros_msgs is amd64 only
The vendored pose_estimation_ros_msgs package has no arm64 build. On an arm64 engine the two pose-estimation types below are not importable, and a node that declares them fails to configure there.
To add a package that is not in the table, install it in your node's Dockerfile after the FROM line. The node template shows the pattern with a ROS package from apt:
FROM ${BASE_IMAGE}
RUN apt-get update && apt-get install -y ros-humble-vision-msgs
For a custom package, COPY its .deb into the image and dpkg -i it, or build it from source in the same RUN step. Then declare it in the schema like any other rosType and remember that the node on the other end of the edge needs the same package.
Visualization in the UI¶
When a data visualization session is open on your node, every publish() on an output port is streamed to the UI without extra code. How it is rendered depends on the port's rosType:
Output rosType |
Streamed to the UI as |
|---|---|
sensor_msgs/msg/CompressedImage |
video track (frames as published) |
sensor_msgs/msg/Image |
video track (frames as published) |
instance_segmentation_ros_msgs/msg/SegmentationResult |
video track (rendered image: greyscale map, masks/boxes over the source image) |
instance_segmentation_ros_msgs/msg/SegmentedInstanceArray |
video track (rendered image: greyscale map, masks/boxes over the source image) |
nav_msgs/msg/OccupancyGrid |
video track (rendered image: greyscale map, masks/boxes over the source image) |
audio_common_msgs/msg/AudioData |
video track (live waveform) |
audio_msgs/msg/AudioData |
video track (live waveform) |
| any other message type | JSON on the data channel (throttled) |
Some output types are excluded from the visualization picker because they would be oversized or meaningless as a stream:
| Not visualized (no stream is created for these output types) |
|---|
sensor_msgs/msg/CameraInfo |
sensor_msgs/msg/Imu |
sensor_msgs/msg/LaserScan |
sensor_msgs/msg/MagneticField |
sensor_msgs/msg/NavSatFix |
sensor_msgs/msg/PointCloud2 |
tf2_msgs/msg/TFMessage |
The tables below mark each type with the rendering it gets. Details, extra topics and segmentation backgrounds are in Data visualization.
Standard messages (std_msgs)¶
Wrapper types around a single data field. All of them are visualized as JSON.
Scalars¶
| rosType | .data type |
Notes |
|---|---|---|
std_msgs/msg/String |
str |
Text |
std_msgs/msg/Bool |
bool |
Flag |
std_msgs/msg/Float32 |
float |
32-bit float |
std_msgs/msg/Float64 |
float |
64-bit float |
std_msgs/msg/Int32 |
int |
32-bit signed integer |
std_msgs/msg/Int64 |
int |
64-bit signed integer |
std_msgs/msg/UInt8, UInt16, UInt32, UInt64, Int8, Int16 |
int |
Other integer widths, same shape |
Reading two Float32 inputs and publishing one, from the math tutorial:
def on_execute(self, trigger_context: Optional[TriggerContext] = None) -> None:
try:
# get_data() returns the last message received on the port, or None
# when nothing has arrived yet (or the port is not connected).
msg_a = self.get_data("a")
msg_b = self.get_data("b")
if msg_a is None:
self.log_warning("No message on input 'a' yet, skipping this run")
return
if msg_b is None:
self.log_warning("No message on input 'b' yet, skipping this run")
return
total = float(msg_a.data) + float(msg_b.data) + self.offset
# publish() needs a ROS 2 message object, never a bare float.
self.publish("sum", Float32(data=total))
self.log_info(f"{msg_a.data} + {msg_b.data} + {self.offset} = {total}")
except Exception as exc:
raise NodeExecutionError(f"MathAddNode failed: {exc}") from exc
Arrays¶
| rosType | .data element type |
Notes |
|---|---|---|
std_msgs/msg/Float32MultiArray |
float |
Also carries a layout (dimensions and offset); leave it empty for flat lists |
std_msgs/msg/Float64MultiArray |
float |
|
std_msgs/msg/Int32MultiArray |
int |
|
std_msgs/msg/Int64MultiArray |
int |
from std_msgs.msg import Float32MultiArray
msg = self.get_data("weights")
if msg is not None:
values = list(msg.data) # sequence of floats
self.publish("array_output", Float32MultiArray(data=[1.0, 2.0, 3.0]))
Sensor messages (sensor_msgs)¶
| rosType | Visualized as | Use case |
|---|---|---|
sensor_msgs/msg/CompressedImage |
video | Camera feeds, processed images, PNG masks |
sensor_msgs/msg/Image |
video | Pixel-level processing, depth images |
sensor_msgs/msg/JointState |
JSON | Robot telemetry, motion feedback |
sensor_msgs/msg/CameraInfo |
not visualized | Calibration next to an image output |
sensor_msgs/msg/PointCloud2 |
not visualized | 3D scene data |
sensor_msgs/msg/LaserScan |
not visualized | 2D range scans |
sensor_msgs/msg/Imu |
not visualized | Orientation, angular velocity, acceleration |
sensor_msgs/msg/NavSatFix |
not visualized | GNSS position |
sensor_msgs/msg/MagneticField |
not visualized | Magnetometer reading |
sensor_msgs/msg/CompressedImage¶
The most common image type between nodes: JPEG or PNG bytes, small on the wire.
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp (.stamp) and frame (.frame_id) |
.format |
str |
"jpeg" or "png" |
.data |
bytes-like |
Compressed image bytes |
Decoding to a NumPy array and encoding back, from the image tutorial:
@staticmethod
def _decode(msg: CompressedImage) -> np.ndarray:
"""Turn the JPEG/PNG bytes of a CompressedImage into a BGR array."""
buffer = np.frombuffer(bytes(msg.data), dtype=np.uint8)
image = cv2.imdecode(buffer, cv2.IMREAD_COLOR)
if image is None:
raise ValueError(f"Could not decode image with format {msg.format!r}")
return image
@staticmethod
def _encode(image: np.ndarray) -> CompressedImage:
"""Encode an array as JPEG and wrap it in a CompressedImage message."""
ok, encoded = cv2.imencode(".jpg", image)
if not ok:
raise ValueError("Could not encode image as JPEG")
return CompressedImage(format="jpeg", data=encoded.tobytes())
sensor_msgs/msg/Image¶
Raw pixels. Use it only when you need direct pixel access or a specific encoding (for example depth as 16UC1).
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.height, .width |
int |
Image size in pixels |
.encoding |
str |
Pixel encoding, e.g. "rgb8", "bgr8", "mono8", "16UC1" |
.is_bigendian |
int |
Byte order flag |
.step |
int |
Row length in bytes |
.data |
bytes-like |
Raw pixel data, step * height bytes |
import numpy as np
from sensor_msgs.msg import Image
img = self.get_data("raw_image")
if img is not None and img.encoding == "bgr8":
pixels = np.frombuffer(bytes(img.data), dtype=np.uint8).reshape(img.height, img.width, 3)
gray = np.zeros((480, 640), dtype=np.uint8)
self.publish("mono_out", Image(height=480, width=640, encoding="mono8", step=640, data=gray.tobytes()))
CompressedImage or Image
Prefer CompressedImage for node-to-node transfer. Both are streamed as video in the UI, but a raw Image costs many times the bandwidth.
sensor_msgs/msg/JointState¶
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp |
.name |
list[str] |
Joint names |
.position |
list[float] |
Positions (rad or m) |
.velocity |
list[float] |
Velocities |
.effort |
list[float] |
Torques or forces |
from sensor_msgs.msg import JointState
js = self.get_data("joint_states")
if js is not None:
for name, pos in zip(js.name, js.position):
self.log_info(f"Joint {name}: {pos:.4f} rad")
self.publish("joint_cmd", JointState(name=["j1", "j2"], position=[0.0, 1.57]))
sensor_msgs/msg/CameraInfo¶
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.height, .width |
int |
Image size |
.distortion_model |
str |
e.g. "plumb_bob" |
.d |
list[float] |
Distortion parameters |
.k |
float64[9] |
3x3 intrinsic matrix, row-major |
.r |
float64[9] |
3x3 rectification matrix |
.p |
float64[12] |
3x4 projection matrix |
sensor_msgs/msg/PointCloud2¶
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.height, .width |
int |
Rows and points per row (height is 1 for unordered clouds) |
.fields |
list[PointField] |
Channel layout (x, y, z, rgb, ...) |
.point_step, .row_step |
int |
Bytes per point and per row |
.data |
bytes-like |
Serialized points |
.is_dense |
bool |
True when there are no invalid points |
sensor_msgs/msg/LaserScan, Imu, NavSatFix, MagneticField¶
Standard ROS 2 definitions; all carry a header. LaserScan holds ranges and intensities with the angle and range limits of the scan. Imu holds orientation, angular_velocity, linear_acceleration and their 3x3 covariances. NavSatFix holds latitude, longitude, altitude and status. MagneticField holds magnetic_field (Vector3) and its covariance. None of them is visualized.
Geometry messages (geometry_msgs)¶
All geometry types are visualized as JSON.
| rosType | Fields | Use case |
|---|---|---|
geometry_msgs/msg/Pose |
.position (Point: .x .y .z), .orientation (Quaternion: .x .y .z .w) |
Targets, object locations |
geometry_msgs/msg/PoseStamped |
.header, .pose |
Frame-aware target |
geometry_msgs/msg/PoseArray |
.header, .poses (list[Pose]) |
Several detections, waypoints |
geometry_msgs/msg/TransformStamped |
.header (parent frame), .child_frame_id, .transform (.translation, .rotation) |
Frame transforms |
geometry_msgs/msg/Twist |
.linear, .angular (Vector3 each) |
Velocity commands |
from geometry_msgs.msg import Point, Pose, PoseStamped, Quaternion
from std_msgs.msg import Header
target = self.get_data("target_pose")
if target is not None:
p = target.pose.position
self.log_info(f"Target: ({p.x:.3f}, {p.y:.3f}, {p.z:.3f}) in {target.header.frame_id}")
msg = PoseStamped(
header=Header(frame_id="base_link"),
pose=Pose(position=Point(x=0.5, y=0.1, z=0.3), orientation=Quaternion(w=1.0)),
)
self.publish("goal", msg)
Navigation messages (nav_msgs)¶
nav_msgs/msg/OccupancyGrid¶
A 2D grid map. Visualized as a greyscale image in the UI.
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.info |
MapMetaData |
.resolution (m per cell), .width, .height (cells), .origin (Pose of cell 0,0), .map_load_time |
.data |
list[int] |
Row-major occupancy per cell: 0 free, 100 occupied, -1 unknown |
from geometry_msgs.msg import Pose
from nav_msgs.msg import MapMetaData, OccupancyGrid
from std_msgs.msg import Header
grid = self.get_data("map_in")
if grid is not None:
occupied = sum(1 for cell in grid.data if cell == 100)
self.log_info(f"{grid.info.width}x{grid.info.height} map, {occupied} occupied cells")
info = MapMetaData(resolution=0.05, width=4, height=2, origin=Pose())
cells = [0, 100, -1, 50, 0, 0, 0, 0] # width * height entries
self.publish("map_out", OccupancyGrid(header=Header(frame_id="map"), info=info, data=cells))
Trajectory messages (trajectory_msgs)¶
Visualized as JSON.
| rosType | Fields | Use case |
|---|---|---|
trajectory_msgs/msg/JointTrajectoryPoint |
.positions, .velocities, .accelerations, .effort (list[float]), .time_from_start (Duration) |
One joint-space waypoint |
trajectory_msgs/msg/JointTrajectory |
.header, .joint_names (list[str]), .points (list[JointTrajectoryPoint]) |
Multi-point motion |
from builtin_interfaces.msg import Duration
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
point = JointTrajectoryPoint(positions=[0.0, 0.5, 1.0], time_from_start=Duration(sec=2))
msg = JointTrajectory(joint_names=["j1", "j2", "j3"], points=[point])
self.publish("trajectory", msg)
Audio messages (audio_common_msgs)¶
audio_common_msgs/msg/AudioData¶
| Field | Type | Description |
|---|---|---|
.data |
bytes-like |
Raw PCM bytes |
Visualized as a live waveform. The streamer also knows audio_msgs/msg/AudioData, but that package is not in the base image.
from audio_common_msgs.msg import AudioData
audio = self.get_data("audio_input")
if audio is not None:
self.log_info(f"Audio chunk: {len(audio.data)} bytes")
self.publish("audio_output", AudioData(data=pcm_bytes)) # pcm_bytes: bytes from your capture code
Vision messages (vision_msgs)¶
Visualized as JSON.
vision_msgs/msg/BoundingBox2D¶
A 2D box given by centre and size. In vision_msgs 4.x the centre is a vision_msgs/msg/Pose2D whose position is a Point2D; the geometry_msgs Pose2D is a different type and is not accepted here.
| Field | Type | Description |
|---|---|---|
.center |
vision_msgs/msg/Pose2D |
.position.x, .position.y, .theta |
.size_x, .size_y |
float |
Width and height in pixels |
from vision_msgs.msg import BoundingBox2D, Point2D, Pose2D
box = self.get_data("bounding_box")
if box is not None:
cx, cy = box.center.position.x, box.center.position.y
x_min, y_min = cx - box.size_x / 2.0, cy - box.size_y / 2.0
center = Pose2D(position=Point2D(x=320.0, y=240.0), theta=0.0)
self.publish("bounding_box", BoundingBox2D(center=center, size_x=100.0, size_y=80.0))
Neura message packages¶
Custom ROS 2 packages vendored into the SDK base image. They are visualized as JSON unless stated otherwise.
Pose estimation (pose_estimation_ros_msgs)¶
pose_estimation_ros_msgs/msg/ObjectPoseWithCovariance¶
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.object_class_name |
str |
Detected class |
.pose |
Pose |
6-DoF pose |
.covariance |
float64[36] |
6x6 covariance, row-major ([0], [7], [14] are the x, y, z variances) |
"inputs": {
"pose_estimate": { "rosType": "pose_estimation_ros_msgs/msg/ObjectPoseWithCovariance", "edgeType": 1 }
}
from geometry_msgs.msg import Point, Pose, Quaternion
from pose_estimation_ros_msgs.msg import ObjectPoseWithCovariance
from std_msgs.msg import Header
est = self.get_data("pose_estimate")
if est is not None:
p = est.pose.position
self.log_info(f"{est.object_class_name} at ({p.x:.3f}, {p.y:.3f}, {p.z:.3f}), var x={est.covariance[0]:.4f}")
msg = ObjectPoseWithCovariance(header=Header(frame_id="base_link"), object_class_name="mug")
msg.pose = Pose(position=Point(x=0.5, y=0.1, z=0.8), orientation=Quaternion(w=1.0))
msg.covariance = [0.0] * 36
msg.covariance[0] = msg.covariance[7] = msg.covariance[14] = 0.001
self.publish("pose_estimate", msg)
pose_estimation_ros_msgs/msg/ObjectPoseWithCovarianceArray¶
| Field | Type | Description |
|---|---|---|
.object_poses |
list[ObjectPoseWithCovariance] |
One entry per detected object |
from pose_estimation_ros_msgs.msg import ObjectPoseWithCovariance, ObjectPoseWithCovarianceArray
batch = self.get_data("all_poses")
if batch is not None:
for est in batch.object_poses:
self.log_info(f"{est.object_class_name}: z={est.pose.position.z:.3f}")
mug = ObjectPoseWithCovariance(object_class_name="mug") # fill pose and covariance as above
self.publish("all_poses", ObjectPoseWithCovarianceArray(object_poses=[mug]))
Grasp planning (neura_grasp_planning_msgs)¶
neura_grasp_planning_msgs/msg/PickPose¶
One pick plan: approach, grasp and retreat poses.
| Field | Type | Description |
|---|---|---|
.grasp_pose |
PoseStamped |
The grasp |
.pre_grasp_pose |
PoseStamped |
Approach pose |
.post_grasp_pose |
PoseStamped |
Retreat pose |
.grasp_idx |
int |
Unique grasp index, -1 if unset |
.hand_opening |
float |
Gripper aperture (opening) for the grasp |
.grasp_quality |
float |
Grasp quality score |
"outputs": {
"pick_pose": { "rosType": "neura_grasp_planning_msgs/msg/PickPose", "edgeType": 1 }
}
from geometry_msgs.msg import Point, Pose, PoseStamped, Quaternion
from neura_grasp_planning_msgs.msg import PickPose
from std_msgs.msg import Header
def stamped(x: float, y: float, z: float) -> PoseStamped:
pose = Pose(position=Point(x=x, y=y, z=z), orientation=Quaternion(w=1.0))
return PoseStamped(header=Header(frame_id="base_link"), pose=pose)
pick = PickPose(grasp_pose=stamped(0.5, 0.1, 0.3), pre_grasp_pose=stamped(0.5, 0.1, 0.45),
post_grasp_pose=stamped(0.5, 0.1, 0.5), grasp_idx=0, hand_opening=0.08, grasp_quality=0.92)
self.publish("pick_pose", pick)
Reading one:
pick = self.get_data("pick_pose")
if pick is not None:
g = pick.grasp_pose.pose.position
self.log_info(f"Grasp at ({g.x:.3f}, {g.y:.3f}, {g.z:.3f}), quality {pick.grasp_quality:.2f}")
neura_grasp_planning_msgs/msg/PickPoses¶
All pick plans for one detected object.
| Field | Type | Description |
|---|---|---|
.object_name |
str |
Object class |
.object_instance_id |
int |
Instance id from segmentation |
.picks |
list[PickPose] |
Candidate plans |
from neura_grasp_planning_msgs.msg import PickPoses
plans = self.get_data("object_picks")
if plans is not None and plans.picks:
first = plans.picks[0]
self.log_info(f"{plans.object_name} #{plans.object_instance_id}: first quality {first.grasp_quality:.2f}")
self.publish("object_picks", PickPoses(object_name="mug", object_instance_id=0, picks=[pick]))
neura_grasp_planning_msgs/msg/ObjectPickPosesArray¶
Pick plans for every object in a scene.
| Field | Type | Description |
|---|---|---|
.object_pick_poses_array |
list[PickPoses] |
One entry per object |
from neura_grasp_planning_msgs.msg import ObjectPickPosesArray, PickPoses
scene = self.get_data("scene_picks")
if scene is not None:
for plans in scene.object_pick_poses_array:
self.log_info(f"{plans.object_name}: {len(plans.picks)} candidates")
mug_plans = PickPoses(object_name="mug", object_instance_id=0, picks=[pick])
self.publish("scene_picks", ObjectPickPosesArray(object_pick_poses_array=[mug_plans]))
Instance segmentation (instance_segmentation_ros_msgs)¶
SegmentationResult and SegmentedInstanceArray are visualized as masks and boxes drawn over the node's source image; see Segmentation backgrounds.
instance_segmentation_ros_msgs/msg/SegmentationResult¶
| Field | Type | Description |
|---|---|---|
.header |
Header |
Timestamp and frame |
.instances |
list[MaskWithObjectName] |
Detected instances with masks and boxes |
"outputs": {
"segmentation": { "rosType": "instance_segmentation_ros_msgs/msg/SegmentationResult", "edgeType": 1 }
}
from instance_segmentation_ros_msgs.msg import MaskWithObjectName, SegmentationResult
from sensor_msgs.msg import Image
from std_msgs.msg import Header
from vision_msgs.msg import BoundingBox2D, Point2D, Pose2D
mask = Image(height=480, width=640, encoding="mono8", step=640, data=mask_bytes) # 0 background, 1 instance
box = BoundingBox2D(center=Pose2D(position=Point2D(x=320.0, y=240.0)), size_x=100.0, size_y=80.0)
inst = MaskWithObjectName(class_name="mug", score=0.95, mask=mask, bounding_box=box)
self.publish("segmentation", SegmentationResult(header=Header(frame_id="camera"), instances=[inst]))
Reading:
result = self.get_data("segmentation")
if result is not None:
for inst in result.instances:
c = inst.bounding_box.center.position
self.log_info(f"{inst.class_name} {inst.score:.2f} at ({c.x:.0f}, {c.y:.0f}), mask {inst.mask.width}x{inst.mask.height}")
instance_segmentation_ros_msgs/msg/MaskWithObjectName¶
One detected instance. Also usable as a port type on its own.
| Field | Type | Description |
|---|---|---|
.class_name |
str |
Detected class |
.mask |
sensor_msgs/msg/Image |
Binary mask of the instance |
.bounding_box |
vision_msgs/msg/BoundingBox2D |
2D box |
.score |
float |
Confidence, 0.0 to 1.0 |
instance_segmentation_ros_msgs/msg/SegmentedInstanceArray¶
The older result format, still produced by some segmentation services.
| Field | Type | Description |
|---|---|---|
.segmented_instances |
list[SegmentedInstance] |
Each with .class_name, .segmentation_index, .detection_score, .class_instance_index, .instance_mask (Image) and .bounding_box (neura_common_msgs/msg/BoundingBox: .min_x .min_y .max_x .max_y) |
Trigger types¶
Trigger ports do not carry messages. Their rosType is the trigger type name (Start, Stop, Error, or a custom name) with edgeType 2. The built-in types, the ports every node declares and how custom triggers work are in Triggers.
Scalar JSON rules¶
Typed JSON input supports installed ROS messages whose fields are scalars.
| ROS field | JSON value |
|---|---|
| Boolean | true or false |
| Integers up to 32 bits, byte and char | An integer number within the field's range |
int64, uint64 |
A decimal string, such as "-42" or "18446744073709551615" |
float32, float64 |
A finite number within the type's range |
| String, wide string | A Unicode string within any declared bound |
Omitted fields keep their generated defaults. A 64-bit decimal string has no leading plus sign or redundant leading zeroes. Numbers are never coerced from booleans or strings. Floating-point values that overflow or underflow to zero are rejected; representable subnormal values are accepted. Narrow string bounds count UTF-8 bytes; wide string bounds count UTF-16 code units, consistently across Python and C++. Embedded NUL characters are rejected to prevent truncation during serialization.
The payload must be a JSON object. Duplicate keys, unknown fields, invalid Unicode and non-finite numbers are rejected. The same scalar rules apply inside nested objects and arrays starting with SDK 2.45.0. The requested type must match the configured input type; unresolved generic inputs and message types missing from the node image fail explicitly.
Compound JSON rules¶
Both SDK languages accept nested messages and arrays using the message types already installed in the node image and registered with the C++ type registry.
| ROS field | JSON value |
|---|---|
| Nested message | An object with declared fields; omitted fields keep generated defaults |
| Scalar or message sequence | An array of values following the element's rules |
| Fixed array | An array with exactly the declared number of elements |
| Bounded sequence | An array no longer than the declared bound |
Binary uint8 array |
An integer array with elements from 0 to 255, never base64 |
For geometry_msgs/msg/Twist, {"linear":{"x":1.25}} sets forward velocity
while the other linear and angular coordinates keep their zero defaults.
For std_msgs/msg/UInt64MultiArray, use
{"data":["18446744073709551615"]}; omitted layout fields keep their defaults.
An empty sequence is []. Omitting a fixed array retains its generated default;
supplying it requires the exact length.
Validation constructs a fresh message and checks every supplied field before
committing the input. An invalid array element therefore preserves the previous
whole value and invokes no handler. Schema diagnostics include paths such as
$.layout.dim[0].size. A malformed JSON document can only identify the root.
No runtime schema installation or generation occurs. Missing message types fail
explicitly; rebuild the node image with its required packages before retrying.