@fleetless/contracts 15.2.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/artifacts/constants.json +11 -1
- package/artifacts/openapi.json +44 -14
- package/artifacts/schema/camera-source.schema.json +7 -3
- package/artifacts/schema/cloud-config.schema.json +31 -9
- package/artifacts/schema/config-draft-response.schema.json +31 -9
- package/artifacts/schema/config-version-response.schema.json +31 -9
- package/artifacts/schema/robot-config-doc.schema.json +31 -9
- package/dist/collections-transfer.d.ts +2 -2
- package/dist/config.d.ts +33 -2
- package/dist/config.js +141 -18
- package/dist/protocol.d.ts +8 -0
- package/dist/rest.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1475,7 +1475,7 @@
|
|
|
1475
1475
|
"type": "string",
|
|
1476
1476
|
"maxLength": 255,
|
|
1477
1477
|
"pattern": "^[a-z][a-z0-9_]*\\/(?:msg|srv|action)\\/[A-Za-z][A-Za-z0-9]*$",
|
|
1478
|
-
"description": "The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.",
|
|
1478
|
+
"description": "The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes, `foxglove_msgs/msg/CompressedVideo` for a topic that carries H.264. H.264 is passed through to live viewers without the bridge decoding or encoding it: always for `CompressedVideo`, and for a `CompressedImage` whose `format` contains `h264`, in any case. A `CompressedImage` that carries JPEG stays a picture source. A camera that is passed through follows what `passthrough` says on an RTSP source: `width` and `height` must equal the stream's size, B-frames are refused, a new viewer waits for the next keyframe, and low-bandwidth mode ends its stream. The bridge does not depend on `foxglove_msgs`; a robot without the package reports `unknown type` for that one camera. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.",
|
|
1479
1479
|
"patternErrorMessage": "A ROS 2 type name has three segments: the package, then `msg`, `srv` or `action`, then the type — `sensor_msgs/msg/BatteryState`, `std_srvs/srv/Trigger`, `nav2_msgs/action/NavigateToPose`. The middle segment is the one usually left out. The package is lower-case with underscores; the type itself is letters and digits, conventionally CamelCase.",
|
|
1480
1480
|
"examples": [
|
|
1481
1481
|
"sensor_msgs/msg/Image"
|
|
@@ -1496,7 +1496,7 @@
|
|
|
1496
1496
|
"body": {
|
|
1497
1497
|
"kind": "ros",
|
|
1498
1498
|
"topic": "${1:/camera/image_raw}",
|
|
1499
|
-
"type": "${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage|}"
|
|
1499
|
+
"type": "${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage,foxglove_msgs/msg/CompressedVideo|}"
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
|
1502
1502
|
]
|
|
@@ -1507,7 +1507,7 @@
|
|
|
1507
1507
|
"kind": {
|
|
1508
1508
|
"type": "string",
|
|
1509
1509
|
"const": "rtsp",
|
|
1510
|
-
"description": "Selects the RTSP source: this camera then carries `url`, and optionally `transport` and `credentials`."
|
|
1510
|
+
"description": "Selects the RTSP source: this camera then carries `url`, and optionally `transport`, `passthrough` and `credentials`."
|
|
1511
1511
|
},
|
|
1512
1512
|
"url": {
|
|
1513
1513
|
"type": "string",
|
|
@@ -1532,6 +1532,10 @@
|
|
|
1532
1532
|
"udp"
|
|
1533
1533
|
]
|
|
1534
1534
|
},
|
|
1535
|
+
"passthrough": {
|
|
1536
|
+
"description": "Passes the camera's own H.264 through to live viewers: the bridge forwards the access units it receives and neither decodes nor encodes the live video. A snapshot is decoded from the newest keyframe, so it is at most one keyframe interval old. Omitted means `false`: the stream is decoded and encoded again, and `fps` and `bitrate_kbps` are enforced. With `true`, `width` and `height` must equal the stream's own size, or the camera reports an error naming both and publishes nothing. `fps` and `bitrate_kbps` are not enforced then: the bridge cannot drop or shrink frames it does not encode, so both are set at the camera. The stream must be H.264 without B-frames; anything else is refused with a camera error. A new viewer waits for the camera's next keyframe, so set its keyframe interval to one to two seconds. Low-bandwidth mode ends such a stream, under `camera: reduce` as under `stop`: there is no bitrate to lower.",
|
|
1537
|
+
"type": "boolean"
|
|
1538
|
+
},
|
|
1535
1539
|
"credentials": {
|
|
1536
1540
|
"type": "object",
|
|
1537
1541
|
"properties": {
|
|
@@ -1695,7 +1699,7 @@
|
|
|
1695
1699
|
"type": "integer",
|
|
1696
1700
|
"exclusiveMinimum": 0,
|
|
1697
1701
|
"maximum": 7680,
|
|
1698
|
-
"description": "The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer's request, so no client can make the robot encode a larger frame than the developer allowed.",
|
|
1702
|
+
"description": "The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer's request, so no client can make the robot encode a larger frame than the developer allowed. A passthrough camera is the exception for live video: the bridge does not scale what it does not encode, so `width` and `height` must equal the stream's own size. With any `live.encoder` but `software` the width must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.",
|
|
1699
1703
|
"examples": [
|
|
1700
1704
|
1280
|
|
1701
1705
|
]
|
|
@@ -1704,7 +1708,7 @@
|
|
|
1704
1708
|
"type": "integer",
|
|
1705
1709
|
"exclusiveMinimum": 0,
|
|
1706
1710
|
"maximum": 4320,
|
|
1707
|
-
"description": "The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded.",
|
|
1711
|
+
"description": "The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded. The live video of a passthrough camera is not scaled: `height` and `width` must equal the stream's own size. With any `live.encoder` but `software` the height must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.",
|
|
1708
1712
|
"examples": [
|
|
1709
1713
|
720
|
|
1710
1714
|
]
|
|
@@ -1713,7 +1717,7 @@
|
|
|
1713
1717
|
"type": "integer",
|
|
1714
1718
|
"exclusiveMinimum": 0,
|
|
1715
1719
|
"maximum": 60,
|
|
1716
|
-
"description": "How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be.",
|
|
1720
|
+
"description": "How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be. A passthrough camera is the exception: the bridge forwards its H.264 at the rate the source sends it, and `fps` only bounds how often a snapshot is taken.",
|
|
1717
1721
|
"examples": [
|
|
1718
1722
|
15
|
|
1719
1723
|
]
|
|
@@ -1722,7 +1726,7 @@
|
|
|
1722
1726
|
"type": "integer",
|
|
1723
1727
|
"exclusiveMinimum": 0,
|
|
1724
1728
|
"maximum": 50000,
|
|
1725
|
-
"description": "The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot's uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail.",
|
|
1729
|
+
"description": "The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot's uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail. A passthrough camera is not encoded by the bridge, so nothing enforces this number there: the bitrate is set at the source, and this value is only what the track declares to the media server.",
|
|
1726
1730
|
"examples": [
|
|
1727
1731
|
2000
|
|
1728
1732
|
]
|
|
@@ -2072,7 +2076,7 @@
|
|
|
2072
2076
|
"camera": {
|
|
2073
2077
|
"description": "What happens to a running stream in the mode. New streams are refused either way.",
|
|
2074
2078
|
"enumDescriptions": [
|
|
2075
|
-
"A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none.",
|
|
2079
|
+
"A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none. A passthrough camera is the exception: the bridge does not encode it, so its stream ends as under `stop`.",
|
|
2076
2080
|
"A running stream ends and the viewer is told why. The uplink is then free for datapoints, which is the right trade where video is the nice-to-have."
|
|
2077
2081
|
],
|
|
2078
2082
|
"type": "string",
|
|
@@ -2082,7 +2086,7 @@
|
|
|
2082
2086
|
]
|
|
2083
2087
|
},
|
|
2084
2088
|
"camera_bitrate_kbps": {
|
|
2085
|
-
"description": "Bitrate applied to running streams under `reduce`.",
|
|
2089
|
+
"description": "Bitrate applied to running streams under `reduce`. A passthrough stream is not encoded by the bridge, so there is no bitrate to reduce and the stream ends.",
|
|
2086
2090
|
"type": "integer",
|
|
2087
2091
|
"minimum": 50,
|
|
2088
2092
|
"maximum": 20000
|
|
@@ -2111,6 +2115,24 @@
|
|
|
2111
2115
|
"type": "integer",
|
|
2112
2116
|
"minimum": 576,
|
|
2113
2117
|
"maximum": 1350
|
|
2118
|
+
},
|
|
2119
|
+
"encoder": {
|
|
2120
|
+
"description": "What encodes live video on the robot. `software` is the bridge's own encoder on the CPU. Every other value sends H.264 from a hardware encoder, reached through GStreamer, which the robot has to have installed. H.264 takes no odd size, so with any value but `software` every camera's `width` and `height` must be even, passthrough cameras included, and a document with an odd one is refused. An encoder that does not start, or stops delivering, is replaced by software H.264 for the rest of that session, with one warning in the bridge's log; one that did not start is not tried again until this setting changes or the bridge restarts. The fallback catches an encoder that fails, not one that draws a wrong picture, so look at the stream once after choosing one. The hardware encoders are written from the documentation of their GStreamer elements and tested through a software stand-in; the reference page of this section says which have been proven on hardware. It is one setting for the robot, not one per camera: the chip is part of the computer. It does not apply to a camera whose source already delivers H.264 and is passed through: that video is forwarded, not encoded. Overrides the bridge's ROS parameter `live.encoder`; without either, the bridge uses `software`. A change holds from the next live start; a running stream keeps its encoder.",
|
|
2121
|
+
"enumDescriptions": [
|
|
2122
|
+
"The bridge encodes on the CPU: VP8 or H.264, whichever the media server picks, as every robot did before the setting existed.",
|
|
2123
|
+
"Tries `nvenc`, then `vaapi`, then `v4l2`, and uses the first that starts. With none of them, software H.264.",
|
|
2124
|
+
"NVIDIA. On a Jetson the board's encoder (`nvv4l2h264enc`); a Jetson Orin Nano has none and ends on software. On a desktop card `nvh264enc`.",
|
|
2125
|
+
"Intel and AMD graphics through VA-API: `vah264enc`, then `vah264lpenc`, then `vaapih264enc`, the first that starts. `vah264lpenc` is the low-power encoder, the only one some Intel chips encode H.264 with.",
|
|
2126
|
+
"A V4L2 encoder (`v4l2h264enc`), as on a Raspberry Pi 4. A Raspberry Pi 5 has no hardware encoder and ends on software."
|
|
2127
|
+
],
|
|
2128
|
+
"type": "string",
|
|
2129
|
+
"enum": [
|
|
2130
|
+
"software",
|
|
2131
|
+
"auto",
|
|
2132
|
+
"nvenc",
|
|
2133
|
+
"vaapi",
|
|
2134
|
+
"v4l2"
|
|
2135
|
+
]
|
|
2114
2136
|
}
|
|
2115
2137
|
},
|
|
2116
2138
|
"additionalProperties": false
|
|
@@ -1432,7 +1432,7 @@
|
|
|
1432
1432
|
"type": "string",
|
|
1433
1433
|
"maxLength": 255,
|
|
1434
1434
|
"pattern": "^[a-z][a-z0-9_]*\\/(?:msg|srv|action)\\/[A-Za-z][A-Za-z0-9]*$",
|
|
1435
|
-
"description": "The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.",
|
|
1435
|
+
"description": "The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes, `foxglove_msgs/msg/CompressedVideo` for a topic that carries H.264. H.264 is passed through to live viewers without the bridge decoding or encoding it: always for `CompressedVideo`, and for a `CompressedImage` whose `format` contains `h264`, in any case. A `CompressedImage` that carries JPEG stays a picture source. A camera that is passed through follows what `passthrough` says on an RTSP source: `width` and `height` must equal the stream's size, B-frames are refused, a new viewer waits for the next keyframe, and low-bandwidth mode ends its stream. The bridge does not depend on `foxglove_msgs`; a robot without the package reports `unknown type` for that one camera. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.",
|
|
1436
1436
|
"patternErrorMessage": "A ROS 2 type name has three segments: the package, then `msg`, `srv` or `action`, then the type — `sensor_msgs/msg/BatteryState`, `std_srvs/srv/Trigger`, `nav2_msgs/action/NavigateToPose`. The middle segment is the one usually left out. The package is lower-case with underscores; the type itself is letters and digits, conventionally CamelCase.",
|
|
1437
1437
|
"examples": [
|
|
1438
1438
|
"sensor_msgs/msg/Image"
|
|
@@ -1453,7 +1453,7 @@
|
|
|
1453
1453
|
"body": {
|
|
1454
1454
|
"kind": "ros",
|
|
1455
1455
|
"topic": "${1:/camera/image_raw}",
|
|
1456
|
-
"type": "${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage|}"
|
|
1456
|
+
"type": "${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage,foxglove_msgs/msg/CompressedVideo|}"
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
1459
|
]
|
|
@@ -1464,7 +1464,7 @@
|
|
|
1464
1464
|
"kind": {
|
|
1465
1465
|
"type": "string",
|
|
1466
1466
|
"const": "rtsp",
|
|
1467
|
-
"description": "Selects the RTSP source: this camera then carries `url`, and optionally `transport` and `credentials`."
|
|
1467
|
+
"description": "Selects the RTSP source: this camera then carries `url`, and optionally `transport`, `passthrough` and `credentials`."
|
|
1468
1468
|
},
|
|
1469
1469
|
"url": {
|
|
1470
1470
|
"type": "string",
|
|
@@ -1489,6 +1489,10 @@
|
|
|
1489
1489
|
"udp"
|
|
1490
1490
|
]
|
|
1491
1491
|
},
|
|
1492
|
+
"passthrough": {
|
|
1493
|
+
"description": "Passes the camera's own H.264 through to live viewers: the bridge forwards the access units it receives and neither decodes nor encodes the live video. A snapshot is decoded from the newest keyframe, so it is at most one keyframe interval old. Omitted means `false`: the stream is decoded and encoded again, and `fps` and `bitrate_kbps` are enforced. With `true`, `width` and `height` must equal the stream's own size, or the camera reports an error naming both and publishes nothing. `fps` and `bitrate_kbps` are not enforced then: the bridge cannot drop or shrink frames it does not encode, so both are set at the camera. The stream must be H.264 without B-frames; anything else is refused with a camera error. A new viewer waits for the camera's next keyframe, so set its keyframe interval to one to two seconds. Low-bandwidth mode ends such a stream, under `camera: reduce` as under `stop`: there is no bitrate to lower.",
|
|
1494
|
+
"type": "boolean"
|
|
1495
|
+
},
|
|
1492
1496
|
"credentials": {
|
|
1493
1497
|
"type": "object",
|
|
1494
1498
|
"properties": {
|
|
@@ -1652,7 +1656,7 @@
|
|
|
1652
1656
|
"type": "integer",
|
|
1653
1657
|
"exclusiveMinimum": 0,
|
|
1654
1658
|
"maximum": 7680,
|
|
1655
|
-
"description": "The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer's request, so no client can make the robot encode a larger frame than the developer allowed.",
|
|
1659
|
+
"description": "The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer's request, so no client can make the robot encode a larger frame than the developer allowed. A passthrough camera is the exception for live video: the bridge does not scale what it does not encode, so `width` and `height` must equal the stream's own size. With any `live.encoder` but `software` the width must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.",
|
|
1656
1660
|
"examples": [
|
|
1657
1661
|
1280
|
|
1658
1662
|
]
|
|
@@ -1661,7 +1665,7 @@
|
|
|
1661
1665
|
"type": "integer",
|
|
1662
1666
|
"exclusiveMinimum": 0,
|
|
1663
1667
|
"maximum": 4320,
|
|
1664
|
-
"description": "The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded.",
|
|
1668
|
+
"description": "The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded. The live video of a passthrough camera is not scaled: `height` and `width` must equal the stream's own size. With any `live.encoder` but `software` the height must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.",
|
|
1665
1669
|
"examples": [
|
|
1666
1670
|
720
|
|
1667
1671
|
]
|
|
@@ -1670,7 +1674,7 @@
|
|
|
1670
1674
|
"type": "integer",
|
|
1671
1675
|
"exclusiveMinimum": 0,
|
|
1672
1676
|
"maximum": 60,
|
|
1673
|
-
"description": "How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be.",
|
|
1677
|
+
"description": "How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be. A passthrough camera is the exception: the bridge forwards its H.264 at the rate the source sends it, and `fps` only bounds how often a snapshot is taken.",
|
|
1674
1678
|
"examples": [
|
|
1675
1679
|
15
|
|
1676
1680
|
]
|
|
@@ -1679,7 +1683,7 @@
|
|
|
1679
1683
|
"type": "integer",
|
|
1680
1684
|
"exclusiveMinimum": 0,
|
|
1681
1685
|
"maximum": 50000,
|
|
1682
|
-
"description": "The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot's uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail.",
|
|
1686
|
+
"description": "The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot's uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail. A passthrough camera is not encoded by the bridge, so nothing enforces this number there: the bitrate is set at the source, and this value is only what the track declares to the media server.",
|
|
1683
1687
|
"examples": [
|
|
1684
1688
|
2000
|
|
1685
1689
|
]
|
|
@@ -2029,7 +2033,7 @@
|
|
|
2029
2033
|
"camera": {
|
|
2030
2034
|
"description": "What happens to a running stream in the mode. New streams are refused either way.",
|
|
2031
2035
|
"enumDescriptions": [
|
|
2032
|
-
"A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none.",
|
|
2036
|
+
"A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none. A passthrough camera is the exception: the bridge does not encode it, so its stream ends as under `stop`.",
|
|
2033
2037
|
"A running stream ends and the viewer is told why. The uplink is then free for datapoints, which is the right trade where video is the nice-to-have."
|
|
2034
2038
|
],
|
|
2035
2039
|
"type": "string",
|
|
@@ -2039,7 +2043,7 @@
|
|
|
2039
2043
|
]
|
|
2040
2044
|
},
|
|
2041
2045
|
"camera_bitrate_kbps": {
|
|
2042
|
-
"description": "Bitrate applied to running streams under `reduce`.",
|
|
2046
|
+
"description": "Bitrate applied to running streams under `reduce`. A passthrough stream is not encoded by the bridge, so there is no bitrate to reduce and the stream ends.",
|
|
2043
2047
|
"type": "integer",
|
|
2044
2048
|
"minimum": 50,
|
|
2045
2049
|
"maximum": 20000
|
|
@@ -2068,6 +2072,24 @@
|
|
|
2068
2072
|
"type": "integer",
|
|
2069
2073
|
"minimum": 576,
|
|
2070
2074
|
"maximum": 1350
|
|
2075
|
+
},
|
|
2076
|
+
"encoder": {
|
|
2077
|
+
"description": "What encodes live video on the robot. `software` is the bridge's own encoder on the CPU. Every other value sends H.264 from a hardware encoder, reached through GStreamer, which the robot has to have installed. H.264 takes no odd size, so with any value but `software` every camera's `width` and `height` must be even, passthrough cameras included, and a document with an odd one is refused. An encoder that does not start, or stops delivering, is replaced by software H.264 for the rest of that session, with one warning in the bridge's log; one that did not start is not tried again until this setting changes or the bridge restarts. The fallback catches an encoder that fails, not one that draws a wrong picture, so look at the stream once after choosing one. The hardware encoders are written from the documentation of their GStreamer elements and tested through a software stand-in; the reference page of this section says which have been proven on hardware. It is one setting for the robot, not one per camera: the chip is part of the computer. It does not apply to a camera whose source already delivers H.264 and is passed through: that video is forwarded, not encoded. Overrides the bridge's ROS parameter `live.encoder`; without either, the bridge uses `software`. A change holds from the next live start; a running stream keeps its encoder.",
|
|
2078
|
+
"enumDescriptions": [
|
|
2079
|
+
"The bridge encodes on the CPU: VP8 or H.264, whichever the media server picks, as every robot did before the setting existed.",
|
|
2080
|
+
"Tries `nvenc`, then `vaapi`, then `v4l2`, and uses the first that starts. With none of them, software H.264.",
|
|
2081
|
+
"NVIDIA. On a Jetson the board's encoder (`nvv4l2h264enc`); a Jetson Orin Nano has none and ends on software. On a desktop card `nvh264enc`.",
|
|
2082
|
+
"Intel and AMD graphics through VA-API: `vah264enc`, then `vah264lpenc`, then `vaapih264enc`, the first that starts. `vah264lpenc` is the low-power encoder, the only one some Intel chips encode H.264 with.",
|
|
2083
|
+
"A V4L2 encoder (`v4l2h264enc`), as on a Raspberry Pi 4. A Raspberry Pi 5 has no hardware encoder and ends on software."
|
|
2084
|
+
],
|
|
2085
|
+
"type": "string",
|
|
2086
|
+
"enum": [
|
|
2087
|
+
"software",
|
|
2088
|
+
"auto",
|
|
2089
|
+
"nvenc",
|
|
2090
|
+
"vaapi",
|
|
2091
|
+
"v4l2"
|
|
2092
|
+
]
|
|
2071
2093
|
}
|
|
2072
2094
|
},
|
|
2073
2095
|
"additionalProperties": false
|
|
@@ -89,9 +89,9 @@ export declare const collectionExportQuery: z.ZodObject<{
|
|
|
89
89
|
true: "true";
|
|
90
90
|
false: "false";
|
|
91
91
|
}>>;
|
|
92
|
-
search: z.ZodOptional<z.ZodString>;
|
|
93
|
-
filter: z.ZodOptional<z.ZodString>;
|
|
94
92
|
sort: z.ZodOptional<z.ZodString>;
|
|
93
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
94
|
+
search: z.ZodOptional<z.ZodString>;
|
|
95
95
|
robot: z.ZodOptional<z.ZodUUID>;
|
|
96
96
|
format: z.ZodEnum<{
|
|
97
97
|
json: "json";
|
package/dist/config.d.ts
CHANGED
|
@@ -544,6 +544,7 @@ export declare const cameraSource: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
544
544
|
tcp: "tcp";
|
|
545
545
|
udp: "udp";
|
|
546
546
|
}>>;
|
|
547
|
+
passthrough: z.ZodOptional<z.ZodBoolean>;
|
|
547
548
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
548
549
|
username: z.ZodOptional<z.ZodString>;
|
|
549
550
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -601,6 +602,7 @@ export declare const cameraConfig: z.ZodObject<{
|
|
|
601
602
|
tcp: "tcp";
|
|
602
603
|
udp: "udp";
|
|
603
604
|
}>>;
|
|
605
|
+
passthrough: z.ZodOptional<z.ZodBoolean>;
|
|
604
606
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
605
607
|
username: z.ZodOptional<z.ZodString>;
|
|
606
608
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -683,9 +685,15 @@ export type LowBandwidthSection = z.infer<typeof lowBandwidthSection>;
|
|
|
683
685
|
* smallest IPv6 guarantees, and what NetBird and Tailscale set — carries it:
|
|
684
686
|
* the bytes a packet gains on the way (header extensions an SFU may add, the
|
|
685
687
|
* SRTP tag, UDP, IP, TURN) come to about 80 at most.
|
|
688
|
+
*
|
|
689
|
+
* `software` is the encoder the bridge has always had, so a bridge upgrade
|
|
690
|
+
* changes no robot. Hardware is opt-in for a reason the fallback cannot
|
|
691
|
+
* cover: it catches an encoder that does not start, not one that starts and
|
|
692
|
+
* draws the wrong picture.
|
|
686
693
|
*/
|
|
687
694
|
export declare const LIVE_DEFAULTS: {
|
|
688
695
|
readonly max_packet_bytes: 1200;
|
|
696
|
+
readonly encoder: "software";
|
|
689
697
|
};
|
|
690
698
|
/**
|
|
691
699
|
* The bounds of the `live` settings, exported into `constants.json` beside the
|
|
@@ -699,16 +707,24 @@ export declare const LIVE_DEFAULTS: {
|
|
|
699
707
|
* larger setting is not a bigger packet but no video, and it is refused where
|
|
700
708
|
* the configuration is saved. 1350 rather than 1356: a number a person can
|
|
701
709
|
* remember, and nothing is lost in six bytes.
|
|
710
|
+
*
|
|
711
|
+
* An enum's bounds are its values: `encoder.values` is the list the schema
|
|
712
|
+
* accepts, in the schema's order, so the bridge's parameter callback refuses
|
|
713
|
+
* a sixth name with the list the cloud refuses it with.
|
|
702
714
|
*/
|
|
703
715
|
export declare const LIVE_BOUNDS: {
|
|
704
716
|
readonly max_packet_bytes: {
|
|
705
717
|
readonly min: 576;
|
|
706
718
|
readonly max: 1350;
|
|
707
719
|
};
|
|
720
|
+
readonly encoder: {
|
|
721
|
+
readonly values: readonly ["software", "auto", "nvenc", "vaapi", "v4l2"];
|
|
722
|
+
};
|
|
708
723
|
};
|
|
709
724
|
/**
|
|
710
|
-
* How the bridge sends live video: settings of the transport
|
|
711
|
-
* the whole robot and not for one camera
|
|
725
|
+
* How the bridge sends live video: settings of the transport and of the
|
|
726
|
+
* encoder, which hold for the whole robot and not for one camera — the path
|
|
727
|
+
* and the chip belong to the computer. Every key is optional and layered
|
|
712
728
|
* as in `lowBandwidthSection`: a key present here overrides the bridge's ROS
|
|
713
729
|
* parameter of the same name, an absent key falls through to it, and the
|
|
714
730
|
* parameter falls through to `LIVE_DEFAULTS`.
|
|
@@ -720,6 +736,13 @@ export declare const LIVE_BOUNDS: {
|
|
|
720
736
|
*/
|
|
721
737
|
export declare const liveSection: z.ZodObject<{
|
|
722
738
|
max_packet_bytes: z.ZodOptional<z.ZodNumber>;
|
|
739
|
+
encoder: z.ZodOptional<z.ZodEnum<{
|
|
740
|
+
v4l2: "v4l2";
|
|
741
|
+
auto: "auto";
|
|
742
|
+
software: "software";
|
|
743
|
+
nvenc: "nvenc";
|
|
744
|
+
vaapi: "vaapi";
|
|
745
|
+
}>>;
|
|
723
746
|
}, z.core.$strict>;
|
|
724
747
|
export type LiveSection = z.infer<typeof liveSection>;
|
|
725
748
|
/**
|
|
@@ -935,6 +958,7 @@ export declare const robotConfigDoc: z.ZodObject<{
|
|
|
935
958
|
tcp: "tcp";
|
|
936
959
|
udp: "udp";
|
|
937
960
|
}>>;
|
|
961
|
+
passthrough: z.ZodOptional<z.ZodBoolean>;
|
|
938
962
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
939
963
|
username: z.ZodOptional<z.ZodString>;
|
|
940
964
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -990,6 +1014,13 @@ export declare const robotConfigDoc: z.ZodObject<{
|
|
|
990
1014
|
}, z.core.$strict>>;
|
|
991
1015
|
live: z.ZodOptional<z.ZodObject<{
|
|
992
1016
|
max_packet_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1017
|
+
encoder: z.ZodOptional<z.ZodEnum<{
|
|
1018
|
+
v4l2: "v4l2";
|
|
1019
|
+
auto: "auto";
|
|
1020
|
+
software: "software";
|
|
1021
|
+
nvenc: "nvenc";
|
|
1022
|
+
vaapi: "vaapi";
|
|
1023
|
+
}>>;
|
|
993
1024
|
}, z.core.$strict>>;
|
|
994
1025
|
}, z.core.$strict>;
|
|
995
1026
|
export type RobotConfigDoc = z.infer<typeof robotConfigDoc>;
|
package/dist/config.js
CHANGED
|
@@ -42,6 +42,10 @@ import { ENTRY_KINDS, roleRef } from './rights.js';
|
|
|
42
42
|
* the index of declared names that `messages:` and each entry's
|
|
43
43
|
* `parameters:` build together.
|
|
44
44
|
*
|
|
45
|
+
* One rule across sections is decided here all the same, and carries none of
|
|
46
|
+
* the thirteen codes: a camera of odd size under a hardware `live.encoder`
|
|
47
|
+
* (`refuseOddSizes`, whose comment says why it sits on the document).
|
|
48
|
+
*
|
|
45
49
|
* `nested_message_reference` is the one worth naming explicitly, because it
|
|
46
50
|
* looks decidable here and is: a `messages:` entry whose whole body is
|
|
47
51
|
* `'${name}'` is a nested reference, full stop. It is the cloud's anyway, so
|
|
@@ -1627,7 +1631,7 @@ export const cameraSource = z.discriminatedUnion('kind', [
|
|
|
1627
1631
|
examples: ['/camera/image_raw'],
|
|
1628
1632
|
}),
|
|
1629
1633
|
type: rosTypeName.meta({
|
|
1630
|
-
description: 'The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.',
|
|
1634
|
+
description: 'The message type of `topic`: `sensor_msgs/msg/Image` for raw frames, `sensor_msgs/msg/CompressedImage` for a camera that already encodes, `foxglove_msgs/msg/CompressedVideo` for a topic that carries H.264. H.264 is passed through to live viewers without the bridge decoding or encoding it: always for `CompressedVideo`, and for a `CompressedImage` whose `format` contains `h264`, in any case. A `CompressedImage` that carries JPEG stays a picture source. A camera that is passed through follows what `passthrough` says on an RTSP source: `width` and `height` must equal the stream\'s size, B-frames are refused, a new viewer waits for the next keyframe, and low-bandwidth mode ends its stream. The bridge does not depend on `foxglove_msgs`; a robot without the package reports `unknown type` for that one camera. Declared here rather than introspected, so a camera can be configured for a robot that has never connected.',
|
|
1631
1635
|
patternErrorMessage: ROS_TYPE_NAME_RULE,
|
|
1632
1636
|
examples: ['sensor_msgs/msg/Image'],
|
|
1633
1637
|
}),
|
|
@@ -1639,11 +1643,12 @@ export const cameraSource = z.discriminatedUnion('kind', [
|
|
|
1639
1643
|
/**
|
|
1640
1644
|
* `type` is a **choice**, not a literal, and that is a correction: it was
|
|
1641
1645
|
* written out on the rule that a field the format fixes is written out,
|
|
1642
|
-
* and `type` is not such a field. Its own description names
|
|
1646
|
+
* and `type` is not such a field. Its own description names three values
|
|
1643
1647
|
* and says which applies when — `Image` for raw frames,
|
|
1644
|
-
* `CompressedImage` for a camera that encodes itself
|
|
1645
|
-
*
|
|
1646
|
-
*
|
|
1648
|
+
* `CompressedImage` for a camera that encodes itself, `CompressedVideo`
|
|
1649
|
+
* for a topic that carries H.264. A snippet that
|
|
1650
|
+
* picks one picks wrong for most cameras, and picks it invisibly:
|
|
1651
|
+
* `rosTypeName` accepts any of them, publish accepts any, no diagnostic
|
|
1647
1652
|
* fires anywhere, and the bridge then subscribes with the wrong type and
|
|
1648
1653
|
* delivers no frames. A snippet supplying a wrong answer where it could
|
|
1649
1654
|
* have supplied a question is a defect arriving through a hint the
|
|
@@ -1654,22 +1659,22 @@ export const cameraSource = z.discriminatedUnion('kind', [
|
|
|
1654
1659
|
* Choice syntax is the one construct here that three layers must each
|
|
1655
1660
|
* pass through unharmed: yaml-language-server's `stringifyObject` emits
|
|
1656
1661
|
* the body verbatim, and monaco-editor's `SnippetParser` parses
|
|
1657
|
-
* `${2|a,b|}` into a placeholder carrying
|
|
1662
|
+
* `${2|a,b,c|}` into a placeholder carrying every option whose
|
|
1658
1663
|
* `toString()` — the text on the buffer before anyone chooses — is the
|
|
1659
1664
|
* first one. So a developer who tabs past this gets a document
|
|
1660
1665
|
* byte-identical to the literal it replaced, and one who opens the
|
|
1661
|
-
* picker gets `CompressedImage`;
|
|
1666
|
+
* picker gets `CompressedImage` or `CompressedVideo`; all three parse.
|
|
1662
1667
|
*/
|
|
1663
1668
|
body: {
|
|
1664
1669
|
kind: 'ros',
|
|
1665
1670
|
topic: '${1:/camera/image_raw}',
|
|
1666
|
-
type: '${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage|}',
|
|
1671
|
+
type: '${2|sensor_msgs/msg/Image,sensor_msgs/msg/CompressedImage,foxglove_msgs/msg/CompressedVideo|}',
|
|
1667
1672
|
},
|
|
1668
1673
|
}],
|
|
1669
1674
|
}),
|
|
1670
1675
|
strictObject({
|
|
1671
1676
|
kind: z.literal('rtsp').meta({
|
|
1672
|
-
description: 'Selects the RTSP source: this camera then carries `url`, and optionally `transport` and `credentials`.',
|
|
1677
|
+
description: 'Selects the RTSP source: this camera then carries `url`, and optionally `transport`, `passthrough` and `credentials`.',
|
|
1673
1678
|
}),
|
|
1674
1679
|
/**
|
|
1675
1680
|
* Scheme-constrained deliberately. The bridge opens these with libraries
|
|
@@ -1697,6 +1702,19 @@ export const cameraSource = z.discriminatedUnion('kind', [
|
|
|
1697
1702
|
udp: 'The frames travel in their own UDP stream: lower latency on a quiet network, and silent frame loss on any other.',
|
|
1698
1703
|
}),
|
|
1699
1704
|
}),
|
|
1705
|
+
/**
|
|
1706
|
+
* Opt-in, and absent rather than defaulted: an RTSP camera that exists
|
|
1707
|
+
* today is decoded and encoded again after an upgrade exactly as before,
|
|
1708
|
+
* and a parse writes no `false` into a document nobody put one in. The
|
|
1709
|
+
* bridge reads absent as off (fleetless/fleetless#1117).
|
|
1710
|
+
*
|
|
1711
|
+
* RTSP is the one source that carries this switch. A ROS topic is passed
|
|
1712
|
+
* through by what it carries, see `type` on the `ros` member; MJPEG and
|
|
1713
|
+
* V4L2 are never passed through.
|
|
1714
|
+
*/
|
|
1715
|
+
passthrough: z.boolean().optional().meta({
|
|
1716
|
+
description: 'Passes the camera\'s own H.264 through to live viewers: the bridge forwards the access units it receives and neither decodes nor encodes the live video. A snapshot is decoded from the newest keyframe, so it is at most one keyframe interval old. Omitted means `false`: the stream is decoded and encoded again, and `fps` and `bitrate_kbps` are enforced. With `true`, `width` and `height` must equal the stream\'s own size, or the camera reports an error naming both and publishes nothing. `fps` and `bitrate_kbps` are not enforced then: the bridge cannot drop or shrink frames it does not encode, so both are set at the camera. The stream must be H.264 without B-frames; anything else is refused with a camera error. A new viewer waits for the camera\'s next keyframe, so set its keyframe interval to one to two seconds. Low-bandwidth mode ends such a stream, under `camera: reduce` as under `stop`: there is no bitrate to lower.',
|
|
1717
|
+
}),
|
|
1700
1718
|
credentials: cameraCredentials.optional(),
|
|
1701
1719
|
}).meta({
|
|
1702
1720
|
description: 'Frames come from an RTSP stream the robot itself can reach — a network camera on its own LAN. The bridge opens the connection; the cloud never does, and never needs a route to the camera.',
|
|
@@ -1852,19 +1870,19 @@ export const cameraConfig = strictObject({
|
|
|
1852
1870
|
description: 'Where this camera\'s frames come from. `kind` picks one of four sources and fixes which other fields the source may carry, so an impossible camera is unrepresentable rather than merely invalid — there is no way to write an RTSP camera with a ROS topic.',
|
|
1853
1871
|
}),
|
|
1854
1872
|
width: z.number().int().positive().max(7680).meta({
|
|
1855
|
-
description: 'The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer\'s request, so no client can make the robot encode a larger frame than the developer allowed.',
|
|
1873
|
+
description: 'The width the bridge scales frames to before sending, in pixels — what the bridge produces, not what the sensor captures; a snapshot can arrive narrower, since the bridge reduces both dimensions together to fit its JPEG byte ceiling. It stands in the configuration and never in a viewer\'s request, so no client can make the robot encode a larger frame than the developer allowed. A passthrough camera is the exception for live video: the bridge does not scale what it does not encode, so `width` and `height` must equal the stream\'s own size. With any `live.encoder` but `software` the width must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.',
|
|
1856
1874
|
examples: [1280],
|
|
1857
1875
|
}),
|
|
1858
1876
|
height: z.number().int().positive().max(4320).meta({
|
|
1859
|
-
description: 'The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded.',
|
|
1877
|
+
description: 'The height the bridge scales every frame to, in pixels; with `width` it is the size the live stream carries. A snapshot can arrive **smaller** than this — its JPEG has a byte ceiling, and the bridge gives up quality first and then resolution to fit, reporting the size it actually encoded. The live video of a passthrough camera is not scaled: `height` and `width` must equal the stream\'s own size. With any `live.encoder` but `software` the height must be even: the bridge then sends H.264, which takes no odd size, and a document with an odd one is refused.',
|
|
1860
1878
|
examples: [720],
|
|
1861
1879
|
}),
|
|
1862
1880
|
fps: z.number().int().positive().max(60).meta({
|
|
1863
|
-
description: 'How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be.',
|
|
1881
|
+
description: 'How many frames a second the bridge forwards, at most. It is a ceiling, not a clock: a camera that delivers ten frames a second stays at ten. Both modes read the same throttled pipeline, so this also bounds how fresh a snapshot can be. A passthrough camera is the exception: the bridge forwards its H.264 at the rate the source sends it, and `fps` only bounds how often a snapshot is taken.',
|
|
1864
1882
|
examples: [15],
|
|
1865
1883
|
}),
|
|
1866
1884
|
bitrate_kbps: z.number().int().positive().max(50_000).meta({
|
|
1867
|
-
description: 'The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot\'s uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail.',
|
|
1885
|
+
description: 'The ceiling for the **live** encoding, in kilobits per second — this is what bounds a watched camera against the robot\'s uplink. Snapshots are not covered by it: they are JPEGs under their own byte ceiling. Raising `width`, `height` or `fps` against a fixed bitrate buys blur, not detail. A passthrough camera is not encoded by the bridge, so nothing enforces this number there: the bitrate is set at the source, and this value is only what the track declares to the media server.',
|
|
1868
1886
|
examples: [2000],
|
|
1869
1887
|
}),
|
|
1870
1888
|
snapshot_interval_seconds: snapshotIntervalSeconds.meta({
|
|
@@ -1933,11 +1951,11 @@ export const lowBandwidthSection = strictObject({
|
|
|
1933
1951
|
camera: lowBandwidthCamera.optional().meta({
|
|
1934
1952
|
description: 'What happens to a running stream in the mode. New streams are refused either way.',
|
|
1935
1953
|
enumDescriptions: describeValues(lowBandwidthCamera.options, {
|
|
1936
|
-
reduce: 'A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none.',
|
|
1954
|
+
reduce: 'A running stream is re-encoded at `camera_bitrate_kbps` and keeps running. A viewer sees a worse picture rather than none. A passthrough camera is the exception: the bridge does not encode it, so its stream ends as under `stop`.',
|
|
1937
1955
|
stop: 'A running stream ends and the viewer is told why. The uplink is then free for datapoints, which is the right trade where video is the nice-to-have.',
|
|
1938
1956
|
}),
|
|
1939
1957
|
}),
|
|
1940
|
-
camera_bitrate_kbps: z.number().int().min(50).max(20000).optional().meta({ description: 'Bitrate applied to running streams under `reduce`.' }),
|
|
1958
|
+
camera_bitrate_kbps: z.number().int().min(50).max(20000).optional().meta({ description: 'Bitrate applied to running streams under `reduce`. A passthrough stream is not encoded by the bridge, so there is no bitrate to reduce and the stream ends.' }),
|
|
1941
1959
|
})
|
|
1942
1960
|
.superRefine((s, ctx) => {
|
|
1943
1961
|
if (s.enter_lag_ms !== undefined && s.exit_lag_ms !== undefined && s.exit_lag_ms > s.enter_lag_ms)
|
|
@@ -1953,10 +1971,32 @@ export const lowBandwidthSection = strictObject({
|
|
|
1953
1971
|
* smallest IPv6 guarantees, and what NetBird and Tailscale set — carries it:
|
|
1954
1972
|
* the bytes a packet gains on the way (header extensions an SFU may add, the
|
|
1955
1973
|
* SRTP tag, UDP, IP, TURN) come to about 80 at most.
|
|
1974
|
+
*
|
|
1975
|
+
* `software` is the encoder the bridge has always had, so a bridge upgrade
|
|
1976
|
+
* changes no robot. Hardware is opt-in for a reason the fallback cannot
|
|
1977
|
+
* cover: it catches an encoder that does not start, not one that starts and
|
|
1978
|
+
* draws the wrong picture.
|
|
1956
1979
|
*/
|
|
1957
1980
|
export const LIVE_DEFAULTS = {
|
|
1958
1981
|
max_packet_bytes: 1200,
|
|
1982
|
+
encoder: 'software',
|
|
1959
1983
|
};
|
|
1984
|
+
/**
|
|
1985
|
+
* What may encode live video, declared once as a tuple: the enum is built
|
|
1986
|
+
* from it and `LIVE_BOUNDS` exports it. Its own array and `readonly` in the
|
|
1987
|
+
* type, so a consumer that sorted the exported list could not reorder the
|
|
1988
|
+
* enum's options with it.
|
|
1989
|
+
*
|
|
1990
|
+
* `auto` tries the three hardware names in the order they stand here. The
|
|
1991
|
+
* vendor-specific ones come before the generic `v4l2`, which on some boards
|
|
1992
|
+
* finds a device it cannot drive.
|
|
1993
|
+
*/
|
|
1994
|
+
const LIVE_ENCODERS = ['software', 'auto', 'nvenc', 'vaapi', 'v4l2'];
|
|
1995
|
+
/**
|
|
1996
|
+
* Named rather than inlined, for `chartStyle`'s reason: `describeValues`
|
|
1997
|
+
* reads `.options`, and the per-value sentences are then keyed by value.
|
|
1998
|
+
*/
|
|
1999
|
+
const liveEncoder = z.enum(LIVE_ENCODERS);
|
|
1960
2000
|
/**
|
|
1961
2001
|
* The bounds of the `live` settings, exported into `constants.json` beside the
|
|
1962
2002
|
* defaults: the bridge refuses a ROS parameter outside them with the same
|
|
@@ -1969,13 +2009,19 @@ export const LIVE_DEFAULTS = {
|
|
|
1969
2009
|
* larger setting is not a bigger packet but no video, and it is refused where
|
|
1970
2010
|
* the configuration is saved. 1350 rather than 1356: a number a person can
|
|
1971
2011
|
* remember, and nothing is lost in six bytes.
|
|
2012
|
+
*
|
|
2013
|
+
* An enum's bounds are its values: `encoder.values` is the list the schema
|
|
2014
|
+
* accepts, in the schema's order, so the bridge's parameter callback refuses
|
|
2015
|
+
* a sixth name with the list the cloud refuses it with.
|
|
1972
2016
|
*/
|
|
1973
2017
|
export const LIVE_BOUNDS = {
|
|
1974
2018
|
max_packet_bytes: { min: 576, max: 1350 },
|
|
2019
|
+
encoder: { values: LIVE_ENCODERS },
|
|
1975
2020
|
};
|
|
1976
2021
|
/**
|
|
1977
|
-
* How the bridge sends live video: settings of the transport
|
|
1978
|
-
* the whole robot and not for one camera
|
|
2022
|
+
* How the bridge sends live video: settings of the transport and of the
|
|
2023
|
+
* encoder, which hold for the whole robot and not for one camera — the path
|
|
2024
|
+
* and the chip belong to the computer. Every key is optional and layered
|
|
1979
2025
|
* as in `lowBandwidthSection`: a key present here overrides the bridge's ROS
|
|
1980
2026
|
* parameter of the same name, an absent key falls through to it, and the
|
|
1981
2027
|
* parameter falls through to `LIVE_DEFAULTS`.
|
|
@@ -1990,7 +2036,84 @@ export const liveSection = strictObject({
|
|
|
1990
2036
|
description: `The largest RTP packet the bridge sends, in bytes: fixed header, header extensions and payload, before SRTP adds its tag, retransmissions included. It is not an MTU: the MTU belongs to the path to each viewer, which the robot does not know. On the wire a packet is up to about 80 bytes longer. Lower it when a viewer's path carries less, such as a tunnel inside a tunnel. The ceiling sits just under what the bridge's SRTP library protects (1356 bytes); past that, live video stops. Overrides the bridge's ROS parameter \`live.max_packet_bytes\`; without either, the bridge sends ${LIVE_DEFAULTS.max_packet_bytes}. A change holds from the next frame, for running streams too.`,
|
|
1991
2037
|
examples: [LIVE_DEFAULTS.max_packet_bytes],
|
|
1992
2038
|
}),
|
|
2039
|
+
encoder: liveEncoder.optional().meta({
|
|
2040
|
+
description: `What encodes live video on the robot. \`software\` is the bridge's own encoder on the CPU. Every other value sends H.264 from a hardware encoder, reached through GStreamer, which the robot has to have installed. H.264 takes no odd size, so with any value but \`software\` every camera's \`width\` and \`height\` must be even, passthrough cameras included, and a document with an odd one is refused. An encoder that does not start, or stops delivering, is replaced by software H.264 for the rest of that session, with one warning in the bridge's log; one that did not start is not tried again until this setting changes or the bridge restarts. The fallback catches an encoder that fails, not one that draws a wrong picture, so look at the stream once after choosing one. The hardware encoders are written from the documentation of their GStreamer elements and tested through a software stand-in; the reference page of this section says which have been proven on hardware. It is one setting for the robot, not one per camera: the chip is part of the computer. It does not apply to a camera whose source already delivers H.264 and is passed through: that video is forwarded, not encoded. Overrides the bridge's ROS parameter \`live.encoder\`; without either, the bridge uses \`${LIVE_DEFAULTS.encoder}\`. A change holds from the next live start; a running stream keeps its encoder.`,
|
|
2041
|
+
enumDescriptions: describeValues(liveEncoder.options, {
|
|
2042
|
+
software: 'The bridge encodes on the CPU: VP8 or H.264, whichever the media server picks, as every robot did before the setting existed.',
|
|
2043
|
+
auto: 'Tries `nvenc`, then `vaapi`, then `v4l2`, and uses the first that starts. With none of them, software H.264.',
|
|
2044
|
+
nvenc: 'NVIDIA. On a Jetson the board\'s encoder (`nvv4l2h264enc`); a Jetson Orin Nano has none and ends on software. On a desktop card `nvh264enc`.',
|
|
2045
|
+
vaapi: 'Intel and AMD graphics through VA-API: `vah264enc`, then `vah264lpenc`, then `vaapih264enc`, the first that starts. `vah264lpenc` is the low-power encoder, the only one some Intel chips encode H.264 with.',
|
|
2046
|
+
v4l2: 'A V4L2 encoder (`v4l2h264enc`), as on a Raspberry Pi 4. A Raspberry Pi 5 has no hardware encoder and ends on software.',
|
|
2047
|
+
}),
|
|
2048
|
+
}),
|
|
1993
2049
|
});
|
|
2050
|
+
/**
|
|
2051
|
+
* The values of `live.encoder` that send H.264 and nothing else: every one
|
|
2052
|
+
* but `software`. Read from the tuple, so a sixth hardware name is covered by
|
|
2053
|
+
* the rule below the moment it is in the enum.
|
|
2054
|
+
*/
|
|
2055
|
+
const H264_ONLY_ENCODERS = new Set(LIVE_ENCODERS.filter((encoder) => encoder !== 'software'));
|
|
2056
|
+
/**
|
|
2057
|
+
* The refusal for one odd key, in one sentence: the setting, the odd value
|
|
2058
|
+
* and the two ways out. A bridge that meets the same camera through its ROS
|
|
2059
|
+
* parameter refuses the live start in the same words, of the whole size.
|
|
2060
|
+
*/
|
|
2061
|
+
const oddSizeMessage = (encoder, key, value) => `With live.encoder: ${encoder} the bridge sends H.264, which takes no odd ${key}: set an even ${key} instead of ${value}, or live.encoder: software.`;
|
|
2062
|
+
const isMapping = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
2063
|
+
const samePath = (a, b) => a.length === b.length && a.every((segment, index) => segment === b[index]);
|
|
2064
|
+
/**
|
|
2065
|
+
* **A hardware encoder takes no camera of odd size.** With any `live.encoder`
|
|
2066
|
+
* but `software` the bridge offers H.264 alone, from the chip or from the
|
|
2067
|
+
* software H.264 it falls back to, and H.264 as the bridge sends it (4:2:0)
|
|
2068
|
+
* has no odd width or height. Such a camera used to be accepted, failed in
|
|
2069
|
+
* every chain and in the fallback, and gave its viewer no picture.
|
|
2070
|
+
*
|
|
2071
|
+
* One issue per odd key, at `cameras.<slug>.width` or `.height`. Every camera
|
|
2072
|
+
* counts, passthrough ones included: a passthrough camera's size must equal
|
|
2073
|
+
* its stream's, and a 4:2:0 H.264 stream has no odd size either, so one rule
|
|
2074
|
+
* without an exception says the same thing. `software` and an absent key
|
|
2075
|
+
* change nothing; the media server may pick VP8 there.
|
|
2076
|
+
*
|
|
2077
|
+
* **It spans two sections, so it is on the document**, and like every
|
|
2078
|
+
* `superRefine` it is not in the JSON Schema export: an editor learns it from
|
|
2079
|
+
* the findings of a validation, and the descriptions of `width`, `height` and
|
|
2080
|
+
* `live.encoder` say it in words. The issue keeps zod's own code, as
|
|
2081
|
+
* `low_bandwidth.exit_lag_ms` does: the format names no code for it.
|
|
2082
|
+
*
|
|
2083
|
+
* **It runs beside the document's other refusals, with one exception.** Zod
|
|
2084
|
+
* skips a refinement once anything in the value is refused, which at the root
|
|
2085
|
+
* means anywhere in the file: a typo three sections away would hide this
|
|
2086
|
+
* finding until it was fixed. `when` lets it run whenever the document is a
|
|
2087
|
+
* mapping, so the value it reads may be half-parsed, and it reads it as such:
|
|
2088
|
+
* nothing unless `live.encoder` is one of the hardware values, nothing for a
|
|
2089
|
+
* camera that is not a mapping, and nothing for a key that is not an integer
|
|
2090
|
+
* or already carries a refusal of its own, which is then the one finding that
|
|
2091
|
+
* key has. The exception is a fraction on an integer key anywhere in the
|
|
2092
|
+
* document: zod treats that refusal as final and runs no `when` check after
|
|
2093
|
+
* it, so this finding arrives once the fraction is fixed. Working around it
|
|
2094
|
+
* would take a `preprocess` or a pipe, and `robotConfigDoc` would stop being
|
|
2095
|
+
* an object schema.
|
|
2096
|
+
*/
|
|
2097
|
+
function refuseOddSizes(doc, ctx) {
|
|
2098
|
+
if (!isMapping(doc) || !isMapping(doc.live) || !isMapping(doc.cameras))
|
|
2099
|
+
return;
|
|
2100
|
+
const encoder = doc.live.encoder;
|
|
2101
|
+
if (typeof encoder !== 'string' || !H264_ONLY_ENCODERS.has(encoder))
|
|
2102
|
+
return;
|
|
2103
|
+
for (const [slug, camera] of Object.entries(doc.cameras)) {
|
|
2104
|
+
if (!isMapping(camera))
|
|
2105
|
+
continue;
|
|
2106
|
+
for (const key of ['width', 'height']) {
|
|
2107
|
+
const value = camera[key];
|
|
2108
|
+
const path = ['cameras', slug, key];
|
|
2109
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value % 2 === 0)
|
|
2110
|
+
continue;
|
|
2111
|
+
if (ctx.issues.some((issue) => samePath(issue.path ?? [], path)))
|
|
2112
|
+
continue;
|
|
2113
|
+
ctx.addIssue({ code: 'custom', path, message: oddSizeMessage(encoder, key, value) });
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
1994
2117
|
/**
|
|
1995
2118
|
* The format version of a `fleetless.yaml`. Deliberately not called
|
|
1996
2119
|
* `version`: the console counts published states with "v12 → v13", and two
|
|
@@ -2142,7 +2265,7 @@ export const robotConfigDoc = strictObject({
|
|
|
2142
2265
|
body: { max_packet_bytes: LIVE_DEFAULTS.max_packet_bytes },
|
|
2143
2266
|
}],
|
|
2144
2267
|
}),
|
|
2145
|
-
});
|
|
2268
|
+
}).superRefine(refuseOddSizes, { when: (payload) => isMapping(payload.value) });
|
|
2146
2269
|
/**
|
|
2147
2270
|
* One thing the cloud has to say about a configuration: the field, and the
|
|
2148
2271
|
* rule it violates.
|