devkit_ui.ui_node

ui_node.py — Sowbot web cockpit on :80

Functions

load_css()

Return the bundled app stylesheet from the package resources.

main()

ros_main()

Classes

NiceGuiNode(*args, **kwargs)

class devkit_ui.ui_node.NiceGuiNode(*args: Any, **kwargs: Any)[source]

Bases: Node

__init__() → None[source]

Initialize the ROS node, GUI view models, navigation interfaces, sensor state, and mission-planning components.

In simulation, configure the dedicated fallback GPS source used when no recent real GPS fix is available. Register the NiceGUI root page and initialize topology, obstacle, mission, safety, and navigation state.

archive_and_clear_map() → str[source]

Copy current map file to /workspace/maps/<name>_<N>, then write a fresh empty map doc back to the original path and reload it.

Returns a status string (caller displays it).

cancel_mission() → None[source]

Signal the executor thread to stop after the current row.

cancel_nav_goal() → None[source]

Cancel the active navigation goal.

If the goal has already been accepted, cancel it now. If a send is still in flight (accepted status not yet known), flag it so _nav_accepted cancels it the moment it arrives, and keep navigating set so a second goal cannot be accepted in the meantime.

async confirm_delete_node(name: str | None) → None[source]
async confirm_delete_row(row_id: int) → None[source]
content() → None[source]
delete_row(row_id: int) → None[source]

Delete all topology nodes belonging to a row and persist the updated map.

Parameters:

row_id (int) – Identifier of the row whose nodes should be deleted.

delete_topo_node(name: str) → None[source]

Delete a topology node and persist the updated map.

Parameters:

name (str) – Name of the topology node to delete.

drop_topo_node(name: str, row_id: int | None, row_role: str = 'entry') → None[source]

Add a topology node at the current robot position and persist it to the active map.

Parameters:
  • name (str) – Name for the new node.

  • row_id (int | None) – Row identifier to associate with the node, or None for a navigation node.

  • row_role (str) – Role of the node within its row, such as “entry” or “exit”.

repair_row_connectivity(connect_to: str | None = None) → None[source]

Rebuild missing in-row and headland connections for existing rows in the loaded topology map.

Parameters:

connect_to (str | None) – Optional node name to connect bidirectionally to the first row entry and last row exit.

save_f2c_rows_to_topo(prefix: str, row_id_start: int, overwrite: bool = False) → None[source]

Save the most recently planned F2C swaths as rows in the loaded topology map.

Parameters:
  • prefix (str) – Prefix used to name the generated row nodes.

  • row_id_start (int) – Identifier assigned to the first planned row.

  • overwrite (bool) – Whether to replace existing nodes with the specified prefix.

send_nav_goal(target: str) → None[source]

Send a navigation goal to the specified topology node.

Parameters:

target (str) – Name of the topology node to navigate to.

send_speed(x: float, y: float) → None[source]

Publish a velocity command and update the stored velocity values.

Parameters:
  • x (float) – Linear velocity command.

  • y (float) – Angular velocity command.

start_discovery() → None[source]

Initiate row discovery through the configured ROS 2 Trigger service.

Updates the discovery status as the request starts, completes, or fails.

start_track(prefix: str, interval: float, row_id: int | None, row_role: str | None) → None[source]

Start periodic recording of topology nodes using the specified naming prefix.

Parameters:
  • prefix (str) – Prefix used for numbered node names after normalization.

  • interval (float) – Time in seconds between recorded nodes.

  • row_id (int | None) – Optional row identifier associated with each node.

  • row_role (str | None) – Role assigned to recorded nodes when no row identifier is provided.

stop_discovery() → None[source]

Stop row discovery and update its status when the request completes.

stop_track() → None[source]

Stop tracking and mark the last tracked node as the row exit when applicable.

store_battery(msg: sensor_msgs.msg.BatteryState) → None[source]
store_fake_gps(msg: sensor_msgs.msg.NavSatFix) → None[source]

Consume the sim shim’s fix as a fallback ONLY (see _FAKE_GPS_TOPIC setup docstring). This topic is never seen by fusioncore, so this is purely for the UI’s own use (e.g. the topo-map save path needing a finite fix at cold start before the real bridge has published one). Content-gated rather than topic-gated: only takes effect if no real fix has arrived recently, so a slow-starting real bridge doesn’t leave the UI without any fix while it comes up.

store_gps(msg: sensor_msgs.msg.NavSatFix) → None[source]

Cache the latest real GNSS fix and refresh the wall-clock staleness timestamp.

toggle_estop() → None[source]

Toggle the soft emergency-stop state and publish the updated value.

update_bumper_back(msg: std_msgs.msg.Bool) → None[source]
update_bumper_front_bottom(msg: std_msgs.msg.Bool) → None[source]
update_bumper_front_top(msg: std_msgs.msg.Bool) → None[source]
update_estop_back(msg: std_msgs.msg.Bool) → None[source]
update_estop_front(msg: std_msgs.msg.Bool) → None[source]
devkit_ui.ui_node.load_css() → str[source]

Return the bundled app stylesheet from the package resources.

devkit_ui.ui_node.main() → None[source]
devkit_ui.ui_node.ros_main() → None[source]