crate::endpoints! {
manual: Setpoint<ManualCommand>;
state: State<State>;
}
#[derive(
phoxal_macros::DescribeWire,
Copy,
Eq,
Clone,
Debug,
PartialEq,
serde::Serialize,
serde::Deserialize,
)]
#[serde(rename_all = "snake_case")]
pub enum Source {
Manual,
Navigation,
EmergencyStop,
}
#[derive(
phoxal_macros::DescribeWire,
Copy,
Eq,
Clone,
Debug,
PartialEq,
serde::Serialize,
serde::Deserialize,
)]
#[serde(rename_all = "snake_case")]
pub enum ZeroReason {
NoCandidate,
NavigationCandidateStale,
ManualCandidateNotFinite,
NavigationCandidateNotFinite,
EmergencyStopEngaged,
SafetyConstraintsUnavailable,
SafetyProtectiveStop,
}
#[derive(
phoxal_macros::DescribeWire,
Copy,
Eq,
Clone,
Debug,
PartialEq,
serde::Serialize,
serde::Deserialize,
)]
#[serde(rename_all = "snake_case")]
pub enum SafetyRuntime {
Absent,
Present,
}
#[derive(
phoxal_macros::DescribeWire, Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize,
)]
pub struct ManualCommand {
pub linear: f64,
pub angular: f64,
}
#[derive(
phoxal_macros::DescribeWire, Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize,
)]
pub enum Decision {
Active {
source: Source,
target: crate::api::drive::Target,
},
Stopped {
reason: ZeroReason,
},
}
#[derive(
phoxal_macros::DescribeWire, Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize,
)]
pub struct State {
pub decision: Decision,
pub manual_observed_age_ns: Option<u64>,
pub autonomous_candidate_age_ns: Option<u64>,
pub safety_constraints_age_ns: Option<u64>,
pub safety_runtime: SafetyRuntime,
pub component_estop_blocked: bool,
pub active_safety_constraints: Vec<super::safety::Constraint>,
pub safety_permission: super::safety::MotionPermission,
}