Source code for olo.locomotion.types

"""Value types for finite local mobile-locomotion."""

from dataclasses import dataclass
from enum import Enum


[docs] class LocomotionOutcome(Enum): """Terminal outcome for a local locomotion-motion command.""" UNSPECIFIED = "unspecified" SUCCEEDED = "succeeded" STALLED = "stalled" TIMED_OUT = "timed_out" ODOM_STALE = "odom_stale" CANCELLED = "cancelled" ABORTED = "aborted"
[docs] @dataclass(frozen=True, slots=True, repr=False) class PlanarMotion: """Planar x/y/yaw values for displacement or velocity.""" x: float = 0.0 y: float = 0.0 yaw: float = 0.0 def __repr__(self) -> str: return ( f"PlanarMotion(x={self.x:.3f}, y={self.y:.3f}, " f"yaw={self.yaw:.3f})" )
[docs] @dataclass(frozen=True, slots=True) class AppliedVelocity: """Velocity accepted by the appliance and its resolved command topic.""" applied: PlanarMotion cmd_vel_topic: str
[docs] @dataclass(frozen=True, slots=True, repr=False) class LocomotionFeedback: """Progress for an active local locomotion-motion command.""" measured: PlanarMotion remaining: PlanarMotion elapsed: float def __repr__(self) -> str: return ( f"LocomotionFeedback(measured={self.measured!r}, " f"remaining={self.remaining!r}, elapsed={self.elapsed:.3f})" )
[docs] @dataclass(frozen=True, slots=True) class LocomotionResult: """Terminal result for a local locomotion-motion command.""" outcome: LocomotionOutcome reason: str requested: PlanarMotion measured: PlanarMotion residual: PlanarMotion elapsed: float
__all__ = [ "AppliedVelocity", "LocomotionFeedback", "LocomotionOutcome", "LocomotionResult", "PlanarMotion", ]