Skip to content

navigation

CannotStop

Bases: Exception

Raised when a requested stop cannot be made, so the caller should skip its target.

DriveSegment dataclass

DriveSegment(
    *,
    use_implement: bool = False,
    stop_at_end: bool = True,
    speed_limit: float | None = None
)

Bases: PathSegment

A path segment with implement usage, stop behavior and speed configuration.

GnssRequirement

Bases: StrEnum

Minimum GPS quality required when recording waypoints.

is_met_by

is_met_by(gps_quality: GpsQuality | None) -> bool

Check whether the given GPS quality meets this requirement.

Events

Name Description
RECORDED_TRACKS_CHANGED The selected track has changed.

Navigation

Bases: ABC

Produces the segments to drive, one at a time.

segments abstractmethod

segments(
    speed_limit: float,
) -> AsyncGenerator[DriveSegment, None]

Yield the segments to drive, in order, until the navigation ends.

Attributes & Properties

Name Type Description
gnss_requirement GnssRequirement The positioning quality this navigation needs.

Events

Name Description
PATH_CHANGED The segments still to drive have changed.

NavigationRefused

Bases: Exception

Raised when a navigation cannot be planned at all, so the run never starts.

Events

Name Description
PATH_CHANGED The segments still to drive have changed.

PathDriver

PathDriver(driver: Driver)

Drives the segments a navigation hands out, offering speed and stop controls.

STOP_LOOKAHEAD class-attribute instance-attribute

STOP_LOOKAHEAD: float = 1.0

How far (m) from the segment being driven a target may lie and still be stopped at.

drive async

drive(segment: DriveSegment) -> None

Drive segment to its end, honoring pending stop and stops submitted later.

Note that a caller should not interfere with self.driver while drive is active.

is_reached

is_reached(target: Point, tool_offset_x: float) -> bool

Whether the tool already sits on target, so working it needs no driving at all.

limit_speed_to

limit_speed_to(speed: float) -> Iterator[None]

Cap the driving speed for as long as the scope is held, the piece being driven included.

stop_over async

stop_over(
    target: Point, tool_offset_x: float
) -> AsyncGenerator[None, None]

Come to rest with the tool on target and hold there for the body of the scope.

:raises CannotStop: the target cannot be driven onto; the robot keeps going, skip it

Reach

Bases: Enum

Where a spline can bring the tool, relative to a target.

BEHIND class-attribute instance-attribute

BEHIND = auto()

Already past it at the spline's start, and a path only goes forward.

BEYOND class-attribute instance-attribute

BEYOND = auto()

Not on this spline, but a later part of the path may still contain it.

RecordedTrack

RecordedTrack(name: str | None = None)

A track (basically a list of waypoints) that can be recorded and later navigated along.

add_waypoint

add_waypoint(
    waypoint: GeoPose, approach_reverse: bool = False
) -> None

Add a waypoint to the end of the list.

clear

clear() -> None

Remove all waypoints.

get_waypoint

get_waypoint(index: int) -> RecordedWaypoint

Get the waypoint at the given index, raising IndexError if out of bounds.

meets_gnss_requirement

meets_gnss_requirement(
    gps_quality: GpsQuality | None,
) -> bool

Check whether the given GPS quality meets this track's minimum requirement.

move_waypoint

move_waypoint(from_index: int, to_index: int) -> None

Move a waypoint from one position to another.

remove_waypoint

remove_waypoint(index: int) -> None

Remove a waypoint at the specified index.

set_waypoint_approach_reverse

set_waypoint_approach_reverse(
    index: int, approach_reverse: bool
) -> None

Set whether to approach the waypoint at the given index in reverse.

set_waypoint_stop_at_waypoint

set_waypoint_stop_at_waypoint(
    index: int, stop_at_waypoint: bool
) -> None

Set whether to stop at this waypoint.

set_waypoint_use_implement

set_waypoint_use_implement(
    index: int, use_implement: bool
) -> None

Set whether to allow implement usage on the segment leading to this waypoint.

Attributes & Properties

Name Type Description
first_waypoint feldfreund_devkit.navigation.recorded_track.RecordedWaypoint | None Get the first waypoint.
last_waypoint feldfreund_devkit.navigation.recorded_track.RecordedWaypoint | None Get the last waypoint.
waypoints list Get the waypoints.

Events

