devkit_ui.models

Classes

TopoDoc(name[, nodes, metric_map, pointset, ...])

Represents a topo document.

TopoEdge(action, edge_id, node)

Represents an edge between two topo nodes.

TopoNode(name[, pointset, nav_frame, edges, ...])

Represents a topo node.

TopoPose(**kwargs)

Represents a point's pose in 3D space.

TopoProperties([xy_goal_tolerance, ...])

Contains a set of properties for a topo node.

Vector2(x, y)

Represents a 2D vector.

Vector3(x, y[, z])

Represents a 3D vector.

Vector4(x, y[, z, w])

Represents a 4D vector.

class devkit_ui.models.TopoDoc(name: str, nodes: list[TopoNode] | list[dict] | None = None, metric_map: str | None = None, pointset: str | None = None, meta: dict | None = None, actions: dict | None = None, definitions: dict | None = None, transformation: dict | None = None)[source]

Bases: object

Represents a topo document.

__init__(name: str, nodes: list[TopoNode] | list[dict] | None = None, metric_map: str | None = None, pointset: str | None = None, meta: dict | None = None, actions: dict | None = None, definitions: dict | None = None, transformation: dict | None = None) → None[source]

Build a TopoDoc, indexing any provided nodes by name.

property actions: dict
add_node(node: TopoNode) → None[source]
clone_empty(map_name: str | None = None) → TopoDoc[source]

Clones the document and returns a new document with no nodes. Retains metadata, actions, definitions, and transformation.

property definitions: dict
ensure_meta(map_name: str | None) → None[source]

Ensures that the metadata on the document is valid.

get_node(name: str) → TopoNode[source]
has_node(name: str) → bool[source]
insert_node(node: TopoNode) → None[source]

Add a node exactly as given, with no reverse-edge backfill.

Unlike add_node(), which assumes it’s dropping a single node onto an existing graph and back-fills the reverse edge on each neighbour, this is for callers that pass in nodes whose edges are already fully and correctly wired (in both directions, where that’s wanted) before the call — e.g. a batch of new nodes that reference each other. add_node() would KeyError on a sibling not yet inserted, and would silently add reverse edges the caller didn’t ask for onto pre-existing nodes.

property name: str
property nodes: Iterator[TopoNode]
remove_node(name: str) → None[source]
remove_nodes(names: set[str]) → None[source]
seed_actions(actions: dict, definitions: dict) → None[source]

Backfill actions/definitions from a template doc (e.g. the installed mixed_actions_map.yaml) when this doc has none of its own. Used when clearing/re-seeding a map that was itself loaded from an actions-less authored source, so navigation2.py always gets a real NavigateToPose/limbic_row_follow action config instead of silently running with none.

to_dict() → dict[source]
property transformation: dict
class devkit_ui.models.TopoEdge(action: str, edge_id: str, node: str)[source]

Bases: NamedTuple

Represents an edge between two topo nodes.

Note that these are not standalone, they are always part of a TopoNode in order to know what the two nodes are that are being connected.

action: str

Alias for field number 0

edge_id: str

Alias for field number 1

node: str

Alias for field number 2

class devkit_ui.models.TopoNode(name: str, pointset: str | None = None, nav_frame: str | None = None, edges: list[TopoEdge | str] | None = None, x: float | None = None, y: float | None = None, pose: TopoPose | None = None, properties: TopoProperties | None = None, verts: list[Vector2] | None = None, meta: dict | None = None)[source]

Bases: object

Represents a topo node.

__init__(name: str, pointset: str | None = None, nav_frame: str | None = None, edges: list[TopoEdge | str] | None = None, x: float | None = None, y: float | None = None, pose: TopoPose | None = None, properties: TopoProperties | None = None, verts: list[Vector2] | None = None, meta: dict | None = None) → None[source]

Constructs a new topo node.

For convenience you can pass in an x/y pair instead of a full pose.

add_edge(edge: TopoEdge | str, action: str | None = None) → None[source]
add_metadata(**kwargs: dict) → None[source]
property edges: Iterator[TopoEdge]
ensure_meta(map_name: str) → None[source]

Ensures that the metadata on the node is valid.

is_connected_to(node_id: str) → bool[source]
property meta: dict
property name: str
patch_role(role: str) → None[source]
remove_edge(node_id: str) → None[source]
remove_edges(node_ids: set[str]) → None[source]
to_dict() → dict[source]
property x: float
property y: float
class devkit_ui.models.TopoPose(**kwargs)[source]

Bases: object

Represents a point’s pose in 3D space.

property orientation: Vector4
property position: Vector3
to_dict() → dict[source]
class devkit_ui.models.TopoProperties(xy_goal_tolerance: float = 0.0, yaw_goal_tolerance: float = 0.0, dropped_by: str = '', timestamp: datetime | None = None, row_id: str = '', row_role: str = '', gps_lat: float = 0.0, gps_lon: float = 0.0, gps_fix_type: int = 0, gps_hdop: float | None = None)[source]

Bases: NamedTuple

Contains a set of properties for a topo node.

dropped_by: str

Alias for field number 2

gps_fix_type: int

Alias for field number 8

gps_hdop: float | None

Alias for field number 9

gps_lat: float

Alias for field number 6

gps_lon: float

Alias for field number 7

row_id: str

Alias for field number 4

row_role: str

Alias for field number 5

timestamp: datetime | None

Alias for field number 3

xy_goal_tolerance: float

Alias for field number 0

yaw_goal_tolerance: float

Alias for field number 1

class devkit_ui.models.Vector2(x: float, y: float)[source]

Bases: NamedTuple

Represents a 2D vector.

x: float

Alias for field number 0

y: float

Alias for field number 1

class devkit_ui.models.Vector3(x: float, y: float, z: float = 0.0)[source]

Bases: NamedTuple

Represents a 3D vector.

x: float

Alias for field number 0

y: float

Alias for field number 1

z: float

Alias for field number 2

class devkit_ui.models.Vector4(x: float, y: float, z: float = 0.0, w: float = 1.0)[source]

Bases: NamedTuple

Represents a 4D vector.

w: float

Alias for field number 3

x: float

Alias for field number 0

y: float

Alias for field number 1

z: float

Alias for field number 2