pub struct EventBuilder { /* private fields */ }Expand description
Fluent builder for UDM events.
§Example
use phytrace_sdk::core::{EventBuilder, PhyTraceConfig};
use phytrace_sdk::{EventType, SourceType};
let config = PhyTraceConfig::new("robot-001")
.with_source_type(SourceType::Amr);
let event = EventBuilder::new(&config)
.event_type(EventType::TelemetryPeriodic)
.position_local(10.0, 20.0, 0.0)
.heading_deg(90.0)
.battery_soc(85.0)
.build()
.unwrap();Implementations§
Source§impl EventBuilder
impl EventBuilder
Sourcepub fn new(config: &PhyTraceConfig) -> Self
pub fn new(config: &PhyTraceConfig) -> Self
Create a new event builder with configuration.
Sourcepub fn event_type(self, event_type: EventType) -> Self
pub fn event_type(self, event_type: EventType) -> Self
Set the event type.
Sourcepub fn source_type(self, source_type: SourceType) -> Self
pub fn source_type(self, source_type: SourceType) -> Self
Override the source type.
Sourcepub fn source_id(self, source_id: impl Into<String>) -> Self
pub fn source_id(self, source_id: impl Into<String>) -> Self
Set the source ID (robot/system identifier). This sets both the top-level source_id (for PhyCloud) and the identity domain.
Sourcepub fn model_info(
self,
_manufacturer: impl Into<String>,
model: impl Into<String>,
firmware: impl Into<String>,
) -> Self
pub fn model_info( self, _manufacturer: impl Into<String>, model: impl Into<String>, firmware: impl Into<String>, ) -> Self
Set model/firmware information.
Sourcepub fn position_local(self, x: f64, y: f64, z: f64) -> Self
pub fn position_local(self, x: f64, y: f64, z: f64) -> Self
Set local position (x, y, z in meters).
Sourcepub fn position_2d(self, x: f64, y: f64) -> Self
pub fn position_2d(self, x: f64, y: f64) -> Self
Set 2D position (convenience for x, y only).
Sourcepub fn position_3d(self, x: f64, y: f64, z: f64) -> Self
pub fn position_3d(self, x: f64, y: f64, z: f64) -> Self
Set 3D position (convenience alias).
Sourcepub fn heading_deg(self, heading: f64) -> Self
pub fn heading_deg(self, heading: f64) -> Self
Set heading in degrees (0-360).
Sourcepub fn map(self, map_id: impl Into<String>, frame_id: impl Into<String>) -> Self
pub fn map(self, map_id: impl Into<String>, frame_id: impl Into<String>) -> Self
Set map ID and frame.
Sourcepub fn linear_velocity(self, vx: f64, vy: f64, vz: f64) -> Self
pub fn linear_velocity(self, vx: f64, vy: f64, vz: f64) -> Self
Set linear velocity (m/s).
Sourcepub fn angular_velocity(
self,
roll_rps: f64,
pitch_rps: f64,
yaw_rps: f64,
) -> Self
pub fn angular_velocity( self, roll_rps: f64, pitch_rps: f64, yaw_rps: f64, ) -> Self
Set angular velocity (rad/s) - converts to degrees/s internally.
Sourcepub fn battery_soc(self, soc_percent: f64) -> Self
pub fn battery_soc(self, soc_percent: f64) -> Self
Set battery state of charge (0-100%).
Sourcepub fn battery_voltage(self, voltage_v: f64) -> Self
pub fn battery_voltage(self, voltage_v: f64) -> Self
Set battery voltage.
Sourcepub fn battery_health(self, health_percent: f64) -> Self
pub fn battery_health(self, health_percent: f64) -> Self
Set battery health (0-100%).
Sourcepub fn operational_mode(self, mode: OperationalMode) -> Self
pub fn operational_mode(self, mode: OperationalMode) -> Self
Set operational mode.
Sourcepub fn operational_state(self, state: OperationalState) -> Self
pub fn operational_state(self, state: OperationalState) -> Self
Set operational state.
Sourcepub fn task(
self,
task_id: impl Into<String>,
task_type: impl Into<String>,
) -> Self
pub fn task( self, task_id: impl Into<String>, task_type: impl Into<String>, ) -> Self
Set current task.
Sourcepub fn safety_state(self, state: SafetyState) -> Self
pub fn safety_state(self, state: SafetyState) -> Self
Set safety state.
Sourcepub fn estop_active(self, active: bool) -> Self
pub fn estop_active(self, active: bool) -> Self
Set e-stop status.
Sourcepub fn localization_quality(self, quality: LocalizationQuality) -> Self
pub fn localization_quality(self, quality: LocalizationQuality) -> Self
Set localization quality.
Sourcepub fn path_state(self, state: PathState) -> Self
pub fn path_state(self, state: PathState) -> Self
Set path state.
Sourcepub fn identity(self, identity: IdentityDomain) -> Self
pub fn identity(self, identity: IdentityDomain) -> Self
Set the full identity domain.
Sourcepub fn location(self, location: LocationDomain) -> Self
pub fn location(self, location: LocationDomain) -> Self
Set the full location domain.
Sourcepub fn motion(self, motion: MotionDomain) -> Self
pub fn motion(self, motion: MotionDomain) -> Self
Set the full motion domain.
Sourcepub fn power(self, power: PowerDomain) -> Self
pub fn power(self, power: PowerDomain) -> Self
Set the full power domain.
Sourcepub fn operational(self, operational: OperationalDomain) -> Self
pub fn operational(self, operational: OperationalDomain) -> Self
Set the full operational domain.
Set the full navigation domain.
Sourcepub fn perception(self, perception: PerceptionDomain) -> Self
pub fn perception(self, perception: PerceptionDomain) -> Self
Set the full perception domain.
Sourcepub fn safety(self, safety: SafetyDomain) -> Self
pub fn safety(self, safety: SafetyDomain) -> Self
Set the full safety domain.
Sourcepub fn actuators(self, actuators: ActuatorsDomain) -> Self
pub fn actuators(self, actuators: ActuatorsDomain) -> Self
Set the full actuators domain.
Sourcepub fn communication(self, communication: CommunicationDomain) -> Self
pub fn communication(self, communication: CommunicationDomain) -> Self
Set the full communication domain.
Sourcepub fn compute(self, compute: ComputeDomain) -> Self
pub fn compute(self, compute: ComputeDomain) -> Self
Set the full compute domain.
Sourcepub fn maintenance(self, maintenance: MaintenanceDomain) -> Self
pub fn maintenance(self, maintenance: MaintenanceDomain) -> Self
Set the full maintenance domain.
Sourcepub fn context(self, context: ContextDomain) -> Self
pub fn context(self, context: ContextDomain) -> Self
Set the full context domain.
Sourcepub fn payload(self, payload: PayloadDomain) -> Self
pub fn payload(self, payload: PayloadDomain) -> Self
Set the full payload domain.
Sourcepub fn manipulation(self, manipulation: ManipulationDomain) -> Self
pub fn manipulation(self, manipulation: ManipulationDomain) -> Self
Set the full manipulation domain.
Sourcepub fn coordination(self, coordination: CoordinationDomain) -> Self
pub fn coordination(self, coordination: CoordinationDomain) -> Self
Set the full coordination domain.
Sourcepub fn simulation(self, simulation: SimulationDomain) -> Self
pub fn simulation(self, simulation: SimulationDomain) -> Self
Set the full simulation domain.
Sourcepub fn thermal(self, thermal: ThermalDomain) -> Self
pub fn thermal(self, thermal: ThermalDomain) -> Self
Set the full thermal domain.
Sourcepub fn audio(self, audio: AudioDomain) -> Self
pub fn audio(self, audio: AudioDomain) -> Self
Set the full audio domain.
Sourcepub fn environment_interaction(
self,
environment_interaction: EnvironmentInteractionDomain,
) -> Self
pub fn environment_interaction( self, environment_interaction: EnvironmentInteractionDomain, ) -> Self
Set the full environment interaction domain.
Sourcepub fn compliance(self, compliance: ComplianceDomain) -> Self
pub fn compliance(self, compliance: ComplianceDomain) -> Self
Set the full compliance domain.
Sourcepub fn extensions(self, extensions: Value) -> Self
pub fn extensions(self, extensions: Value) -> Self
Set custom extensions.
Sourcepub fn build(self) -> PhyTraceResult<UdmEvent>
pub fn build(self) -> PhyTraceResult<UdmEvent>
Build the event, validating and optionally signing.
Sourcepub fn build_unchecked(self) -> UdmEvent
pub fn build_unchecked(self) -> UdmEvent
Build without validation.