Name Description
RECORDED_TRACKS_CHANGED The selected track has changed.

RecordedTrackNavigation

RecordedTrackNavigation(
    *,
    recorded_track_provider: RecordedTrackProvider,
    track_recording_controller: TrackRecordingController,
    pose_provider: PoseProvider,
    gnss: Gnss | None = None,
    robot_marker_icon_url: str | None = None
)

Bases: StaticNavigation, SettingsUI, Persistable

The waypoints of a previously recorded track, as segments to drive.

RESUME_MAX_HEADING class-attribute instance-attribute

RESUME_MAX_HEADING: float = np.deg2rad(45)

How far (rad) off the track's heading the robot may stand and still join it part-way.

RESUME_MAX_OFFSET class-attribute instance-attribute

RESUME_MAX_OFFSET: float = 2.0

How far (m) off the track the robot may stand and still join it part-way.

RecordedTrackProvider

RecordedTrackProvider()

Bases: Persistable

A provider of recorded waypoints.

selected_track instance-attribute

selected_track: RecordedTrack | None = None

The recorded tracks have changed.

add_recorded_track

add_recorded_track(track: RecordedTrack) -> None

Add a recorded track to the list.

backup_to_dict

backup_to_dict() -> dict[str, Any]

Backup the recorded tracks to a dictionary.

get_recorded_track

get_recorded_track(track_id: str) -> RecordedTrack | None

Get the recorded track by ID.

get_track_names_by_id

get_track_names_by_id() -> dict[str, str]

Get the track names by their IDs.

notify_track_modified

notify_track_modified() -> None

Persist changes to an existing track (e.g. waypoint added/removed/moved, name changed).

remove_recorded_track

remove_recorded_track(track_id: str) -> None

Remove a recorded track from the list.

restore_from_dict

restore_from_dict(data: dict[str, Any]) -> None

Restore the recorded tracks from a dictionary.

select_track

select_track(track_id: str) -> None

Select a track by ID.

Events

Name Description
RECORDED_TRACKS_CHANGED The selected track has changed.

RecordedWaypoint dataclass

RecordedWaypoint(
    *,
    pose: GeoPose,
    approach_reverse: bool = False,
    use_implement: bool = False,
    stop_at_waypoint: bool = False
)

A waypoint with optional drive settings flags.

Events

Name Description
RECORDED_TRACKS_CHANGED The selected track has changed.

StaticNavigation

StaticNavigation()

Bases: Navigation

A navigation whose path is planned before the drive starts.

generate_path abstractmethod

generate_path(speed_limit: float) -> list[DriveSegment]

Plan the whole path; an empty list means there is nothing to drive.

Attributes & Properties

Name Type Description
gnss_requirement GnssRequirement The positioning quality this navigation needs.

Events

Name Description
PATH_CHANGED The segments still to drive have changed.

StraightLineNavigation

StraightLineNavigation(pose_provider: PoseProvider)

Bases: StaticNavigation, SettingsUI, Persistable

Navigation that drives a straight line for a given length.

Attributes & Properties

Name Type Description
gnss_requirement GnssRequirement The positioning quality this navigation needs.

TrackRecordingController

TrackRecordingController(
    recorded_track_provider: RecordedTrackProvider,
    *,
    pose_provider: PoseProvider,
    gnss: Gnss | None = None
)

Server-side recording mode that survives client disconnects.

Owns the bluetooth-app waypoint button so the operator can keep adding waypoints even if the browser/dialog is gone.

The app button bar (app_controls) is bound late: it is created by the application after this controller and only on real hardware, so it stays None until assigned and the button registration is skipped while absent.

add_waypoint_at_current_pose async

add_waypoint_at_current_pose() -> None

Append the robot's current pose as a waypoint to the active track.

Returns without adding if not recording or if the GNSS quality is insufficient. The GNSS case notifies the operator (forwarded to both browser clients and the bluetooth app via rosys.NEW_NOTIFICATION).

start_recording async

start_recording(track: RecordedTrack) -> bool

Start a recording session. Returns False if a session is already active.

Persists the track immediately (so it survives a server crash) without emitting RECORDED_TRACKS_CHANGED — that event refreshes the settings UI which would tear down a dialog opened from there. Stop emits it instead.

stop_recording async

stop_recording() -> None

Stop the active recording. Idempotent.