fly_ruler_ros2.client
本页由
fr-docs-dev gen-api从源码 docstring 生成,请勿手工编辑;重新生成执行just api。
不依赖 ROS/core 的同步只读 HTTP client。
公开成员
| 名称 | 类型 | 定义位置 |
|---|---|---|
NodeClient | 类 | 本页 |
NodeDescription | 类 | 本页 |
LifecycleState | 类 | 本页 |
NodeDiagnostics | 类 | 本页 |
NodeClientError | 类 | 本页 |
NodeUnavailableError | 类 | 本页 |
NodeProtocolError | 类 | 本页 |
JsonValue | 类型别名 | 本页 |
定义
NodeClient
python
class NodeClient(base_url: str, *, timeout: float = 5.0)查询节点已经发布的快照;不重试、不发送写请求。
属性
| 名称 | 类型 | 说明 |
|---|---|---|
base_url | — | 只读 HTTP(S) 根地址。 |
timeout | — | 每次网络操作的超时,单位秒。 |
__init__
python
def __init__(base_url: str, *, timeout: float = 5.0) -> None校验并保存连接设置。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
base_url | str | — | HTTP(S) 根地址,可含路径前缀。 |
timeout | float | 5.0 | 每次网络操作的有限正超时,单位秒。 |
异常
| 类型 | 说明 |
|---|---|
ValueError | 地址包含凭据、查询、片段,或超时不是有限正数。 |
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:97
base_url
python
base_url = base_url.rstrip('/')实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:119
timeout
python
timeout = timeout实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:120
describe
python
def describe() -> NodeDescriptionGET /v1/model,保留未知的合法 metadata 字段。
返回
| 类型 | 说明 |
|---|---|
NodeDescription | 本次请求校验后的只读快照。 |
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:159
state
python
def state() -> LifecycleStateGET /v1/state,返回 ROS 状态而非私有运行状态。
返回
| 类型 | 说明 |
|---|---|
LifecycleState | 本次请求校验后的只读快照。 |
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:167
parameters
python
def parameters() -> dict[str, JsonValue]GET /v1/parameters,返回节点参数的 JSON 快照。
返回
| 类型 | 说明 |
|---|---|
dict[str, JsonValue] | 本次请求校验后的只读快照。 |
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:175
diagnostics
python
def diagnostics() -> NodeDiagnosticsGET /v1/diagnostics,时间以秒表示,计数不得为负。
返回
| 类型 | 说明 |
|---|---|
NodeDiagnostics | 本次请求校验后的只读快照。 |
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:183
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:89
NodeDescription
python
class NodeDescription(name: Annotated[str, Field(min_length=1)], namespace: Annotated[str, Field(min_length=1)], metadata: dict[str, JsonValue])ROS 节点身份和未经重定义的 core/ROS2 元数据。
属性
| 名称 | 类型 | 说明 |
|---|---|---|
name | Annotated[str, Field(min_length=1)] | ROS 节点名称。 |
namespace | Annotated[str, Field(min_length=1)] | ROS 命名空间。 |
metadata | dict[str, JsonValue] | 原样保留的模型和 ROS 元数据。 |
name
python
name: Annotated[str, Field(min_length=1)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:36
namespace
python
namespace: Annotated[str, Field(min_length=1)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:37
metadata
python
metadata: dict[str, JsonValue]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:38
__init__
python
def __init__(name: Annotated[str, Field(min_length=1)], namespace: Annotated[str, Field(min_length=1)], metadata: dict[str, JsonValue]) -> None实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:26
LifecycleState
python
class LifecycleState(id: Annotated[int, Field(ge=0)], label: Annotated[str, Field(min_length=1)])ROS 标准生命周期状态,允许标准过渡态。
属性
| 名称 | 类型 | 说明 |
|---|---|---|
id | Annotated[int, Field(ge=0)] | ROS 生命周期状态编号。 |
label | Annotated[str, Field(min_length=1)] | ROS 生命周期状态名称。 |
id
python
id: Annotated[int, Field(ge=0)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:50
label
python
label: Annotated[str, Field(min_length=1)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:51
__init__
python
def __init__(id: Annotated[int, Field(ge=0)], label: Annotated[str, Field(min_length=1)]) -> None实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:41
NodeDiagnostics
python
class NodeDiagnostics(tick_count: Annotated[int, Field(ge=0)], simulation_time: Annotated[FiniteFloat, Field(ge=0)], late_ticks: Annotated[int, Field(ge=0)], last_error: str | None)最后发布的步计数、模型时间(秒)、超期次数和错误。
属性
| 名称 | 类型 | 说明 |
|---|---|---|
tick_count | Annotated[int, Field(ge=0)] | 已完成的模型步数。 |
simulation_time | Annotated[FiniteFloat, Field(ge=0)] | 模型时间,单位秒。 |
late_ticks | Annotated[int, Field(ge=0)] | 逾期步数。 |
last_error | str | None | 最近一次错误,没有错误时为 None。 |
tick_count
python
tick_count: Annotated[int, Field(ge=0)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:65
simulation_time
python
simulation_time: Annotated[FiniteFloat, Field(ge=0)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:66
late_ticks
python
late_ticks: Annotated[int, Field(ge=0)]实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:67
last_error
python
last_error: str | None实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:68
__init__
python
def __init__(tick_count: Annotated[int, Field(ge=0)], simulation_time: Annotated[FiniteFloat, Field(ge=0)], late_ticks: Annotated[int, Field(ge=0)], last_error: str | None) -> None实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:54
NodeClientError
python
class NodeClientError(RuntimeError)只读 HTTP 查询未成功。
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:71
NodeUnavailableError
python
class NodeUnavailableError(NodeClientError)连接失败、超时或 HTTP 503。
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:75
NodeProtocolError
python
class NodeProtocolError(NodeClientError)响应 JSON/字段不合法或其他 HTTP 错误。
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:79
JsonValue
python
type JsonValue = None | bool | int | FiniteFloat | str | list[JsonValue] | dict[str, JsonValue]可公开传输的 JSON 值,包括任意深度的有限数值。
实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/_json_types.py:5